help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Setting up user defined texinfo headlines using outline-heading-alis


From: Christopher Dimech
Subject: Re: Setting up user defined texinfo headlines using outline-heading-alist
Date: Thu, 13 May 2021 20:48:13 +0200

> Sent: Friday, May 14, 2021 at 6:29 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Yuri Khan" <yuri.v.khan@gmail.com>
> Cc: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" 
> <help-gnu-emacs@gnu.org>
> Subject: Re: Setting up user defined texinfo headlines using 
> outline-heading-alist
>
> Hello Yuri,
> 
> Thank you for insightful explanation. 
> 
> * Yuri Khan <yuri.v.khan@gmail.com> [2021-05-13 19:12]:
> >     outline-regexp is a variable defined in ‘outline.el’.
> >     Its value is (regexp-op "[*^L]+"
> 
> Here, not quite sure, but how I see the above regular expression
> it will fold on the new line where there is character ^L, is it?

I can see a number of ^L in texinfo.el
 
> > So let’s change your hook function to set that:
> > 
> >     (defun instate-texinfo-hdlevels ()
> >       (setq-local outline-heading-alist texinfo-hdlevels)
> >       (setq-local outline-regexp
> >                   (concat (regexp-opt (mapcar 'car texinfo-hdlevels)) 
> > "\\>")))
> 
> Interesting, I did not know the `regexp-opt' function, that is
> very handy. It finds the regular expression that will match the
> given list of strings and I find your application smart.
> 
> (regexp-opt '("something" "anything")) ⇒ "\\(?:\\(?:any\\|some\\)thing\\)"
> 
> (regexp-opt '("TODO" "DONE" "DELEGATED")) ⇒ 
> "\\(?:D\\(?:ELEGATED\\|ONE\\)\\|TODO\\)"
> 
> and that may be reused with certainty to work:
> 
> (highlight-regexp "\\(?:D\\(?:ELEGATED\\|ONE\\)\\|TODO\\)")
> 
> 
> -- 
> Jean
> 
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
> 
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
> 
> 
>



reply via email to

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