all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Qiang Fang <godblessfq@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: how to set outline-minor-mode heading levels in outline-regexp
Date: Sun, 22 Mar 2015 02:14:25 +0000 (UTC)	[thread overview]
Message-ID: <loom.20150322T030958-443@post.gmane.org> (raw)

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.




             reply	other threads:[~2015-03-22  2:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-22  2:14 Qiang Fang [this message]
2015-03-24  6:57 ` how to set outline-minor-mode heading levels in outline-regexp Michael Heerdegen

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

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

  git send-email \
    --in-reply-to=loom.20150322T030958-443@post.gmane.org \
    --to=godblessfq@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.