diff options
-rw-r--r-- | .config/i3/config | 8 | ||||
-rw-r--r-- | .config/sway/config | 8 | ||||
-rwxr-xr-x | bin/emacsclient | 23 |
3 files changed, 23 insertions, 16 deletions
diff --git a/.config/i3/config b/.config/i3/config index 6f42f06e..adf5c327 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -59,17 +59,17 @@ mode "C-i-" { # make a fresh Emacs frame -- typically this gets invoked only on # empty workspaces, as otherwise I use commands under `C-x 5` to get # more Emacs frames - bindsym e exec emacsclient -nc -w8, mode "default" + bindsym e exec emacsclient -ncw8, mode "default" # override the script's usual logic to start a fresh, non-debug daemon - bindsym Shift+e exec emacsclient -nc -w8 --spw/installed, mode "default" + bindsym Shift+e exec emacsclient -ncw8 --spw/installed, mode "default" # special daemon instance for debugging primary instance & Gnus - bindsym Mod1+e exec emacsclient -nc -w8 -sgdbmacs, mode "default" + bindsym Mod1+e exec emacsclient -ncw8 -sgdbmacs, mode "default" # Fresh Emacs frame and get a shell in HOME. Without this it's # C-i e M-& which is too many keys esp. compared to C-i DEL - bindsym Return exec emacsclient -nc -w8 -e \ + bindsym Return exec emacsclient -ncw8 -e \ "(let ((default-directory (expand-file-name "'"'~/'"'")) \ (display-buffer-overriding-action \ '(display-buffer-same-window \ diff --git a/.config/sway/config b/.config/sway/config index cde42aed..cc212070 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -38,17 +38,17 @@ mode "C-i-" { # make a fresh Emacs frame -- typically this gets invoked only on # empty workspaces, as otherwise I use commands under `C-x 5` to get # more Emacs frames - bindsym e exec emacsclient -nc -w8, mode "default" + bindsym e exec emacsclient -ncw8, mode "default" # override the script's usual logic to start a fresh, non-debug daemon - bindsym Shift+e exec emacsclient -nc -w8 --spw/installed, mode "default" + bindsym Shift+e exec emacsclient -ncw8 --spw/installed, mode "default" # special daemon instance for debugging primary instance & Gnus - bindsym Mod1+e exec emacsclient -nc -w8 -sgdbmacs, mode "default" + bindsym Mod1+e exec emacsclient -ncw8 -sgdbmacs, mode "default" # Fresh Emacs frame and get a shell in HOME. Without this it's # C-i e M-& which is too many keys esp. compared to C-i DEL - bindsym Return exec emacsclient -nc -w8 -e \ + bindsym Return exec emacsclient -ncw8 -e \ "(let ((default-directory (expand-file-name "'"'~/'"'")) \ (display-buffer-overriding-action \ '(display-buffer-same-window \ diff --git a/bin/emacsclient b/bin/emacsclient index c30b341a..12630575 100755 --- a/bin/emacsclient +++ b/bin/emacsclient @@ -20,7 +20,7 @@ # emacsclient(1) wrapper to handle updating the environment of existing # daemons and choosing between installed and in-tree builds of Emacs. -min_arg=0 +min_arg=1 may_start=true want_update=false want_installed=false @@ -63,6 +63,17 @@ for cmd in bash flock inotifywait perl pwdx ss; do done [ -n "$BASH_VERSION" ] || exec bash "$0" "$@" +# We have to do this to break up clustered short options. An unfortunate +# consequence is maintaining a copy of all of emacsclient(1)'s long opts here. +# To mitigate that somewhat, don't hard fail if we hit an unrecognised option. +getopt=$(getopt -qas bash -n emacsclient -o "nqueHVtca:F:w:s:f:d:T:" \ + -l "spw/installed,spw/no-start,spw/update-environment \ +no-wait,quiet,suppress-output,eval,help,version,tty,nw,\ +create-frame,reuse-frame,alternate-editor:,frame-parameters:,socket-name:,\ +server-file:,display:,parent-id:,timeout:,tramp:" -- "$@") +[ $? -eq 0 ] || defer "$@" +eval set -- "$getopt" + get_listener () { local socket="$1" local listener=$(ss -Hplx src "$socket" \ @@ -126,6 +137,7 @@ for arg do '--spw/update-environment') want_update=true ;; '-V'|'--version') want_version=true ;;& '-e'|'--eval') want_eval=true ;;& + '-s'|'--socket-name') min_arg=3; daemon_name="$1" ;;& # We'll use the same timeout for some things we do in this script, # if the user has supplied a value. @@ -137,14 +149,9 @@ for arg do # locks on starting up daemons, else no other invocation of this # script will be able to do anything without manual intervention. '-w'|'--timeout') timeout="$1" ;;& - '-w'?*) timeout="${arg:2}" ;;& - '--timeout='?*) timeout="${arg:10}" ;;& - - '-s'|'--socket-name') min_arg=2; daemon_name="$1" ;;& - '-s'?*) min_arg=1; daemon_name="${arg:2}" ;;& - '--socket-name='?*) min_arg=1; daemon_name="${arg:14}" ;;& - *) set -- "$@" "$arg" ;; + '--nw') set -- "$@" -nw ;; + *) set -- "$@" "$arg" ;; esac done |