summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2024-03-08 19:33:08 +0100
committeralex <alex@pdp7.net>2024-03-08 19:33:08 +0100
commit04226cebe9b30123c9a3a9ee3ef4411778bc5f32 (patch)
treee6a7fc7a7d532a47ec2382a5526a7d31556d6b9c /scripts
parent8bb0f3c316fc50a6d629dcb0b0851591a656bed5 (diff)
Move to RPM emacs
Diffstat (limited to 'scripts')
-rw-r--r--scripts/p7s/__init__.py4
-rw-r--r--scripts/p7s/emacs.py31
2 files changed, 8 insertions, 27 deletions
diff --git a/scripts/p7s/__init__.py b/scripts/p7s/__init__.py
index e69de29b..e1dfa06c 100644
--- a/scripts/p7s/__init__.py
+++ b/scripts/p7s/__init__.py
@@ -0,0 +1,4 @@
+import pathlib
+
+
+BASHRC_D = pathlib.Path.home() / ".bashrc.d"
diff --git a/scripts/p7s/emacs.py b/scripts/p7s/emacs.py
index da44bdff..3f46f3ea 100644
--- a/scripts/p7s/emacs.py
+++ b/scripts/p7s/emacs.py
@@ -1,31 +1,8 @@
import pathlib
-import shutil
-import textwrap
-import urllib.request
-
-
-COSMO_BUILD_URL = "https://github.com/alexpdp7/superconfigure/releases/download/emacs_29.1/editor.zip"
+import subprocess
+import p7s
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(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)
+ p7s.BASHRC_D.mkdir(parents=True, exist_ok=True)
+ subprocess.run(["ln", "-s", (pathlib.Path(__file__).parent.parent.parent / "emacs" / "emacs.bash").absolute(), p7s.BASHRC_D / "emacs.bash"], check=True)