unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: Christopher Dimech <dimech@gmx.com>
Cc: monnier@iro.umontreal.ca, help-gnu-emacs@gnu.org
Subject: Re: Allowing spaces in the regexp for outlines
Date: Wed, 27 Mar 2024 19:32:05 +0000	[thread overview]
Message-ID: <2nkwtf3AM69gCtEv8mDuN9EKXJMrlei8t0RP0g-5D4GudFBVe407_MzhaQw6EHAOTQERe7T979LwWYTt7rHNM7UlZZsMCkX_ejRvhbdVjHY=@protonmail.com> (raw)
In-Reply-To: <trinity-e4b5e1a0-8830-4b07-a17a-45ed4ce28a2d-1711566764523@3c-app-mailcom-bs13>

On Thursday, March 28th, 2024 at 7:12 AM, Christopher Dimech <dimech@gmx.com> wrote:

> > Sent: Thursday, March 21, 2024 at 4:32 PM
> > From: "Stefan Monnier via Users list for the GNU Emacs text editor" help-gnu-emacs@gnu.org
> > To: help-gnu-emacs@gnu.org
> > Subject: Re: Allowing spaces in the regexp for outlines
> > 
> > > Have made a regexp for outlines to use ';;;' followed by 'H' and a number.
> > > 
> > > I would like to allow any number of spaces between the ';;;' and the letter 'H'.
> > > How can I change the regexp to allow such a capability ?
> > 
> > Why?
> 
> 
> There is already the functionality for changing the font-lock for outline-minor-mode.
> So why not ! It is not so easy to do though. Because managing outlines in a buffer
> is valuable for almost everybody, it would help for there to me clear explanation
> of what has to be done with actual examples. Good for this would be in the Introduction
> to Emacs Lisp Programming.

That would help a lot. How can one set general patterns for each outline level precisely ?

Is the way to do it like this

(defvar el-hglevels '( (";;; H1" . 1) (";;; H2" . 2) (";;; H3" . 3) ))
 
(setq outline-regexp (concat (regexp-opt (mapcar 'car el-hglevels)) "\\>"))
(setq outline-heading-alist el-hglevels)
(setq-local outline-level 'outline-level)

> > ELisp already has a set convention for outlining, where `;;;` is
> > a top-level heading, then `;;;;` is a subheading, `;;;;;` is
> > a subsubheading, etc...
> > 
> > Stefan



      reply	other threads:[~2024-03-27 19:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 19:24 Allowing spaces in the regexp for outlines Heime
2024-03-20 19:45 ` Emanuel Berg
2024-03-21  4:44   ` Heime
2024-03-21  4:59     ` Emanuel Berg
2024-03-21  5:08   ` Heime
2024-03-21  6:40     ` Heime
2024-03-21 19:52       ` Emanuel Berg
2024-03-21  4:32 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-03-21  4:49   ` Emanuel Berg
2024-03-22 12:56     ` Arash Esbati
2024-03-22 15:39       ` Heime
2024-03-27 19:12   ` Christopher Dimech
2024-03-27 19:32     ` Heime [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='2nkwtf3AM69gCtEv8mDuN9EKXJMrlei8t0RP0g-5D4GudFBVe407_MzhaQw6EHAOTQERe7T979LwWYTt7rHNM7UlZZsMCkX_ejRvhbdVjHY=@protonmail.com' \
    --to=heimeborgia@protonmail.com \
    --cc=dimech@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).