outline-minor-mode: customizing outline-regexp?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

outline-minor-mode: customizing outline-regexp?

John Ankarström
Hello all!

I use outline-minor-mode in combination with the package outshine, but I'm
having a problem with the `outline-regexp' variable.

The way I understand it, it's supposed to control the regexp for the
outline headings. I want to change the regexp for css-mode, but no matter
what I set it to, it appears to use the old syntax for headings, ignoring
my changes.

This is my last, desperate attempt:

--8<---------------cut here---------------start------------->8---
(defun my/css-outline ()
  (interactive)
  (outline-minor-mode -1)
  (outline-minor-mode)
  (outshine-hook-function)
  (setq outline-regexp
        (rx "/**"
            (one-or-more (any "*"))
            " ")))
(add-hook 'css-mode-hook #'my/css-outline)
--8<---------------cut here---------------end--------------->8---

It successfully sets the `outline-regexp' variable, but outline-minor-
mode, or perhaps outshine, doesn't seem to respect it. I suspect there's
something else I need to do.

Does anybody have experience with this? I'd be thankful for any help :-)

- John

signature.asc (495 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: outline-minor-mode: customizing outline-regexp?

Michael Heerdegen
John <[hidden email]> writes:

> This is my last, desperate attempt:
>
> (defun my/css-outline ()
>   (interactive)
>   (outline-minor-mode -1)
>   (outline-minor-mode)
>   (outshine-hook-function)
>   (setq outline-regexp
>         (rx "/**"
>             (one-or-more (any "*"))
>             " ")))
> (add-hook 'css-mode-hook #'my/css-outline)
>
> It successfully sets the `outline-regexp' variable, but outline-minor-
> mode, or perhaps outshine, doesn't seem to respect it. I suspect there's
> something else I need to do.

Looking at the code (I don't use outshine) it seems that outshine sets
`outline-regexp' itself, so I guess it overwrites your setting.  I guess
you need to configure outshine's variables instead.


Michael.

Reply | Threaded
Open this post in threaded view
|

Re: outline-minor-mode: customizing outline-regexp?

John Ankarström
In reply to this post by John Ankarström
Michael Heerdegen wrote:

> Looking at the code (I don't use outshine) it seems that outshine sets
> `outline-regexp' itself, so I guess it overwrites your setting.  I guess
> you need to configure outshine's variables instead.

You inspired me to take a look at the source as well, and I found the
pretty much undocumented `comment-padding' variable used by outshine.

The default behavior is to require at least one space of padding, but
(setq comment-padding "") changes that and achieves what I wanted to do.

Thanks!

> Michael.

- John

signature.asc (495 bytes) Download Attachment