all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sergei Lebefev <superbobry@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: HideShow.el configuration for a custom Major Mode
Date: Mon, 5 Apr 2010 15:47:17 -0700 (PDT)	[thread overview]
Message-ID: <9e159855-ecea-46d4-92f5-100f9f75a505@q15g2000yqj.googlegroups.com> (raw)

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	other threads:[~2010-04-05 22:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e159855-ecea-46d4-92f5-100f9f75a505@q15g2000yqj.googlegroups.com \
    --to=superbobry@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.