# HG changeset patch # User Augie Fackler # Date 1659321273 14400 # Node ID 7983184eb8d8fdb3cb628c827b3ca3a9f0c60e1d # Parent 6cc5a05502813b44a3cf7ca707c7965cc3b86250 emacs.sh: hack together fallback to vscode Lately if emacs is not running I prefer using vscode. This allows my muscle memory to keep working. diff --git a/.shell.d/50.editorsetup.sh b/.shell.d/50.editorsetup.sh --- a/.shell.d/50.editorsetup.sh +++ b/.shell.d/50.editorsetup.sh @@ -1,5 +1,5 @@ export ALTERNATE_EDITOR=$HOME/unixSoft/otherbin/emacs.sh -alias e='emacsclient -n' +alias e='emacsclient -n -a "$HOME/unixSoft/otherbin/emacs.sh -n"' alias ee='emacsclient' if [ -z "$SSH_CONNECTION" ] ; then # GUI session, use emacsclient diff --git a/unixSoft/otherbin/emacs.sh b/unixSoft/otherbin/emacs.sh --- a/unixSoft/otherbin/emacs.sh +++ b/unixSoft/otherbin/emacs.sh @@ -1,6 +1,15 @@ #!/bin/sh if [ "`uname`" = "Darwin" ] ; then - open -a emacs "$@" + if hash code 2>/dev/null ; then + if [ "$1" = "-n" ] ; then + shift + code "$@" + else + code --wait "$@" + fi + else + open -a emacs "$@" + fi else emacs -nw "$@" fi