From 33561250d4f6d1168a8b3d70c359852e07e31c0e Mon Sep 17 00:00:00 2001 From: Benson Chu Date: Wed, 1 Mar 2023 10:58:45 -0600 Subject: [PATCH] Stop relying on "~/.emacs.d" --- config-ext.org | 6 +++--- config-exwm.org | 2 +- config-min.org | 4 ++-- config-org.org | 12 ++++++------ config-submodules.org | 2 +- legacy/config-programming.org | 4 ++-- lisp/emacs-custom-load-or-ask.el | 3 ++- lisp/libs.el | 3 +++ 8 files changed, 20 insertions(+), 16 deletions(-) diff --git a/config-ext.org b/config-ext.org index deed3a3..8270cca 100644 --- a/config-ext.org +++ b/config-ext.org @@ -272,7 +272,7 @@ (setq epg-gpg-program "gpg2") ;; (setq auth-source-debug t) - (setq auth-sources '((:source "~/.emacs.d/secrets/.authinfo.gpg"))) + (setq auth-sources `((:source ,(ef "secrets/.authinfo.gpg")))) #+end_src ** debbugs #+begin_src emacs-lisp @@ -322,7 +322,7 @@ ))) (defun get-authinfo (host port) - (let* ((netrc (netrc-parse (expand-file-name "~/.emacs.d/secrets/.authinfo.gpg"))) + (let* ((netrc (netrc-parse (ef "secrets/.authinfo.gpg"))) (hostentry (netrc-machine netrc host port))) (when hostentry (netrc-get hostentry "password")))) @@ -440,7 +440,7 @@ #+end_src * auto-save files in same directory #+begin_src emacs-lisp - (setq backup-directory-alist `(("." . "~/.emacs.d/backups/"))) + (setq backup-directory-alist `(("." . ,(ef "backups/")))) (setq make-backup-files t ; backup of a file the first time it is saved. backup-by-copying t ; don't clobber symlinks diff --git a/config-exwm.org b/config-exwm.org index c723485..6120e7f 100644 --- a/config-exwm.org +++ b/config-exwm.org @@ -129,7 +129,7 @@ #+end_src * exwm-background #+begin_src emacs-lisp - (add-to-list 'load-path "~/.emacs.d/submodule/exwm-background/") + (add-to-list 'load-path (ef "submodule/exwm-background/")) (require 'exwm-background) (let ((wm (shell-command-to-string "wmctrl -m"))) diff --git a/config-min.org b/config-min.org index d33be71..7fc39b3 100644 --- a/config-min.org +++ b/config-min.org @@ -47,7 +47,7 @@ (setq beacon-color "#006400") ;; Use my fork of chinese-etzy - (load-file "~/.emacs.d/my-etzy.el") + (load-file (ef "my-etzy.el")) ;; If I ever decide to turn on display-lines-mode, use relative line ;; numbering @@ -1049,7 +1049,7 @@ (modus-themes-load-themes) (load-theme 'modus-operandi nil t) - (add-to-list 'custom-theme-load-path "~/.emacs.d/lisp/themes") + (add-to-list 'custom-theme-load-path (ef "lisp/themes")) (require 'light-default-theme) (load-theme 'light-default nil t) (require 'dark-default-theme) diff --git a/config-org.org b/config-org.org index 4317f7a..03ee895 100644 --- a/config-org.org +++ b/config-org.org @@ -9,7 +9,7 @@ ** fstree #+BEGIN_SRC emacs-lisp (add-to-list 'load-path - "~/.emacs.d/submodule/org-fstree") + (ef "submodule/org-fstree")) (require 'org-fstree) #+END_SRC ** org-bullets @@ -43,7 +43,7 @@ (setq plstore-cache-passphrase-for-symmetric-encryption t) (save-excursion - (let ((filename "~/.emacs.d/google-calendar-secret.el")) + (let ((filename (ef "google-calendar-secret.el"))) (when (file-exists-p filename) (set-buffer (find-file-noselect filename)) (let ((var (eval (read (buffer-string))))) @@ -88,7 +88,7 @@ *** Old ox-reveal package #+BEGIN_SRC (add-to-list 'load-path - "~/.emacs.d/submodule/org-reveal") + (ef "submodule/org-reveal")) (require 'ox-reveal) (setq org-reveal-root "file:///home/benson/.reveal.js") (setq org-structure-template-alist (remove-if (lambda (c) (string= (car c) "n")) org-structure-template-alist)) @@ -192,7 +192,7 @@ (evil-set-initial-state 'org-brain-visualize-mode 'emacs)) :config (setq org-id-track-globally t) - (setq org-id-locations-file "~/.emacs.d/.org-id-locations") + (setq org-id-locations-file (ef ".org-id-locations")) (push '("b" "Brain" plain (function org-brain-goto-end) "* %i%?" :empty-lines 1) org-capture-templates) @@ -218,7 +218,7 @@ #+END_SRC ** org-now #+begin_src emacs-lisp - (add-to-list 'load-path "~/.emacs.d/submodule/org-now") + (add-to-list 'load-path (ef "submodule/org-now")) (require 'org-now) (setq org-now-location nil) @@ -782,7 +782,7 @@ #+end_src * elgantt #+begin_src emacs-lisp - (add-to-list 'load-path "~/.emacs.d/submodule/elgantt") + (add-to-list 'load-path (ef "submodule/elgantt")) (require 'elgantt) #+end_src * org-kanban diff --git a/config-submodules.org b/config-submodules.org index 1fc529a..1c4584b 100644 --- a/config-submodules.org +++ b/config-submodules.org @@ -10,7 +10,7 @@ * Youtube-dl #+BEGIN_SRC emacs-lisp (when (executable-find "youtube-dl") - (add-to-list 'load-path "~/.emacs.d/submodule/youtube-dl-emacs/") + (add-to-list 'load-path (ef "submodule/youtube-dl-emacs/")) (require 'youtube-dl) (defun youtube-dl-song (url) diff --git a/legacy/config-programming.org b/legacy/config-programming.org index 49d897b..4e3da72 100644 --- a/legacy/config-programming.org +++ b/legacy/config-programming.org @@ -201,9 +201,9 @@ (use-package erlang) (add-to-list 'load-path - "~/.emacs.d/submodule/erlang_ls/") + (ef "submodule/erlang_ls/")) - (setq lsp-erlang-server-install-dir "~/.emacs.d/submodule/erlang_ls") + (setq lsp-erlang-server-install-dir (ef "submodule/erlang_ls")) (defun my/erlang-keymap-hook () (local-set-key (kbd "C-c C-c") 'erlang-compile)) diff --git a/lisp/emacs-custom-load-or-ask.el b/lisp/emacs-custom-load-or-ask.el index 7f2faeb..af716d3 100644 --- a/lisp/emacs-custom-load-or-ask.el +++ b/lisp/emacs-custom-load-or-ask.el @@ -25,8 +25,9 @@ ;;; Code: (require 'mmt) (require 'cl) +(require 'libs) -(setq custom-file "~/.emacs.d/customize.el") +(setq custom-file (ef "customize.el")) (load custom-file 'noerror) (defvar ec/my-variables-list '()) diff --git a/lisp/libs.el b/lisp/libs.el index 0e8e3a8..a851bbb 100644 --- a/lisp/libs.el +++ b/lisp/libs.el @@ -18,4 +18,7 @@ ;; Register my own rx forms (require 'my-rx-forms) +(defmacro ef (path) + `(expand-file-name ,path user-emacs-directory)) + (provide 'libs)