changeset 522:7983184eb8d8

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.
author Augie Fackler <raf@durin42.com>
date Sun, 31 Jul 2022 22:34:33 -0400
parents 6cc5a0550281
children a5a4f9e12c9f
files .shell.d/50.editorsetup.sh unixSoft/otherbin/emacs.sh
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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