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

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

HideShow.el configuration for a custom Major Mode


From: Sergei Lebefev
Subject: HideShow.el configuration for a custom Major Mode
Date: Tue, 04 May 2010 15:44:07 -0000
User-agent: G2/1.0

Hello, I've been making a major mode for a small language called Io.
The language syntax is pretty simple, since everything is an object
and every construct is a method call. But strangely enough i've ran
into some weird problems with hs-special-modes-alist. Here's an
example of the code I need to fold:

SomeObject := Object clone do(
    someMethod := method(a, b, c
        if(a,
            b println
        ,
            c println
        )
    )
)

According to hideshow documentation, i must define the start-end
regexp pair for the mode to work. So I came up with the following:

  (unless (assq 'io-mode hs-special-modes-alist)
    (add-to-list 'hs-special-modes-alist '(io-mode "(" ")"))

It was working okay, except for one detail - it folded all off the
parenthesized expressions. All of my attempts to make it fold __only__
method(...)'s failed. Here's what I've tried:
1. A different start regexp: "method(" and "method" - both doesn't
fold anything
2. Advising hs-hide-block - only top level block got folded,
regardless of the point position and contents of the advising
function.

So the general question is: is there a way to make HideShow hide only
the blocks i need? Or how to prevent it from hiding the blocks i don't
want to be hidden, "if()" for instance.

Thanks,
Sergei.



reply via email to

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