all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Code Folding
@ 2003-05-26 10:33 Adam H
  0 siblings, 0 replies; 26+ messages in thread
From: Adam H @ 2003-05-26 10:33 UTC (permalink / raw)


Is there a way to fold code in Emacs?

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Code Folding
       [not found] <mailman.6772.1053945790.21513.help-gnu-emacs@gnu.org>
@ 2003-05-26 11:12 ` Tuukka Toivonen
  2003-05-26 13:49 ` Kai Großjohann
  2003-05-26 15:11 ` Stefan Monnier
  2 siblings, 0 replies; 26+ messages in thread
From: Tuukka Toivonen @ 2003-05-26 11:12 UTC (permalink / raw)


In article <mailman.6772.1053945790.21513.help-gnu-emacs@gnu.org>, Adam H wrote:
> Is there a way to fold code in Emacs?

Search for folding.el:
http://user.it.uu.se/~andersl/emacs.shtml

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Code Folding
       [not found] <mailman.6772.1053945790.21513.help-gnu-emacs@gnu.org>
  2003-05-26 11:12 ` Code Folding Tuukka Toivonen
@ 2003-05-26 13:49 ` Kai Großjohann
  2003-05-26 15:11 ` Stefan Monnier
  2 siblings, 0 replies; 26+ messages in thread
From: Kai Großjohann @ 2003-05-26 13:49 UTC (permalink / raw)


Adam H <amh@crm-114.net> writes:

> Is there a way to fold code in Emacs?

M-x hs-minor-mode RET

Then see the Hide and Show menus.
-- 
This line is not blank.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Code Folding
       [not found] <mailman.6772.1053945790.21513.help-gnu-emacs@gnu.org>
  2003-05-26 11:12 ` Code Folding Tuukka Toivonen
  2003-05-26 13:49 ` Kai Großjohann
@ 2003-05-26 15:11 ` Stefan Monnier
  2 siblings, 0 replies; 26+ messages in thread
From: Stefan Monnier @ 2003-05-26 15:11 UTC (permalink / raw)


>>>>> "Adam" == Adam H <amh@crm-114.net> writes:
> Is there a way to fold code in Emacs?

...there's also M-x outline-minor-mode RET


        Stefan

^ permalink raw reply	[flat|nested] 26+ messages in thread

* code folding
@ 2006-01-29 12:18 Michael Powe
  2006-01-29 13:06 ` Colin S. Miller
                   ` (4 more replies)
  0 siblings, 5 replies; 26+ messages in thread
From: Michael Powe @ 2006-01-29 12:18 UTC (permalink / raw)


Hello,

I'm looking for folding.el or its current equivalent to do
code/comment folding.  I can get by with just comment folding because
hide-show doesn't work for comments.  It would be nice to have
everything rolled up into a single package, though.

All of the google references for folding.el are to either discussions
only or to expired pages and I can't find a download location.  I
can't find any indication that it has been superceded by a new,
improved item, either.

Thanks.

mp

-- 
Michael Powe		michael@trollope.org		Naugatuck CT USA

"He speaks well, he's well-read, but he's an idiot."
  -- N.D. Kalu, describing Rush Limbaugh

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2006-01-29 12:18 Michael Powe
@ 2006-01-29 13:06 ` Colin S. Miller
  2006-01-29 19:32   ` Michael Powe
  2006-01-29 14:04 ` Jose E. Marchesi
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 26+ messages in thread
From: Colin S. Miller @ 2006-01-29 13:06 UTC (permalink / raw)


Michael Powe wrote:
> Hello,
> 
> I'm looking for folding.el or its current equivalent to do
> code/comment folding.  I can get by with just comment folding because
> hide-show doesn't work for comments.  It would be nice to have
> everything rolled up into a single package, though.
> 
> All of the google references for folding.el are to either discussions
> only or to expired pages and I can't find a download location.  I
> can't find any indication that it has been superceded by a new,
> improved item, either.
> 
> Thanks.
> 
> mp
> 

Michael,

hs-minor-mode (hide-show) can fold comments in C, C++ and elisp, and
probably other languages. You didn't state which language you are using,
perhaps the parser isn't set up correctly for you language.

However, I use XEmacs rather than GNU Emacs, which might make a difference.

HTH,
Colin S. Miller


-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* code folding
  2006-01-29 12:18 Michael Powe
  2006-01-29 13:06 ` Colin S. Miller
@ 2006-01-29 14:04 ` Jose E. Marchesi
  2006-01-29 14:56 ` Robert Marshall
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 26+ messages in thread
From: Jose E. Marchesi @ 2006-01-29 14:04 UTC (permalink / raw)
  Cc: help-gnu-emacs


    All of the google references for folding.el are to either discussions
    only or to expired pages and I can't find a download location.  I
    can't find any indication that it has been superceded by a new,
    improved item, either.

See http://www.emacswiki.org/cgi-bin/wiki/FoldingMode


-- 
José E. Marchesi  <jemarch@gnu.org>
                  <jemarch@es.gnu.org>

GNUs Not Unix!    http://www.gnu.org
GNU Spain         http://es.gnu.org

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2006-01-29 12:18 Michael Powe
  2006-01-29 13:06 ` Colin S. Miller
  2006-01-29 14:04 ` Jose E. Marchesi
@ 2006-01-29 14:56 ` Robert Marshall
  2006-01-29 19:38   ` Michael Powe
       [not found] ` <mailman.137.1138549468.3044.help-gnu-emacs@gnu.org>
  2006-01-30  7:33 ` Tim X
  4 siblings, 1 reply; 26+ messages in thread
From: Robert Marshall @ 2006-01-29 14:56 UTC (permalink / raw)


On 29 Jan 2006, Michael Powe wrote:

> Hello,
> 
> I'm looking for folding.el or its current equivalent to do
> code/comment folding.  I can get by with just comment folding
> because hide-show doesn't work for comments.  It would be nice to
> have everything rolled up into a single package, though.
> 
> All of the google references for folding.el are to either
> discussions only or to expired pages and I can't find a download
> location.  I can't find any indication that it has been superceded
> by a new, improved item, either.
> 

I have a version that attempted to move folding.el (orig of Lokier and
Aalto) from selective display to overlays though recently I've rather
swapped over to 

http://uuid.com/~marcus/computing/fold-mode.html 

which is another WIP.

hide-show looks good too

Robert
-- 
La grenouille songe..dans son château d'eau

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
       [not found] ` <mailman.137.1138549468.3044.help-gnu-emacs@gnu.org>
@ 2006-01-29 19:29   ` Michael Powe
  0 siblings, 0 replies; 26+ messages in thread
From: Michael Powe @ 2006-01-29 19:29 UTC (permalink / raw)


>>>>> "Jose" == Jose E Marchesi <jemarch@gnu.org> writes:

    Jose>     All of the google references for folding.el are to
    Jose> either discussions only or to expired pages and I can't find
    Jose> a download location.  I can't find any indication that it
    Jose> has been superceded by a new, improved item, either.

    Jose> See http://www.emacswiki.org/cgi-bin/wiki/FoldingMode

Great, thanks.  It seems odd that page doesn't come up when I search
for 'folding.el.'  Yet, i get all other kinds of stuff like
'cyrillic-folding.el.'  

Thanks.

mp

-- 
Michael Powe		michael@trollope.org		Naugatuck CT USA
War is a sociological safety valve that cleverly diverts popular
hatred for the ruling classes into a happy occasion to mutilate or
kill foreign enemies. - Ernest Becker

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2006-01-29 13:06 ` Colin S. Miller
@ 2006-01-29 19:32   ` Michael Powe
  2006-01-29 21:10     ` Colin S. Miller
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Powe @ 2006-01-29 19:32 UTC (permalink / raw)


>>>>> "Colin" == Colin S Miller <no-spam-thank-you@csmiller.demon.co.uk> writes:

    Colin> Michael Powe wrote:
    >> Hello, I'm looking for folding.el or its current equivalent to
    >> do code/comment folding.  I can get by with just comment
    >> folding because hide-show doesn't work for comments.  It would
    >> be nice to have everything rolled up into a single package,
    >> though.  All of the google references for folding.el are to
    >> either discussions only or to expired pages and I can't find a
    >> download location.  I can't find any indication that it has
    >> been superceded by a new, improved item, either.  Thanks.  mp
    >> 

    Colin> Michael,

    Colin> hs-minor-mode (hide-show) can fold comments in C, C++ and
    Colin> elisp, and probably other languages. You didn't state which
    Colin> language you are using, perhaps the parser isn't set up
    Colin> correctly for you language.

It does hide the functions but not the C-style comments.  The language
is Javascript.  When the point is inside a comment block, nothing
happens when 'hide block' is invoked.  I didn't try it on C++ style
comments, which I only ever use for 1 or 2 line comments, anyway.

You could be right, though, and maybe it is just set up for that style
of comment.

Thanks.

mp

-- 
Michael Powe		michael@trollope.org		Naugatuck CT USA
It could have been an organically based disturbance of the brain --
perhaps a tumor or a metabolic deficiency -- but after a thorough
neurological exam it was determined that Byron was simply a jerk.  
-- Jeff Jahnke, runner-up, Bulwer-Lytton contest

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2006-01-29 14:56 ` Robert Marshall
@ 2006-01-29 19:38   ` Michael Powe
  0 siblings, 0 replies; 26+ messages in thread
From: Michael Powe @ 2006-01-29 19:38 UTC (permalink / raw)


>>>>> "Robert" == Robert Marshall <spam@chezmarshall.freeserve.co.uk> writes:

    Robert> On 29 Jan 2006, Michael Powe wrote:

    >> I'm looking for folding.el or its current equivalent to do
    >> code/comment folding.  I can get by with just comment folding
    >> because hide-show doesn't work for comments.  It would be nice
    >> to have everything rolled up into a single package, though.

    Robert> I have a version that attempted to move folding.el (orig
    Robert> of Lokier and Aalto) from selective display to overlays
    Robert> though recently I've rather swapped over to

    Robert> http://uuid.com/~marcus/computing/fold-mode.html

Thank you, I shall try it.

mp

-- 
Michael Powe		michael@trollope.org		Naugatuck CT USA
"As an adolescent I aspired to lasting fame, I craved factual
certainty, and I thirsted for a meaningful vision of human life -- so
I became a scientist.  This is like becoming an archbishop so you can
meet girls."  -- Matt Cartmill

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2006-01-29 19:32   ` Michael Powe
@ 2006-01-29 21:10     ` Colin S. Miller
  2006-01-30  0:16       ` Thien-Thi Nguyen
  0 siblings, 1 reply; 26+ messages in thread
From: Colin S. Miller @ 2006-01-29 21:10 UTC (permalink / raw)


Michael Powe wrote:

> It does hide the functions but not the C-style comments.  The language
> is Javascript.  When the point is inside a comment block, nothing
> happens when 'hide block' is invoked.  I didn't try it on C++ style
> comments, which I only ever use for 1 or 2 line comments, anyway.
> 
> You could be right, though, and maybe it is just set up for that style
> of comment.
> 
> Thanks.
> 
> mp
> 
Micheal,

I did a quick test, and it worked for me.
However, the cursor must be inside the comment, or hs-hide-block will fold
the code level containing the comment.

hs-hide-level folds control blocks, but not comments within the current indent level.

However, this might be an XEmacs/GNU Emacs difference. I'll try it on GNU Emacs
when I get access to a machine with it installed.

Code used was

/*
  * test
  */

// 1
// 2


foo(i)
{
     var i;
     var k;

     if (1)
     {

         /*
            Test

         */
     }

     /*
       test
     */

}

HTH,
Colin S. Miller

-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2006-01-29 21:10     ` Colin S. Miller
@ 2006-01-30  0:16       ` Thien-Thi Nguyen
  0 siblings, 0 replies; 26+ messages in thread
From: Thien-Thi Nguyen @ 2006-01-30  0:16 UTC (permalink / raw)


"Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk> writes:

> However, this might be an XEmacs/GNU Emacs difference. I'll try
> it on GNU Emacs when I get access to a machine with it
> installed.

i am always interested in hideshow (mis)behavior (although usually
i don't do anything constructive about it for years at a time).
anyway, a small bunch of files i use to play w/ hideshow are at:

http://www.glug.org/people/ttn/software/hideshow/hideshow-testing.tar.gz

there is no test harness; just move point to various positions
trying various hideshow commands until bored.  good for hours of
fun...

thi

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2006-01-29 12:18 Michael Powe
                   ` (3 preceding siblings ...)
       [not found] ` <mailman.137.1138549468.3044.help-gnu-emacs@gnu.org>
@ 2006-01-30  7:33 ` Tim X
  4 siblings, 0 replies; 26+ messages in thread
From: Tim X @ 2006-01-30  7:33 UTC (permalink / raw)


Michael Powe <michael+gnus@trollope.org> writes:

> Hello,
> 
> I'm looking for folding.el or its current equivalent to do
> code/comment folding.  I can get by with just comment folding because
> hide-show doesn't work for comments.  It would be nice to have
> everything rolled up into a single package, though.
> 
> All of the google references for folding.el are to either discussions
> only or to expired pages and I can't find a download location.  I
> can't find any indication that it has been superceded by a new,
> improved item, either.
> 
> Thanks.

Try http://www.emacswiki.org - it had a few items on a couple of
different folding modes. 

Just FYI - the newer folding modes take advantage of emacs overlays
and have the potential of being better, but the last time I looked,
the mode was still pretty much beta. The older folding mode was quite
good, but then it was 'enhanced' and I found it wasn't as stable. Last
time I looked, the wiki pages had information about both newer and
older folding modes. 

HTH

Tim


 
-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* code folding
@ 2011-08-01 20:09 Jai Dayal
  2011-08-01 21:52 ` Jambunathan K
  0 siblings, 1 reply; 26+ messages in thread
From: Jai Dayal @ 2011-08-01 20:09 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 213 bytes --]

Hi all,
  I was wondering if anyone had any preferences on some decent code folding
extentions for emacs that I could check out?  It should be noted that I use
ECB, but I think the two should be independent.

Jai

[-- Attachment #2: Type: text/html, Size: 229 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-01 20:09 code folding Jai Dayal
@ 2011-08-01 21:52 ` Jambunathan K
  2011-08-02  5:40   ` Andreas Röhler
                     ` (3 more replies)
  0 siblings, 4 replies; 26+ messages in thread
From: Jambunathan K @ 2011-08-01 21:52 UTC (permalink / raw)
  To: Jai Dayal; +Cc: help-gnu-emacs

Jai Dayal <dayalsoap@gmail.com> writes:

> Hi all,
>   I was wondering if anyone had any preferences on some decent code
> folding extentions for emacs that I could check out?  It should be
> noted that I use ECB, but I think the two should be independent.

Experienced users use outline-minor-mode - It takes time to getting used
to it (or any other such mode).

Hint: Search for "outline" or "fold" in emacswiki and try out the first
few modes that show up. You can also search for narrowing and "indirect
buffers" to explore other related things.

I have never used cedet plus company. So I cannot comment on them.

IMO you will be better off NOT using any outlining to begin with.

>
> Jai
>
>

-- 



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-01 21:52 ` Jambunathan K
@ 2011-08-02  5:40   ` Andreas Röhler
  2011-08-02  8:08   ` Le Wang
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 26+ messages in thread
From: Andreas Röhler @ 2011-08-02  5:40 UTC (permalink / raw)
  To: help-gnu-emacs

Am 01.08.2011 23:52, schrieb Jambunathan K:
> Jai Dayal<dayalsoap@gmail.com>  writes:
>
>> Hi all,
>>    I was wondering if anyone had any preferences on some decent code
>> folding extentions for emacs that I could check out?  It should be
>> noted that I use ECB, but I think the two should be independent.
>
> Experienced users use outline-minor-mode - It takes time to getting used
> to it (or any other such mode).
>

lets mention hide-show mode --M-x hs-minor-mode-- too, which is slightly 
more advanced in such, as it's able to hide constructs defined by 
beginning- and end-regexp, whilst outline-modes are restricted to 
address the beginning of the line - IIRC


Andreas

--
https://launchpad.net/python-mode
https://launchpad.net/s-x-emacs-werkstatt/




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-01 21:52 ` Jambunathan K
  2011-08-02  5:40   ` Andreas Röhler
@ 2011-08-02  8:08   ` Le Wang
  2011-08-02  8:19   ` Teemu Likonen
  2011-08-12  7:34   ` Bastien
  3 siblings, 0 replies; 26+ messages in thread
From: Le Wang @ 2011-08-02  8:08 UTC (permalink / raw)
  To: Jambunathan K; +Cc: help-gnu-emacs

On Tue, Aug 2, 2011 at 5:52 AM, Jambunathan K <kjambunathan@gmail.com> wrote:
> IMO you will be better off NOT using any outlining to begin with.

why?


-- 
Le



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-01 21:52 ` Jambunathan K
  2011-08-02  5:40   ` Andreas Röhler
  2011-08-02  8:08   ` Le Wang
@ 2011-08-02  8:19   ` Teemu Likonen
  2011-08-12  7:34   ` Bastien
  3 siblings, 0 replies; 26+ messages in thread
From: Teemu Likonen @ 2011-08-02  8:19 UTC (permalink / raw)
  To: Jambunathan K.; +Cc: help-gnu-emacs

* 2011-08-02T03:22:07+05:30 * Jambunathan K. wrote:

> IMO you will be better off NOT using any outlining to begin with.

Such code outlining/folding is only developer's personal configuration.
I think there is no much point in ruling or suggesting that this kind of
personal configurations are good or bad. They don't matter because they
have no effect on the code that is made public.

I happen to use outline-minor-mode (with extension [1]) mostly with
LaTeX files but sometimes with programming languages too.

---------------
 1. http://www.emacswiki.org/emacs/OutlineMinorMode#toc5



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-01 21:52 ` Jambunathan K
                     ` (2 preceding siblings ...)
  2011-08-02  8:19   ` Teemu Likonen
@ 2011-08-12  7:34   ` Bastien
  2011-08-13 19:38     ` Le Wang
  2011-08-15 13:01     ` Bastien
  3 siblings, 2 replies; 26+ messages in thread
From: Bastien @ 2011-08-12  7:34 UTC (permalink / raw)
  To: Jambunathan K; +Cc: help-gnu-emacs

Jambunathan K <kjambunathan@gmail.com> writes:

> Experienced users use outline-minor-mode - It takes time to getting used
> to it (or any other such mode).

You can also use orgstruct-mode, a minor mode that comes with org-mode.

Global cycling is broken in Org 7.7 but I'm working on fixing this.

> IMO you will be better off NOT using any outlining to begin with.

I use code folding quite often and I find it useful to navigate through
the code and concentrate on the part I want to edit.

My 2 cents,

-- 
 Bastien



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-12  7:34   ` Bastien
@ 2011-08-13 19:38     ` Le Wang
  2011-08-13 20:12       ` Jambunathan K
  2011-08-15 13:01     ` Bastien
  1 sibling, 1 reply; 26+ messages in thread
From: Le Wang @ 2011-08-13 19:38 UTC (permalink / raw)
  To: Bastien; +Cc: help-gnu-emacs, Jambunathan K

On Fri, Aug 12, 2011 at 3:34 PM, Bastien <bzg@altern.org> wrote:
> You can also use orgstruct-mode, a minor mode that comes with org-mode.

How?  The orgmode manual doesn't address code folding in the context
of orgstruct, and my google-fu has failed me so far.

I currently use outline-magic, which Carsten wrote, I guess before he
made orgmode.

>
> --
>  Bastien
>
>



-- 
Le



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-13 19:38     ` Le Wang
@ 2011-08-13 20:12       ` Jambunathan K
  2011-08-16 10:39         ` Le Wang
  0 siblings, 1 reply; 26+ messages in thread
