lang/org: refactor fontification (use org-font-lock-set-keywords-hook)

This commit is contained in:
Henrik Lissner 2017-05-10 18:39:28 +02:00
parent 3f5f6752a2
commit 7b7c9fdf81

View file

@ -186,21 +186,19 @@
(,(concat "<\\(http://.+\\." ext-regexp "\\)>") . 1)))) (,(concat "<\\(http://.+\\." ext-regexp "\\)>") . 1))))
;;; Custom fontification ;;; Custom fontification
;; I like how org-mode fontifies checked TODOs and want this to extend to (add-hook! 'org-font-lock-set-keywords-hook
;; checked checkbox items, so we remove the old checkbox highlight rule... (nconc org-font-lock-extra-keywords
(font-lock-remove-keywords '(;; I like how org-mode fontifies checked TODOs and want this to extend to
'org-mode '(("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- X]\\]\\)" ;; checked checkbox items:
1 'org-checkbox prepend))) ("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)"
(font-lock-add-keywords 1 'org-headline-done prepend)
'org-mode '(;; ...and replace it with my own ;; make plain list bullets stand out
("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)" ("^ *\\([-+]\\|[0-9]+[).]\\) " 1 'org-list-dt append)
1 'org-headline-done t) ;; and separators/dividers
("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- ]\\]\\)" ("^ *\\(-----+\\)$" 1 'org-meta-line)
1 'org-checkbox append) ;; custom #hashtags & @at-tags for another level of organization
;; Also highlight list bullets ("\\s-\\(#[^ \n]+\\)" 1 'org-tag)
("^ *\\([-+]\\|[0-9]+[).]\\) " 1 'org-list-dt append) ("\\s-\\(@[^ \n]+\\)" 1 'org-special-keyword))))
;; and separators
("^ *\\(-----+\\)$" 1 'org-meta-line)))
;; Enable gpg support ;; Enable gpg support
(require 'epa-file) (require 'epa-file)