Last active
January 13, 2021 23:26
-
-
Save kaz-yos/0c7bc69d3df6a9199b4db715b9455a30 to your computer and use it in GitHub Desktop.
.emacs file to run Spacemacs and regular Emacs side by side.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; dot_emacs.el --- -*- lexical-binding: t; -*- | |
;;; Select emacs config file directory depending on emacs being run | |
;; Added by Package.el. This must come before configurations of | |
;; installed packages. Don't delete this line. If you don't want it, | |
;; just comment it out by adding a semicolon to the start of the line. | |
;; You may delete these explanatory comments. | |
;; (package-initialize) | |
;; Ref: http://emacs.stackexchange.com/questions/19936/running-spacemacs-alongside-regular-emacs-how-to-keep-a-separate-emacs-d | |
;;; Check the current executable file and assign the appropriate user directory. | |
;; The unless is to avoid executing this script twice. | |
(unless (boundp 'dot-emacs-loaded) | |
(let ((emacs-exec-path (expand-file-name | |
;; The program name that was used to run Emacs. | |
invocation-name | |
;; The directory in which the Emacs executable was found, to run it. | |
invocation-directory))) | |
;; | |
;; Check if executable path contains spacemacs | |
;; Duplicate Emacs.app and rename it to Spacemacs.app | |
(when (string-match ".*spacemacs*" (downcase emacs-exec-path)) | |
;; If so, change user-emacs-directory to spacemacs one | |
;; Directory beneath which additional per-user Emacs-specific files are placed. | |
;; | |
;; Clone spacemacs configurations into ~/.spacemacs.d. | |
;; An empty ~/.spacemacs file is also necessary. | |
;; As of 2016-12-25, only the develop branch is compatible. | |
(setq user-emacs-directory "~/.spacemacs.d/")) | |
;; | |
;; Load init.el under user directory. | |
(load (expand-file-name "init.el" user-emacs-directory)) | |
;; Create a variable to indicate this script has been run. | |
(defvar dot-emacs-loaded t))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this! Seems to work with current spacemacs. So in summary:
Download this file to
~/.emacs
(if you already have a~/.emacs
, move it to.emacs.d/init.el
then:
Then you can run
spacemacs
. Sweet. This may get me to seriously transfer my old config to spacemacs and join the party.