Skip to content

Instantly share code, notes, and snippets.

@bmag
Created September 20, 2016 08:19
Show Gist options
  • Save bmag/b2119fde2c316cb0c65342253c924527 to your computer and use it in GitHub Desktop.
Save bmag/b2119fde2c316cb0c65342253c924527 to your computer and use it in GitHub Desktop.
Emacs dotfile for loading an Emacs configuration based on EMACSDIR environment variable
;; load configuration from $EMACSDIR/init.el and set $EMACSDIR as
;; `user-emacs-directory'. if $EMACSDIR is not set, use `~/.emacs.d'.
(let* ((emacs-dir-env (getenv "EMACSDIR"))
(custom-emacs-dir (and emacs-dir-env
(file-name-as-directory emacs-dir-env))))
;; `user-emacs-directory' default value is emacs.d"
(when custom-emacs-dir
(setq user-emacs-directory custom-emacs-dir)))
(setq user-init-file (expand-file-name "init.el" user-emacs-directory))
(load user-init-file t)
@echo off
set EMACSDIR=C:/path/to/emacs.d
set SPACEMACSDIR=C:/path/to/spacemacs.d
C:/path/to/emacs/bin/runemacs.exe %*
#!/bin/bash
EMACSDIR=/path/to/emacs.d SPACEMACSDIR=/path/to/spacemacs.d emacs "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment