From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Shiyuan Newsgroups: gmane.emacs.help Subject: Re: hideshow minor-mode Date: Mon, 15 Oct 2012 18:30:09 -0500 Message-ID: References: <87626blih9.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec51f955515fe0604cc216b24 X-Trace: ger.gmane.org 1350343828 16116 80.91.229.3 (15 Oct 2012 23:30:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Oct 2012 23:30:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 16 01:30:35 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TNu79-0006u4-Qy for geh-help-gnu-emacs@m.gmane.org; Tue, 16 Oct 2012 01:30:28 +0200 Original-Received: from localhost ([::1]:57889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNu72-0002Hq-Tp for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Oct 2012 19:30:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNu6v-0002Hh-48 for help-gnu-emacs@gnu.org; Mon, 15 Oct 2012 19:30:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNu6s-0002MS-Ot for help-gnu-emacs@gnu.org; Mon, 15 Oct 2012 19:30:13 -0400 Original-Received: from mail-oa0-f41.google.com ([209.85.219.41]:49001) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNu6s-0002M3-F6 for help-gnu-emacs@gnu.org; Mon, 15 Oct 2012 19:30:10 -0400 Original-Received: by mail-oa0-f41.google.com with SMTP id k14so6624308oag.0 for ; Mon, 15 Oct 2012 16:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=vG/t2H+ExdlHWzzwYUKyUJzkAZM9kZQt5/thC3q688Q=; b=bKiEuS0BWJRUo8QQbE17GKJMZaTtowo4yPU3L12PqP147Tjczu1u3zAhH7Woc3fbve cAQSsbPCTYX5oQAERtcpyNdhNPpyG1+aAqmjAfm4Inj2CdMl2OUb/3v/mpYTpODTQSzw 5ELL5fj0pCBX2EnU1lSR9eDI9SE+uinFVc2Ko6YBn1JZKepvD1zNOxk9u8we/tQZCeO8 kzEQSCvnKZV7JOZ2HarQb+nmKzeHUKSvYKm25vHs0PlryA+QfTgW4Jg3sdGBNbV5J1RX 76vZbIRP12/MxS9kZxthiuo3lfqLR73SNWfbQQdJiW+HGiM3J91a8UGgbniDcjHiXsz2 uxbg== Original-Received: by 10.182.150.37 with SMTP id uf5mr11037725obb.10.1350343809432; Mon, 15 Oct 2012 16:30:09 -0700 (PDT) Original-Received: by 10.182.26.110 with HTTP; Mon, 15 Oct 2012 16:30:09 -0700 (PDT) In-Reply-To: <87626blih9.fsf@web.de> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.219.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87276 Archived-At: --bcaec51f955515fe0604cc216b24 Content-Type: text/plain; charset=ISO-8859-1 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 wrote: > Shiyuan 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. > > --bcaec51f955515fe0604cc216b24 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Yes, that solves the problem. Now, I can turn on hs-minor-mode.=A0
But = actually the block in my major mode is defined by tags, not by braces/paren= theses, like, =A0
[begin]
=A0 =A0This is the block.
=A0 =A0This is the block.
[end]

accord t= o the commentary in the hideshow.el file, we can define the BEGIN and the E= ND of the block by regex, this is what I did,=A0

= =A0(add-to-list 'hs-special-modes-alist '(mymode "\\[begin]&qu= ot; "\\[end]" "#" nil nil))

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

Shiyuan=A0<= /div>

On Mon, Oct 15, 2012 at 1:04 PM, Michae= l Heerdegen <michael_heerdegen@web.de> wrote:
Shiyuan <gshy2014@gmail.com> 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 sho= w
> 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 "{&qu= ot; "}" "/[*/]"
> nil nil)) in mymode.el.
>
> What else I should do to utilize the hs-minor-mode in mymode? Thanks.<= br>
Enabling `hs-minor-mode' tests if `comment-start' and `= comment-end' are
bound to something non-nil and fails otherwise. =A0This happens even
before `hs-special-modes-alist' is handled. =A0IMHO this doesn't ma= ke much
sense. =A0FWIW, 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 "\\=3D[^[:ascii:][:nonascii:]= ]".

Does that help?


Michael.


--bcaec51f955515fe0604cc216b24--