aboutsummaryrefslogtreecommitdiff
path: root/scripts/p7s/emacs.py
blob: d977554f3c5d1ca9a13c239a1e80e99830dda552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import pathlib
import textwrap


def setup_emacs():
    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.chmod(0o755)