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: Sun, 11 Jun 2023 08:39:35 +0900

On a French emacs list I was proposed this solution:

---
;; 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)
---

I indeed thought there was to be a way to highlight a regex match in emacs.

I remember wondering how to add TODOs in non header situations and the 
solutions proposed were really not satisfying.

Here, I can just write something I need to check later in the flow of the 
sentence and highlighting it is perfect to get back to it later.

It seems to me that org-mode should have such a simple mechanism to add items 
in the document flow.

Jean-Christophe 

> On Jun 10, 2023, at 19:20, Ihor Radchenko <yantar92@posteo.net> wrote:
> 
> "l@tlo" <lists@traduction-libre.org> writes:
> 
>> 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
>> ...
>> And I'd like to have that highlighted in my org file, like headers are, for 
>> ex.
>> 
>> How do I do that?
> 
> You can try sparse tree (C-c / r). For example, we have a very similar
> example in Org manual (but for FIXME indicating personal notes):
> 
> 2.5 Sparse Trees
> 
>       For frequently used sparse trees of specific search strings, you can
>    use the variable ‘org-agenda-custom-commands’ to define fast keyboard
>    access to specific sparse trees.  These commands will then be accessible
>    through the agenda dispatcher (see *note Agenda Dispatcher::).  For
>    example:
> 
>         (setq org-agenda-custom-commands
>               '(("f" occur-tree "FIXME")))
> 
>    defines the key ‘f’ as a shortcut for creating a sparse tree matching
>    the string ‘FIXME’.
> 
> Alternatively, you can do M-x highlight-regexp
> Or you can add font-lock-keyword to make Emacs highlight things for you
> (15.13.1 Traditional Font Lock section of Emacs manual)
> Or you can use inline tasks to indicate things to be done later.
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>

-- 
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]