From 6fe2028a1264a79330f16b1dbd6da8f59dc6854f Mon Sep 17 00:00:00 2001 From: Dariusz Luksza Date: Sun, 25 Jan 2015 13:29:42 +0100 Subject: Fix emacs client terminal Fixes #3305 Signed-off-by: Dariusz Luksza --- plugins/emacs/emacs.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/emacs') diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index c102a5a1e..929aa0616 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -16,7 +16,7 @@ if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then # set EDITOR if not already defined. export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}" - alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait" + alias emacs="$EMACS_PLUGIN_LAUNCHER -t" alias e=emacs # open terminal emacsclient alias te="$EMACS_PLUGIN_LAUNCHER -nw" -- cgit v1.2.3-70-g09d2 From ee96d0cf9634f25abb69a5cec68073a015dab0a5 Mon Sep 17 00:00:00 2001 From: Lorenzo Bolla Date: Mon, 21 May 2018 00:01:55 +0100 Subject: Fix 6840 Check emacsclient version instead of emacs's (#6841) This is much faster. --- plugins/emacs/emacs.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/emacs') diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index c102a5a1e..db0ab13af 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -10,7 +10,7 @@ # - Configuration changes made at runtime are applied to all frames. -if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then +if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh" # set EDITOR if not already defined. -- cgit v1.2.3-70-g09d2 From e09eb23158c7c75b84b7dafb514dcfa86bd06dc3 Mon Sep 17 00:00:00 2001 From: Martin Nestorov Date: Fri, 5 Oct 2018 21:43:04 +0300 Subject: emacs: add README (#7235) --- plugins/emacs/README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 plugins/emacs/README.md (limited to 'plugins/emacs') diff --git a/plugins/emacs/README.md b/plugins/emacs/README.md new file mode 100644 index 000000000..c8e33b5ab --- /dev/null +++ b/plugins/emacs/README.md @@ -0,0 +1,30 @@ +# Emacs plugin + +This plugin utilizes the Emacs daemon capability, allowing the user to quickly open frames, whether they are opened in a terminal via a ssh connection, or X frames opened on the same host. The plugin also provides some aliases for such operations. + +- You don't have the cost of starting Emacs all the time anymore +- Opening a file is as fast as Emacs does not have anything else to do. +- You can share opened buffered across opened frames. +- Configuration changes made at runtime are applied to all frames. + +**NOTE:** requires Emacs 24 and newer. + +To use it, add emacs to the plugins array in your zshrc file: + +```zsh +plugins=(... emacs) +``` + +## Aliases + +The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that is just a wrapper around [`emacsclient`](https://www.emacswiki.org/emacs/EmacsClient). + +| Alias | Command | Description | +|--------|----------------------------------------------------|----------------------------------------------------------------| +| emacs | `$EMACS_LAUNCHER --no-wait` | Opens a temporary emacsclient frame | +| e | `emacs` | Same as emacs alias | +| te | `$EMACS_LAUNCHER -nw` | Open terminal emacsclient | +| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs | +| eframe | `emacsclient --alternate-editor "" --create-frame` | Create new X frame | +| efile | - | Print the path to the file open in the current buffer | +| ecd | - | Print the directory of the file open in the the current buffer | -- cgit v1.2.3-70-g09d2 From 25d0a10cda82edfa6cf5e1611e018a714ecbfb3e Mon Sep 17 00:00:00 2001 From: akinnane Date: Mon, 25 Feb 2019 13:37:41 +0000 Subject: Revert "Fix emacs client terminal" (#7597) Reverts robbyrussell/oh-my-zsh#5714 --- plugins/emacs/emacs.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/emacs') diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index 934c8d673..db0ab13af 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -16,7 +16,7 @@ if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then # set EDITOR if not already defined. export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}" - alias emacs="$EMACS_PLUGIN_LAUNCHER -t" + alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait" alias e=emacs # open terminal emacsclient alias te="$EMACS_PLUGIN_LAUNCHER -nw" -- cgit v1.2.3-70-g09d2 From cab1ac6e682038b2ceca9d16f8c458c0e79149ca Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 9 Apr 2019 19:01:10 +0200 Subject: emacs: use open frame if there is one present Fixes #5779 Fixes #5405 --- plugins/emacs/emacsclient.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/emacs') diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index 26b28d495..b4f49e12b 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -5,7 +5,7 @@ _emacsfun() # get list of emacs frames. frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'` - if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then + if [ "$(echo "$frameslist" | sed -n '$=')" -ge 1 ] ;then # prevent creating another X frame if there is at least one present. emacsclient --alternate-editor "" "$@" else -- cgit v1.2.3-70-g09d2 From 08da19e3fd27acf5085e207ee7da411e6a5eb96a Mon Sep 17 00:00:00 2001 From: akinnane Date: Sun, 14 Apr 2019 11:31:52 +0100 Subject: emacs: revert cab1ac6e682038b2ceca9d16f8c458c0e79149ca (#7765) Revert cab1ac6e682038b2ceca9d16f8c458c0e79149ca The change from the above commit breaks opening a new emacs frame if there isn't a existing frame open. When emacs is running in daemon mode, there will always be a frame associated with the daemon, even if there are no visible frames. The lisp function `frame-list`, will always return 1 frame. ``` emacsclient --eval '(frame-list)' (#) ``` When an real frame is open, two frames are reported by the `frame-list` function. ``` emacsclient --eval '(frame-list)' (# #) ``` See: https://emacs.stackexchange.com/questions/44537/extra-frame-in-visible-frame-list-when-started-in-daemon-mode-is-causing-prob https://emacs.stackexchange.com/questions/18859/dont-let-the-daemon-frame-make-a-file-visible --- plugins/emacs/emacsclient.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/emacs') diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index b4f49e12b..26b28d495 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -5,7 +5,7 @@ _emacsfun() # get list of emacs frames. frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'` - if [ "$(echo "$frameslist" | sed -n '$=')" -ge 1 ] ;then + if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then # prevent creating another X frame if there is at least one present. emacsclient --alternate-editor "" "$@" else -- cgit v1.2.3-70-g09d2