Skip to content

Instantly share code, notes, and snippets.

@sylt
Last active March 23, 2024 17:51
Show Gist options
  • Save sylt/4598af06448c4493c898762496bd061b to your computer and use it in GitHub Desktop.
Save sylt/4598af06448c4493c898762496bd061b to your computer and use it in GitHub Desktop.
Single bash alias/function for handling emacsclient
# Put this in your ~/.bash_aliases script file
# This function/alias behaves how I wished 'emacsclient -a '' -r -n' would have behaved:
# * Starts an emacs server/window if there is none. Any supplied file(s) are opened in the new window.
# * Otherwise, the supplied file(s) are opened in the already existing emacs window.
function e() {
emacsclient -q -a "sh -c \"emacs -e server-start $@ &\"" --no-wait $@
}
# Example usage: e README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment