Skip to content

Commit

Permalink
run-emacscleint
Browse files Browse the repository at this point in the history
  • Loading branch information
vitek committed May 20, 2022
1 parent 438037b commit e8f88f8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ BIN_FILES = \
bin/clangd-chooser \
bin/histogram \
bin/json-pp \
bin/run-emacsclient \
bin/xkb-layout \
bin/xml-pp

Expand Down
6 changes: 1 addition & 5 deletions bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ export GTK_OVERLAY_SCROLLING=0
# https://ubuntuforums.org/showthread.php?t=2390362
export QT_AUTO_SCREEN_SCALE_FACTOR=0

if [ "x$EMACS_SOCKET_NAME" != "x" ]; then
alias e="emacsclient -r -n --socket-name $EMACS_SOCKET_NAME"
else
alias e="emacsclient -r -n"
fi
alias e="run-emacsclient"

if [ -f ~/.bashrc_local ]; then
. ~/.bashrc_local
Expand Down
15 changes: 15 additions & 0 deletions bin/run-emacsclient
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# -*- mode: shell-script; -*-

EMACSCLIENT_VERSION=$(emacsclient --version | grep -oE '[0-9]+' | head -1)
EMACSCLIENT_ARGS="-n"

if [ "x$EMACS_SOCKET_NAME" != "x" ]; then
EMACSCLIENT_ARGS="$EMACSCLIENT_ARGS --socket-name $EMACS_SOCKET_NAME"
fi

if [ "$EMACSCLIENT_VERSION" -ge "28" ]; then
EMACSCLIENT_ARGS="$EMACSCLIENT_ARGS -r"
fi

exec emacsclient $EMACSCLIENT_ARGS "$@"

0 comments on commit e8f88f8

Please sign in to comment.