From: Jambunathan K @ 2011-08-13 20:12 UTC (permalink / raw)
  To: Le Wang; +Cc: help-gnu-emacs

Le Wang <l26wang@gmail.com> writes:

> On Fri, Aug 12, 2011 at 3:34 PM, Bastien <bzg@altern.org> wrote:
>> You can also use orgstruct-mode, a minor mode that comes with org-mode.
>
> How?  The orgmode manual doesn't address code folding in the context
> of orgstruct, and my google-fu has failed me so far.

Look at bindings effective while in orgstruct(++)-mode.

Do a C-h b and search for orgstruct.

> I currently use outline-magic, which Carsten wrote, I guess before he
> made orgmode.

Also see
http://lists.gnu.org/archive/html/emacs-orgmode/2011-08/msg00382.html
which makes references to org-global-cycle in Auctex.

The above post also makes reference to this Org FAQ entry
http://orgmode.org/worg/org-faq.html#use-visibility-cycling-in-outline-mode

Jambunathan K.

>
>>
>> --
>>  Bastien
>>
>>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-12  7:34   ` Bastien
  2011-08-13 19:38     ` Le Wang
@ 2011-08-15 13:01     ` Bastien
  1 sibling, 0 replies; 26+ messages in thread
From: Bastien @ 2011-08-15 13:01 UTC (permalink / raw)
  To: Jambunathan K; +Cc: help-gnu-emacs

Bastien <bzg@altern.org> writes:

> Global cycling is broken in Org 7.7 but I'm working on fixing this.

This is now fixed in Org git repository.

Regards,

-- 
 Bastien



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-13 20:12       ` Jambunathan K
@ 2011-08-16 10:39         ` Le Wang
  2011-08-16 11:39           ` Jambunathan K
  2011-08-17  9:08           ` Bastien
  0 siblings, 2 replies; 26+ messages in thread
From: Le Wang @ 2011-08-16 10:39 UTC (permalink / raw)
  To: Jambunathan K; +Cc: help-gnu-emacs

On Sun, Aug 14, 2011 at 4:12 AM, Jambunathan K <kjambunathan@gmail.com> wrote:
> Look at bindings effective while in orgstruct(++)-mode.
>
> Do a C-h b and search for orgstruct.
>

I have the following code in my ruby-mode-hook to enable code folding
using outline-minor-mode + outline-magic.

(outline-minor-mode 1)
(set (make-local-variable 'outline-regexp) "^[ \t]*\\(?:def
\\|class\\|module\\)\\|^[ \t]*###==")

What's the equivalent in orgstruct?  org-outline-regexp seems
interesting but isn't documented.

-- 
Le



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-16 10:39         ` Le Wang
@ 2011-08-16 11:39           ` Jambunathan K
  2011-08-17  9:08           ` Bastien
  1 sibling, 0 replies; 26+ messages in thread
From: Jambunathan K @ 2011-08-16 11:39 UTC (permalink / raw)
  To: Le Wang; +Cc: help-gnu-emacs

Le Wang <l26wang@gmail.com> writes:

