emacs-humanities
[Top][All Lists]
Advanced

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

Re: [emacs-humanities] highlighting parts of the org file


From: l@tlo
Subject: Re: [emacs-humanities] highlighting parts of the org file
Date: Tue, 13 Jun 2023 09:47:47 +0900

Edgar,

Thank you for the proposition.

> On Jun 13, 2023, at 8:49, Edgar Vincent <e-v@posteo.net> wrote:
> 
> "l@tlo" <lists@traduction-libre.org> writes:
> 
>>> On Jun 12, 2023, at 4:17, Marcin Borkowski <mbork@mbork.pl> wrote:
>>> 
>>> 
>>> On 2023-06-10, at 04:30, l@tlo <lists@traduction-libre.org> wrote:
>>> 
>>>> I my org document, I add stuff like:
>>>> 
>>>> @référence
>>>> 
>>>> → to remind myself that I need to add a proper reference to what I wrote
>>>> 
>>>> or
>>>> 
>>>> @(ne pas oublier ce machin)
>>>> 
>>>> → Not to forget to add something about that "machin".
>>>> 
>>>> And I'd like to have that highlighted in my org file, like headers are, 
>>>> for ex.
>>>> 
>>>> How do I do that?
>>> 
>>> Try M-s h C-h and see if anything there is useful for you.
>> 
>> Interesting. Thank you. But it's not "permanent" marks, is it ?
> 
> 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?

-- 
Jean-Christophe Helary @jchelary@emacs.ch
https://traductaire-libre.org
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/




reply via email to

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