Skip to content

Instantly share code, notes, and snippets.

@fabiofortkamp
Created September 25, 2019 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiofortkamp/acb1d1d8c19c5a5537e90e64e772c815 to your computer and use it in GitHub Desktop.
Save fabiofortkamp/acb1d1d8c19c5a5537e90e64e772c815 to your computer and use it in GitHub Desktop.
# 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\"))"
}
@fabiofortkamp
Copy link
Author

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