> On Sun, Aug 14, 2011 at 4:12 AM, Jambunathan K <kjambunathan@gmail.com> wrote:
>> Look at bindings effective while in orgstruct(++)-mode.
>>
>> Do a C-h b and search for orgstruct.
>>
>
> I have the following code in my ruby-mode-hook to enable code folding
> using outline-minor-mode + outline-magic.
>
> (outline-minor-mode 1)
> (set (make-local-variable 'outline-regexp) "^[ \t]*\\(?:def
> \\|class\\|module\\)\\|^[ \t]*###==")

Did you try the suggestion in the FAQ that I pointed to?

While in emacs-lisp-mode + outline-minor-mode + below mentioned-hook,,
C-TAB and S-TAB fold and unfold the defuns as expected. Note that for
C-TAB to work, the cursor needs to be on a headline (the line where the
ellipsis shows)

You don't have to do any additional settings for code folding to work.

,----
| Can I get the visibility-cycling features in outline-mode and
| outline-minor-mode?
| 
| Yes, these functions are written in a way that they are independent of
| the outline setup. The following setup provides standard Org-mode
| functionality in outline-mode on TAB and S-TAB. For outline-minor-mode,
| we use C-TAB instead of TAB, because TAB usually has mode-specific
| tasks.
| 
| (add-hook 'outline-minor-mode-hook
|   (lambda ()
|     (define-key outline-minor-mode-map [(control tab)] 'org-cycle)
|     (define-key outline-minor-mode-map [(shift tab)] 'org-global-cycle)))
| 
| (add-hook 'outline-mode-hook
|   (lambda ()
|     (define-key outline-mode-map [(tab)] 'org-cycle)
|     (define-key outline-mode-map [(shift tab)] 'org-global-cycle)))
| 
| Or check out outline-magic.el, which does this and also provides
| promotion and demotion functionality. outline-magic.el is available at
| Outline Magic.
`----

> What's the equivalent in orgstruct?  org-outline-regexp seems
> interesting but isn't documented.

orgstruct mode is for editing org-like text in other modes - like
message mode etc. It has NOTHING to do with folding of code as
such. 

In summary, in a ruby buffer,

1. Add the above hook for folding and unfolding ruby functions.
2. Turn orgstruct++-mode for editing comments that look like a org-like
   plain-text tree.

-- 



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: code folding
  2011-08-16 10:39         ` Le Wang
  2011-08-16 11:39           ` Jambunathan K
@ 2011-08-17  9:08           ` Bastien
  1 sibling, 0 replies; 26+ messages in thread
From: Bastien @ 2011-08-17  9:08 UTC (permalink / raw)
  To: Le Wang; +Cc: help-gnu-emacs, Jambunathan K

Le Wang <l26wang@gmail.com> writes:

> What's the equivalent in orgstruct?  org-outline-regexp seems
> interesting but isn't documented.

I just added a docstring to ̀org-outline-regexp' but I'm afraid 
this will not really help you.

,----
| org-outline-regexp is a variable defined in `org.el'.
| Its value is "\\*+ "
| 
| Documentation:
| Regexp to match Org headlines.
`----

Jambunathan's directions are worth following.

Best,

-- 
 Bastien



^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2011-08-17  9:08 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01 20:09 code folding Jai Dayal
2011-08-01 21:52 ` Jambunathan K
2011-08-02  5:40   ` Andreas Röhler
2011-08-02  8:08   ` Le Wang
2011-08-02  8:19   ` Teemu Likonen
2011-08-12  7:34   ` Bastien
2011-08-13 19:38     ` Le Wang
2011-08-13 20:12       ` Jambunathan K
2011-08-16 10:39         ` Le Wang
2011-08-16 11:39           ` Jambunathan K
2011-08-17  9:08           ` Bastien
2011-08-15 13:01     ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2006-01-29 12:18 Michael Powe
2006-01-29 13:06 ` Colin S. Miller
2006-01-29 19:32   ` Michael Powe
2006-01-29 21:10     ` Colin S. Miller
2006-01-30  0:16       ` Thien-Thi Nguyen
2006-01-29 14:04 ` Jose E. Marchesi
2006-01-29 14:56 ` Robert Marshall
2006-01-29 19:38   ` Michael Powe
     [not found] ` <mailman.137.1138549468.3044.help-gnu-emacs@gnu.org>
2006-01-29 19:29   ` Michael Powe
2006-01-30  7:33 ` Tim X
     [not found] <mailman.6772.1053945790.21513.help-gnu-emacs@gnu.org>
2003-05-26 11:12 ` Code Folding Tuukka Toivonen
2003-05-26 13:49 ` Kai Großjohann
2003-05-26 15:11 ` Stefan Monnier
2003-05-26 10:33 Adam H

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.