emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug] 'org-font-lock-extra-keywords' appear next to the parent headi


From: Philipp Kiefer
Subject: Re: [Bug] 'org-font-lock-extra-keywords' appear next to the parent heading when its subtree is folded.
Date: Tue, 24 Jan 2023 15:13:17 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1


On 24.01.2023 04:52, Ruijie Yu wrote:
Philipp Kiefer <phil.kiefer@gmail.com> writes:

Org mode version 9.6.1, GNU Emacs 27.2 (build 1, x86_64-w64-mingw32)

Please see the two screenshots here for illustration:

https://imgur.com/a/7EuUi0J

(I'm assuming it's not a good idea - or not even possible - to send e-mail 
attachments to the list?)

This is the relevant code from my init.el that seems to be causing this issue:

(require 'org-habit nil t) ; relevant?
(defun org-add-my-extra-fonts ()
   "Add alert and overdue fonts."
   (add-to-list 'org-font-lock-extra-keywords 
'("\\(³\\)\\([^\n\r\t]+\\)\\(³\\)" (1 '(face org-habit-alert-face invisible 
nil)) (2 'org-habit-alert-face t) (3 '(face
org-habit-alert-face invisible nil))) t)
   (add-to-list 'org-font-lock-extra-keywords 
'("\\(§\\)\\([^\n\r\t]+\\)\\(§\\)" (1 '(face org-habit-overdue-face invisible 
nil)) (2 'org-habit-overdue-face t) (3
'(face org-habit-overdue-face invisible nil))) t)
   (add-to-list 'org-font-lock-extra-keywords 
'("\\(@\\)\\([^\n\r\t]+\\)\\(@\\)" (1 '(face org-habit-clear-face invisible 
nil)) (2 'org-habit-clear-face t) (3 '(face
org-habit-clear-face invisible nil))) t))
(add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-fonts)

Can you reproduce it?

Thanks!
I am in a region where imgur is unavailable -- can you attach a minimal
org file where the issue manifests, and briefly describe what happens
and should happen?
Sorry, will attach such an org file in my reply to Ihor later.
Also, while looking into your init code, I noticed that
`org-font-lock-extra-keywords' seems to be public-facing (as there is no
double-dashes in the name), but has no docstring.  Either this variable
was intended to be private, or someone forgot to put a docstring to this
variable.

Thanks for making me realize that much of what is in my init.el is miles from 'best practice'. At the time I cobbled it together, I was just happy when things eventually worked the way I wanted them to and did not bother overmuch with proper procedure. No surprise then that it is coming back to bite me.

Will put in a 'defvar' statement with a docstring and rename all my private functions from 'org-xxx' to 'org--xxx'.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]