Instantly share code, notes, and snippets.

Embed
What would you like to do?
Opening multi emacs instances with different settings
@bcfurtado

This comment has been minimized.

Show comment
Hide comment
@bcfurtado

bcfurtado 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
Owner

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

This comment has been minimized.

Show comment
Hide comment
@bcfurtado

bcfurtado 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"
}
Owner

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