From e64253adc84b62a01660e7de276ba61711f7421f Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Sun, 20 Mar 2022 18:41:45 +0800 Subject: Improve emacsclient --- bin/ec | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 bin/ec (limited to 'bin/ec') diff --git a/bin/ec b/bin/ec new file mode 100755 index 0000000..96499d3 --- /dev/null +++ b/bin/ec @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# Below is copied from network. I am not quite sure its purpose. Maybe I +# may need it someday. + + +# # Number of current visible frames, +# # Emacs daemon always has a visible frame called F1 +# visible_frames() { +# emacsclient -a "" -e '(length (visible-frame-list))' +# } +# +# change_focus() { +# emacsclient -n -e "(select-frame-set-input-focus (selected-frame))" > /dev/null +# } +# +# # try switching to the frame incase it is just minimized +# # will start a server if not running +# test "$(visible_frames)" -eq "1" && change_focus +# +# if [ "$(visible_frames)" -lt "2" ]; then # need to create a frame +# # -c $@ with no args just opens the scratch buffer +# emacsclient -n -c "$@" && change_focus +# else # there is already a visible frame besides the daemon, so +# change_focus +# # -n $@ errors if there are no args +# test "$#" -ne "0" && emacsclient -n "$@" +# fi + +emacsclient -a "" -n -c "$@" -- cgit v1.2.3