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)))
(font-lock-add-keywords
'org-mode '(;; ...and replace it with my own
("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)" ("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)"
1 'org-headline-done t) 1 'org-headline-done prepend)
("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- ]\\]\\)" ;; make plain list bullets stand out
1 'org-checkbox append)
;; Also highlight list bullets
("^ *\\([-+]\\|[0-9]+[).]\\) " 1 'org-list-dt append) ("^ *\\([-+]\\|[0-9]+[).]\\) " 1 'org-list-dt append)
;; and separators ;; and separators/dividers
("^ *\\(-----+\\)$" 1 'org-meta-line))) ("^ *\\(-----+\\)$" 1 'org-meta-line)
;; custom #hashtags & @at-tags for another level of organization
("\\s-\\(#[^ \n]+\\)" 1 'org-tag)
("\\s-\\(@[^ \n]+\\)" 1 'org-special-keyword))))
;; Enable gpg support ;; Enable gpg support
(require 'epa-file) (require 'epa-file)