[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [emacs-humanities] highlighting parts of the org file
From: |
Edgar Vincent |
Subject: |
Re: [emacs-humanities] highlighting parts of the org file |
Date: |
Tue, 13 Jun 2023 06:20:23 +0000 |
"l@tlo" <lists@traduction-libre.org> writes:
> Edgar,
>
> Thank you for the proposition.
>
[…]
>> Hi Jean-Christophe,
>>
>> Perhaps you could try something like this to make the highlighting permanent?
>>
>> ┌────
>> │ ;; Alist of the form '((REGEXP . FACE) …)
>> │ (setq ev/hi-lock-permanent-keywords
>> │ '(("@(.+)" . hi-red-b)))
>> │
>> │ (defun ev/hi-lock-permanent-highlight ()
>> │ (hi-lock-mode 1)
>> │ (mapc (lambda (r)
>> │ (highlight-regexp (car r) (cdr r)))
>> │ ev/hi-lock-permanent-keywords))
>> │
>> │ (add-hook 'org-mode-hook 'ev/hi-lock-permanent-highlight)
>> └────
>
>
> What is the difference with:
>
> ;; ajouter une colorisation pour mes notes @ dans le texte
> (setq font-lock-keyword-org-extra-comments
> '(("(@[^)]*)\\|@([^)]+)\\|@[^\s\n\r]+"
> (0
> '(:background "light yellow"
> :foreground "red")
> prepend))))
>
> ;; Add this after having required org-mode
> (font-lock-add-keywords 'org-mode
> font-lock-keyword-org-extra-comments
> t)
>
> (require 'org)
>
>
> in terms of mechanism
>
> My understanding is that I'm calling the function when I enter org-mode, with
> the hook, so it simulates the permanency by calling the function on file
> opening, correct?
Sorry, I'd missed that snippet that you mentioned earlier. Your
understanding is correct and your snippet is probably cleaner
(although both probably work similarly under the bonnet).
- [emacs-humanities] highlighting parts of the org file, l@tlo, 2023/06/09
- Re: [emacs-humanities] highlighting parts of the org file, Ihor Radchenko, 2023/06/10
- Re: [emacs-humanities] highlighting parts of the org file, Marcin Borkowski, 2023/06/11
- Re: [emacs-humanities] highlighting parts of the org file, l@tlo, 2023/06/11
- Re: [emacs-humanities] highlighting parts of the org file, Marcin Borkowski, 2023/06/12
- Re: [emacs-humanities] highlighting parts of the org file, Edgar Vincent, 2023/06/12
- Re: [emacs-humanities] highlighting parts of the org file, l@tlo, 2023/06/12
- Re: [emacs-humanities] highlighting parts of the org file,
Edgar Vincent <=
- Re: [emacs-humanities] highlighting parts of the org file, l@tlo, 2023/06/13
- Re: [emacs-humanities] highlighting parts of the org file, Edgar Vincent, 2023/06/13
- Re: [emacs-humanities] highlighting parts of the org file, l@tlo, 2023/06/16
- Re: [emacs-humanities] highlighting parts of the org file, Ihor Radchenko, 2023/06/17
- Re: [emacs-humanities] highlighting parts of the org file, l@tlo, 2023/06/17
- Re: [emacs-humanities] highlighting parts of the org file, Ihor Radchenko, 2023/06/18