Skip to content

Instantly share code, notes, and snippets.

@bcfurtado
Last active July 2, 2018 20:45
Show Gist options
  • Save bcfurtado/fb9b37c81b27ef2bc5c8899de5a66e9c to your computer and use it in GitHub Desktop.
Save bcfurtado/fb9b37c81b27ef2bc5c8899de5a66e9c to your computer and use it in GitHub Desktop.
Opening multi emacs instances with different settings
@bcfurtado
Copy link
Author

bcfurtado commented Jun 24, 2018

ZSH:

openemacs() {
    # this function receives a folder name that's inside of ~/emacs folder
    # it's useful when we want to open multi emacs instances with different settings files
    eval='(setq user-emacs-directory "~/emacs/$1/")'
    eval=${eval/\$1/$1}
    open -a Emacs -n --args -q --eval=$eval  -l ~/emacs/$1/init.el
}
$ openemacs yourfolder

@bcfurtado
Copy link
Author

bcfurtado commented Jun 28, 2018

This works for Bash and ZSH

openemacs() {
    # this function receives a folder name that's inside of ~/emacs folder
    # it's useful when we want to open multi emacs instances with different settings files

    EMACS_USER_FOLDER="$HOME/emacs/$1/"
    EMACS_USER_INIT_FILE="$HOME/emacs/$1/init.el"
    EVAL_EMACS="'(setq user-emacs-directory \"$EMACS_USER_FOLDER\")'"
    eval "open -a Emacs -n --args -q --eval=$EVAL_EMACS  -l $EMACS_USER_INIT_FILE"
}

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