unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to set outline-minor-mode heading levels in outline-regexp
@ 2015-03-22  2:14 Qiang Fang
  2015-03-24  6:57 ` Michael Heerdegen
  0 siblings, 1 reply; 2+ messages in thread
From: Qiang Fang @ 2015-03-22  2:14 UTC (permalink / raw)
  To: help-gnu-emacs

I am trying to add a custom heading to program mode, and I want it to be on
the highest level and move all other levels down, so I can add more
structure to my long script. For example, for python mode, the heading
format is  "# *", the number of star determines its level.
My approach is to modify the outline-regexp variable by add a hook like this.

    (defun my_heading()
    "custom heading for all prog mode"
    (setq outline-regexp (concat "\\(?:" comment-start " [*]\\{1,8\\}\\)?"
outline-regexp)))
    (add-hook 'outline-minor-mode-hook 'my_heading)

Ideally, the smaller the match, the higher the level of the heading. But the
above doesn't work. If I replace it with the following one, it doesn't work
either.

    (setq outline-regexp (concat comment-start " [*]\\{1,8\\}\\|"
outline-regexp)))

The value of the original outline-regexp for python mode is 

"[[:space:]]*\\_<\\(?:\\(?:class\\|def\\|e\\(?:l\\(?:if\\|se\\)\\|xcept\\)\\|f\\
(?:inally\\|or\\)\\|if\\|try\\|w\\(?:hile\\|ith\\)\\)\\)\\_>"

Can anyone please tell me how can I achieve my goal?
Thank you in advance.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-24  6:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-22  2:14 how to set outline-minor-mode heading levels in outline-regexp Qiang Fang
2015-03-24  6:57 ` Michael Heerdegen

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