help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Folding yaml by markers


From: Hartmut Goebel
Subject: Re: Folding yaml by markers
Date: Wed, 16 Oct 2019 22:33:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0

Am 14.10.19 um 15:02 schrieb Robert Pluim:
>     Hartmut>  (defvar hs-special-modes-alist
>     Hartmut>    (mapcar 'purecopy
>     Hartmut>     '((yaml-mode "[[[" "#\s+]]]" nil))))
>
> You probably want to use 'setq' rather than 'defvar'.

Thanks for pointing to this. Anway this does not seem to be the relevant
issue. I (being an elisp newbie) learned about M-: and added the value
manually. Now I'm one step further: Using

(add-to-list 'hs-special-modes-alist '(yaml-mode "\\[\\[\\[" "\\]\\]\\]"
"xxxx" nil nil))

I was able to add an appropriate entry to hs-special-modes-alist.

Using this expression, I was able to make hs-minor-mode fold, BUT ONLY
if the brackets are not part of a yaml comment. Which makes me curious!

If I understand the code (line 672 in hideshow.el) correctly,
`hs-c-start-regex` is st ot the 3rd paramater ("xxxx"), which is
documented to be a regex for starting a comment. Thus "xxxx" should
defacto disable comment detection. Yet comments are still considered.

Any hints on this?

The documentation for hs-special-modes-alist is at
<https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/hideshow.el#n268>
and the relevant function `|hs-grok-mode-type`|||at
<https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/hideshow.el#n654>.


-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |



reply via email to

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