diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-06-01 11:56:35 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-06-01 12:22:01 -0700 |
commit | 023b7528290e5fb57b4e6c53b54f60f3551f4672 (patch) | |
tree | 87d431137bed5ca0dea31798cbf1d329bde2308b | |
parent | dea594ee0e3d71d99388516bf8aecc7364dc76f8 (diff) | |
download | dotfiles-023b7528290e5fb57b4e6c53b54f60f3551f4672.tar.gz |
have a constant fallback from GNU Emacs to plain vi
-rw-r--r-- | .bashrc | 2 | ||||
-rw-r--r-- | .config/i3/config | 2 | ||||
-rwxr-xr-x | .shenv | 38 | ||||
-rw-r--r-- | archive/.mg (renamed from .mg) | 0 | ||||
-rw-r--r-- | archive/.zile (renamed from .zile) | 0 |
5 files changed, 15 insertions, 27 deletions
@@ -47,8 +47,6 @@ alias grep="grep --colour=auto" alias g="git" alias ga="git annex" -alias mg="$EDITOR" -alias vi="$EDITOR" alias e="$EDITOR" alias mrs="src-register-all && mr -m status" alias d="emacsclient -c -n -e '(dired \".\")' >/dev/null" diff --git a/.config/i3/config b/.config/i3/config index ccc06e79..515f2ab9 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -38,7 +38,7 @@ workspace_layout tabbed bindsym $mod+Return exec xfce4-terminal # start an Emacs frame -bindsym $mod+Shift+Return exec emacsclient -c -a '' -n -e '(switch-to-buffer "*scratch*")' +bindsym $mod+Shift+Return exec emacsclient -cn # start a browser window bindsym $mod+b exec firefox -new-window @@ -9,38 +9,28 @@ set +e # ---- choose editor depending on what's available if [ "$DESKTOP_SESSION" = "i3" ]; then - ec_args="-c" + ec="emacsclient -c" else - ec_args="-t" + ec="emacsclient -t" fi +# Either GNU Emacs, or UNIX vi -- lightweight Emacs alternatives like +# mg and zile are so rarely installed, so let's have a constant +# fallback which is almost certainly available and which I can use +# well enough. When GNU Emacs is available, set ALTERNATE_EDITOR to +# the empty string so that an `emacs --daemon` process is spawned emacsclient=$(which emacsclient 2>/dev/null) -mg=$(which mg 2>/dev/null) -# best case: emacsclient and mg available -if [ -x "$emacsclient" -a -x "$mg" ]; then - EDITOR="emacsclient $ec_args" - ALTERNATE_EDITOR="mg" +if [ -x "$emacsclient" ]; then + EDITOR="$ec" + ALTERNATE_EDITOR="" + export ALTERNATE_EDITOR else - # only emacsclient, so change alternate editor - if [ -x "$emacsclient" ]; then - EDITOR="emacsclient $ec_args" - ALTERNATE_EDITOR="vi" - else - # no emacsclient, so see if we can fall back to mg - if [ -x "$mg" ]; then - EDITOR="mg" - ALTERNATE_EDITOR="vi" - # worse case: assume vi is available - else - EDITOR="vi" - fi - fi + EDITOR="vi" fi -unset ec_args +unset ec unset emacsclient -unset mg export EDITOR -VISUAL=$EDITOR +VISUAL="$EDITOR" export VISUAL # ---- set $PATH |