org: Introduce semantic seperator fontification

* lisp/org.el (org-fontify-semantic-seperator,
org-set-font-lock-defaults): TODO
This commit is contained in:
TEC 2022-07-27 23:09:38 +08:00
parent 2fde128b19
commit 4f0592b21b
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 21 additions and 0 deletions

View File

@ -5770,6 +5770,10 @@ needs to be inserted at a specific position in the font-lock sequence.")
;; Emphasis
;; `org-do-emphasis-faces' prepends faces
(when org-fontify-emphasized-text '(org-do-emphasis-faces))
;; Semantic seperator
(when org-fontify-semantic-seperator
`("\u200b"
(0 '(face shadow display ,org-semantic-seperator-displayed))))
;; Checkboxes
`(,org-list-full-item-re 3 'org-checkbox prepend lax)
(when (cdr (assq 'checkbox org-list-automatic-rules))
@ -5899,6 +5903,23 @@ needs to be inserted at a specific position in the font-lock sequence.")
(throw 'match t))))
nil))))
(defcustom org-fontify-semantic-seperator t
"Whether to prettify the semantic seperator.
When non-nil, `org-semantic-seperator-displayed' will be displayed in place of the semantic seperator."
:type 'boolean)
(defcustom org-semantic-seperator-displayed
#("" 0 1 (display ((raise -0.3) (height 0.3))))
"String that should be displayed in place of the semantic seperator.
This is only relevant when `org-fontify-semantic-seperator' is non-nil."
:type 'string)
(defun org-toggle-semantic-seperator-display ()
"Toggle display of the semantic seperator."
(interactive)
(cl-callf not org-fontify-semantic-seperator)
(user-error "TODO make this work better"))
(defun org-fontify-like-in-org-mode (s &optional odd-levels)
"Fontify string S like in Org mode."
(with-temp-buffer