diff options
| author | alex <alex@pdp7.net> | 2023-11-05 12:09:41 +0100 |
|---|---|---|
| committer | alex <alex@pdp7.net> | 2023-11-05 12:09:41 +0100 |
| commit | b7daf11b2819049b11690fbc9ef745713d3c77fe (patch) | |
| tree | 80312174421a4e659aeaa6b56b29abe8a59b8878 | |
| parent | 06f23070b052809a6a0bb4d8d42d6fa4c6994e00 (diff) | |
Update to use superconfigure
| -rw-r--r-- | scripts/p7s/emacs.py | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/scripts/p7s/emacs.py b/scripts/p7s/emacs.py index d977554f..22a9b42c 100644 --- a/scripts/p7s/emacs.py +++ b/scripts/p7s/emacs.py @@ -1,16 +1,31 @@ import pathlib +import shutil import textwrap +import urllib.request + + +COSMO_BUILD_URL = "https://github.com/alexpdp7/superconfigure/releases/download/cleanup/editor.zip" def setup_emacs(): + cache = pathlib.Path.home() / ".cache" + editor_zip = cache / "editor.zip" + urllib.request.urlretrieve(COSMO_BUILD_URL, editor_zip) + + superconfigure_cache = cache / "superconfigure" + shutil.unpack_archive(editor_zip, superconfigure_cache) + + for b in (superconfigure_cache / "bin").glob("*"): + b.chmod(0o755) + bin = pathlib.Path.home() / ".local" / "bin" emacs = bin / "emacs" - emacs.write_text(textwrap.dedent(""" - #!/bin/sh - - ~/.cache/cosmo/bin/emacsclient --create-frame -t "$@" || { - ~/.cache/cosmo/bin/emacs --daemon --user="" - ~/.cache/cosmo/bin/emacsclient --create-frame -t "$@" - } - """)) + emacs.write_text(textwrap.dedent(f""" + #!/bin/sh + + {superconfigure_cache}/bin/emacsclient --create-frame -t "$@" || {{ + {superconfigure_cache}/bin/emacs --daemon --user="" + {superconfigure_cache}/bin/emacsclient --create-frame -t "$@" + }} + """).lstrip()) emacs.chmod(0o755) |
