commit d632466bf409114e254b5d42610222cf2048a928
parent 2d3ca2534e4e94a2eeae007ac2513e38b5cc6550
Author: Cem Keylan <cem@ckyln.com>
Date: Mon, 4 May 2020 11:11:12 +0300
emacs: remove custom/private files, add local init files
Diffstat:
M | init.org | | | 54 | ++++++++++++++++++++++++++++++++++-------------------- |
1 file changed, 34 insertions(+), 20 deletions(-)
diff --git a/init.org b/init.org
@@ -116,6 +116,25 @@ The most important stuff are (for me) is =use-package= and
disabling the clutter as soon as possible. By clutter, I mean
bars and menus. Also let's disable the splash screen.
+** Loading local files
+Personalized customization can be done through =init-local.el=
+and =init-preload-local.el=. They must be inside your
+=~/.emacs.d/lisp= directory.
+
+Those files must end in the following format.
+
+#+BEGIN_SRC emacs-lisp :tangle no
+ ...
+ (provide 'init-preload-local)
+#+END_SRC
+
+Let's load the =init-preload-local= file if it exists.
+#+BEGIN_SRC emacs-lisp
+ (add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
+
+ (require 'init-preload-local nil t)
+#+END_SRC
+
** Declutter
#+BEGIN_SRC emacs-lisp
@@ -176,30 +195,13 @@ We need use-package for maintaining other packages.
** Custom-file
-I don't like custom variables on my init.el, I prefer having it on
-my cache folder.
-
-#+BEGIN_SRC emacs-lisp
- (setq custom-file "~/.cache/emacs-custom.el")
-#+END_SRC
-
-If the custom variables are not inside ~init.el~, they are not loaded.
+I don't want emacs setting up custom variables without me
+noticing. Let's disable it.
#+BEGIN_SRC emacs-lisp
- (when (file-exists-p custom-file)
- (load custom-file))
+ (setq custom-file "/dev/null")
#+END_SRC
-** Private file
-Let's load a private file if it exists
-#+BEGIN_SRC emacs-lisp
- (add-hook
- 'after-init-hook
- (lambda ()
- (let ((private-file (concat user-emacs-directory "private.el")))
- (when (file-exists-p private-file)
- (load-file private-file)))))
-#+END_SRC
** Starting the server
I used to have an alias for running emacsclient, now I
use a tiny script for it.
@@ -818,6 +820,18 @@ so that I don't have to keep track of it in case I ever change my browser.
browse-url-browser-function 'browse-url-generic
)
#+END_SRC
+** Local init file
+Now that all of this is done, we can load user's personal configuration
+
+#+BEGIN_SRC emacs-lisp
+ (require 'init-local nil t)
+#+END_SRC
+
+** End of the file
+#+BEGIN_SRC emacs-lisp
+ (provide 'init)
+ ;;; init.el ends here
+#+END_SRC
* Notes
** Reverting to package.el
You can always revert back to =package.el= by replacing the [[Package management]]