[emacs/org] add the org-mode font-lock-keywords only for dark theme
authorAmin Bandali <bandali@gnu.org>
Tue, 25 Dec 2018 18:28:05 +0000 (13:28 -0500)
committerAmin Bandali <bandali@gnu.org>
Tue, 25 Dec 2018 18:28:05 +0000 (13:28 -0500)
init.org

index 058d8ef..800af12 100644 (file)
--- a/init.org
+++ b/init.org
@@ -757,13 +757,6 @@ In short, my favourite way of life.
         org-catch-invisible-edits 'show-and-error
         org-log-done 'time)
   (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t)
-  (font-lock-add-keywords
-   'org-mode
-   '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
-      (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive
-      (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind
-      (4 '(:foreground "#c5c8c6") t))) ; title
-   t)
   :bind (:map org-mode-map ("M-L" . org-insert-last-stored-link))
   :hook ((org-mode . org-indent-mode)
          (org-mode . auto-fill-mode)
@@ -1772,19 +1765,29 @@ Emacs package that displays available keybindings in popup
 ** theme helper functions
 
 #+begin_src emacs-lisp
+(defvar a/org-mode-font-lock-keywords
+  '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
+      (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive
+      (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind
+      (4 '(:foreground "#c5c8c6") t))))                    ; title
+
 (defun a/lights-on ()
   "Enable my favourite light theme."
   (interactive)
   (mapc #'disable-theme custom-enabled-themes)
   (load-theme 'tangomod t)
-  (sml/apply-theme 'automatic))
+  (sml/apply-theme 'automatic)
+  (font-lock-remove-keywords
+   'org-mode a/org-mode-font-lock-keywords))
 
 (defun a/lights-off ()
   "Go dark."
   (interactive)
   (mapc #'disable-theme custom-enabled-themes)
   (load-theme 'doom-tomorrow-night t)
-  (sml/apply-theme 'automatic))
+  (sml/apply-theme 'automatic)
+  (font-lock-add-keywords
+   'org-mode a/org-mode-font-lock-keywords t))
 
 (bind-keys
  ("s-t d" . a/lights-off)