Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# function to close the buffer corresponding to a given file in emacs
# cf = close file
function cf() {
emacs -e "(if (get-buffer \"$1\") (kill-buffer \"$1\"))"

This comment has been minimized.

Copy link
Owner Author

@fabiofortkamp fabiofortkamp commented Nov 1, 2019

For some reason, this does not work when invoked as part of a prm stop script.

The emacs command is aliased to emacsclient -n. When the cf function is invoked inside prm, the Emacs client seems to not find an existing server, and opens up a new frame and fires up a new server --- but the buffer I want to close is naturally opened in an existing frame of a client attached to an existing server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment