1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 05:40:08 +00:00
ohmyzsh/plugins/emacs
Marc Cornellà 2acae3797b fix(emacs): assess if there are open frames of the expected type
This change looks at the frame type of the open frames ('framep) and
looks if they're of the type requested based on the arguments passed
to emacsclient (-nw/-t/--tty require tty frames, otherwise we need
graphical frames).

NOTE: this code considers anything different than t as graphical
terminals, including MS-DOS types (pc). I don't have such a setup
to test if this is correct.
2021-09-29 16:50:12 +02:00
..
emacs.plugin.zsh refactor(emacs): remove dependency on require_tool.sh and clean up code style 2021-09-29 16:50:12 +02:00
emacsclient.sh fix(emacs): assess if there are open frames of the expected type 2021-09-29 16:50:12 +02:00
README.md emacs: add README (#7235) 2018-10-05 20:43:04 +02:00

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:

plugins=(... emacs)

Aliases

The plugin uses a custom launcher (which we'll call here $EMACS_LAUNCHER) that is just a wrapper around 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