[Top][All Lists]

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

how to set outline-minor-mode heading levels in outline-regexp

From: Qiang Fang
Subject: how to set outline-minor-mode heading levels in outline-regexp
Date: Sun, 22 Mar 2015 02:14:25 +0000 (UTC)
User-agent: Loom/3.14 (

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\\}\\)?"
    (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

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

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


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

reply via email to

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