From 8111456cf9b0e640a7c86a5352b48245c47e9a97 Mon Sep 17 00:00:00 2001 From: not manx Date: Sat, 2 May 2020 05:04:00 +0000 Subject: [PATCH] add checks for config files and load email from .emacs --- config.el | 9 +++++---- config.org | 4 ---- init.el | 20 ++++++++++++-------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/config.el b/config.el index d53f261..471535d 100644 --- a/config.el +++ b/config.el @@ -27,6 +27,9 @@ ;; I read somewhere that Company breaks things? (add-hook 'org-mode-hook 'company-mode) +;; Don't indent whole file with org-mode +(eval-after-load "org-mode" (local-set-key (kbd "s-i") nil)) + (setq org-structure-template-alist (append '(("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC") @@ -57,7 +60,7 @@ (add-hook 'org-mode-hook (local-keybind "C-c C-l" manx/org-insert-link)) -(tool-bar-mode -1) +1(tool-bar-mode -1) (menu-bar-mode -1) (scroll-bar-mode -1) (line-number-mode 1) @@ -302,7 +305,7 @@ the checking happens for all pairs in auto-minor-mode-alist" (funcall (cdar alist) 1)) (setq alist (cdr alist)))))) -(add-hook 'find-file-hook #'enable-minor-mode-based-on-extension) +(add-hook 'find-file-hook#'enable-minor-mode-based-on-extension) (define-minor-mode sensitive-minor-mode "For sensitive files like password lists. @@ -334,5 +337,3 @@ Null prefix argument turns off the mode." (lambda () (push '("lambdainteractive" . ?Λ) prettify-symbols-alist))) - -(load "~/.emacs.d/email.el") diff --git a/config.org b/config.org index 40901cd..5df3938 100644 --- a/config.org +++ b/config.org @@ -448,7 +448,3 @@ For example, used with sensitive-mode to not create backups (push '("lambdainteractive" . ?Λ) prettify-symbols-alist))) #+END_SRC -* Email -#+BEGIN_SRC emacs-lisp - (load "~/.emacs.d/email.el") -#+END_SRC diff --git a/init.el b/init.el index a3703d4..06cc54b 100644 --- a/init.el +++ b/init.el @@ -15,19 +15,23 @@ (package-install 'spacemacs-theme)) (defun in-emacs-home (file) + "Checks if a file exists in your emacs home" (when (stringp file) (let ((file (concat user-emacs-directory file))) (when (file-exists-p file) file)))) +;; Files we care about loading (setq custom-file (in-emacs-home "custom.el")) (defconst emacs-config (in-emacs-home "config.el")) (defconst emacs-org (in-emacs-home "config.org")) - -;; org-babel won't compile these sometimes? -(load emacs-config) -(load custom-file 'noerrror) - -(when (file-newer-than-file-p emacs-org emacs-config) - (org-babel-load-file emacs-org)) - +(defconst emacs-email (in-emacs-home "email.el")) + +;; If everything exists then execute files +(when (mapcar (lambda (x) (not (null x))) + (list custom-file emacs-config emacs-org emacs-email)) + (if (file-newer-than-file-p emacs-org emacs-config) + (org-babel-load-file emacs-org) + (load emacs-config)) + (load custom-file 'noerrror) + (load emacs-email 'noerror))