Emacs: support for waiting client 'emw'

This is useful for program that need a graphical waiting instance of emacsclient
like dwb's external editor.
master
Pierre Neidhardt 2014-04-22 16:34:17 +02:00
parent d0baf84d34
commit f9f1db4d15
2 changed files with 27 additions and 3 deletions

View File

@ -42,7 +42,7 @@ adblocker-filterlist=~/.config/dwb/adblock_lists
proxy=false
user-agent=
full-content-zoom=true
editor=emacsclient -a "" -c dwb_uri
editor=emw dwb_uri
enable-accelerated-compositing=false
enable-private-browsing=false
enable-favicon=true

View File

@ -2,10 +2,34 @@
## Note: we do not use the (-a "") parameters of emacsclient to auto start the
## daemon since we want to pass additional parameters to emacs.
if [ "${0##*/}" = "emc" ] || [ -z "$DISPLAY" ]; then
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
cat <<EOF
Usage: ${0##*/} [FILES]
Start emacsclient in terminal or in X window if possible. If server is not
found, it is started with --no-site-file parameter.
Calling script can have different names.
* emc: emacs instance is opened in current terminal.
* emw: if graphical, tell client to wait.
All emacsclient(1) options are supported.
$(emacsclient --help)
EOF
exit
fi
if [ "${0##*/}" = "emc" ] || [ -z "$DISPLAY" ] || \
[ "$(emacs --batch -Q --eval='(if (fboundp '"'"'tool-bar-mode) (message "X") (message "TTY"))' 2>&1)" = TTY ]; then
param="-t"
else
param=$(emacs --batch -Q --eval='(if (fboundp '"'"'tool-bar-mode) (message "-nc") (message "-t"))' 2>&1)
if [ "${0##*/}" = "emw" ]; then
param="-c"
else
param="-nc"
fi
fi
[ ! -e /tmp/emacs$(id -u)/server ] && emacs --daemon --no-site-file