Browse Source

Store ~/.emacs.d into a variable

master
Riyyi 5 years ago
parent
commit
2568fd47a6
  1. 6
      .emacs.d/config.org
  2. 10
      .emacs.d/init.el

6
.emacs.d/config.org

@ -25,7 +25,7 @@ M-x =all-the-icons-install-fonts=
Store custom-file separately, don't freak out when it's not found. Store custom-file separately, don't freak out when it's not found.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq custom-file "~/.emacs.d/custom.el") (setq custom-file (concat emacs-d "/custom.el"))
(load custom-file 'noerror) (load custom-file 'noerror)
#+END_SRC #+END_SRC
@ -616,12 +616,12 @@ Functions that only use built-in Emacs functionality.
(defun config-visit () (defun config-visit ()
"Config edit." "Config edit."
(interactive) (interactive)
(find-file "~/.emacs.d/config.org")) (find-file (concat emacs-d "/config.org")))
(defun config-reload () (defun config-reload ()
"Config reload." "Config reload."
(interactive) (interactive)
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org"))) (org-babel-load-file (concat emacs-d "/config.org")))
(defun display-startup-echo-area-message () (defun display-startup-echo-area-message ()
"Hide default startup message." "Hide default startup message."

10
.emacs.d/init.el

@ -2,7 +2,7 @@
;;; Commentary: ;;; Commentary:
;; Setup package manager and build configuration org file. ;; Setup package manager and build configuration file.
;;; Code: ;;; Code:
@ -15,7 +15,9 @@
; -------------------------------------- ; --------------------------------------
(defvar emacs-cache (concat (getenv "XDG_CACHE_HOME") "/emacs") (defvar emacs-cache (concat (getenv "XDG_CACHE_HOME") "/emacs")
"Directory where cache data is stored.") "Directory where Emacs cache data is stored.")
(defvar emacs-d (concat (getenv "HOME") "/.emacs.d")
"Additional per-user Emacs-specific files.")
; -------------------------------------- ; --------------------------------------
@ -35,7 +37,7 @@
;; Tangle configuration file ;; Tangle configuration file
(require 'org) (require 'org)
(when (file-readable-p (expand-file-name "config.org" user-emacs-directory)) (when (file-readable-p (concat emacs-d "/config.org"))
(org-babel-load-file (expand-file-name "config.org" user-emacs-directory))) (org-babel-load-file (concat emacs-d "/config.org")))
;;; init.el ends here ;;; init.el ends here

Loading…
Cancel
Save