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

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

Re: hideshow minor-mode


From: Shiyuan
Subject: Re: hideshow minor-mode
Date: Mon, 15 Oct 2012 18:30:09 -0500

Yes, that solves the problem. Now, I can turn on hs-minor-mode. 
But actually the block in my major mode is defined by tags, not by braces/parentheses, like,  
[begin]
   This is the block.
   This is the block.
[end]

accord to the commentary in the hideshow.el file, we can define the BEGIN and the END of the block by regex, this is what I did, 

 (add-to-list 'hs-special-modes-alist '(mymode "\\[begin]" "\\[end]" "#" nil nil))

However, it doesn't work. Anything else I need to do? or is there other packages allow me to fold the source where the blocks are defined in this way?  Thanks. 

Shiyuan 

On Mon, Oct 15, 2012 at 1:04 PM, Michael Heerdegen <address@hidden> wrote:
Shiyuan <address@hidden> writes:

> I want to turn-on the hide-show-minor-mode in a user-defined
> mymode. But it gives me the error: mymode doesn't support hide show
> minor mode. I have put (require 'hideshow) at the beginning of
> mymode.el, and also
> (hs-minor-mode 1) in the body of the definition of the major mode, and
> after that
> I put (add-to-list 'hs-special-modes-alist '(mymode "{" "}" "/[*/]"
> nil nil)) in mymode.el.
>
> What else I should do to utilize the hs-minor-mode in mymode? Thanks.

Enabling `hs-minor-mode' tests if `comment-start' and `comment-end' are
bound to something non-nil and fails otherwise.  This happens even
before `hs-special-modes-alist' is handled.  IMHO this doesn't make much
sense.  FWIW, your minor-mode must bind `comment-start' and
`comment-end'.

If your mode doesn't have comments at all, you can bind these to a
regexp that always fails matching - like "\\=[^[:ascii:][:nonascii:]]".

Does that help?


Michael.



reply via email to

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