Re: outline-minor-mode and comment syntax
Jean Louis <[email protected]> Sun, 05 Jul 2026 10:00:30 +0300
| Newsgroups | gmane.emacs.help |
|---|---|
| Organization | GNU Support |
| Message-ID | <[email protected]> |
On 2026-07-05 02:31, Heime wrote:
> Is outline-minor-mode specific to programming-like languages
> that start with comment characters? Is it applicable to any
> kind of major mode or invented mode?
It is similar as outline mode just that it is used as minor mode to
other modes.
You can use it in any major mode.
You would need to figure out how to set variables: outline-regexp and
outline-heading-end-regexp and outline-heading-alist
And such function could be automatically invoked. See description for
outline-heading-alist
Untested example:
(defun my-python-outline-setup ()
(setq-local outline-regexp
"^\\s-*\\(def\\|class\\)\\s-+")
(setq-local outline-level
(lambda ()
(1+ (/ (current-indentation) 2))))
(setq-local outline-heading-end-regexp ":\n")
(outline-minor-mode 1))
;; Add to python-mode-hook
(add-hook 'python-mode-hook #'my-python-outline-setup)
--
Jean Louis