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

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

Re: Narrow/widen in folding.el


From: Tassilo Horn
Subject: Re: Narrow/widen in folding.el
Date: Wed, 22 Dec 2010 09:16:27 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

Hi Andrea,

>> But org-mode doesn't work for source code files, e.g. it's not the
>> right thing for using folding in C++ files.
>
> Aha ok I didn't understand it was for source code.

Nah, no-one said that.  But folding.el and outline.el (both minor modes)
can be used in any buffer, whereas org-mode (a major mode) is for
org-files only.  So activating org-mode in a lisp buffer ==> lisp
completion, highlighting, and indentation are gone.

> Anyway for C++ with cedet and the function
>
> senator-fold-tag
> it works perfectly for me, not sure if it's what you want...
> I have this
>   (local-set-key [f6] 'senator-fold-tag-toggle)
>
> for the buffers supported by semantic.

Yes, several modes implement some folding capabilities wtr. some
syntactic constructs of a programming language.  For example, there's
also hs-minor-mode, which can collapse/expand blocks in languages like
C/C++/Java.

That's a good thing, but with outline-minor-mode (or folding.el), you
can add more coarse-grained sections to structure your code into several
groups of things (e.g. functions) belonging together, like:

;;* Code
;;** User Variables
;;** User Commands
;;** Internal Implementation
;;*** General
;;*** Feature A
;;*** Feature B

> Now I remember I also tried to do something like this some time ago,
> but I couldn't stand the fact that I had to use a special syntax for
> it.

That's what I like with `outline-minor-mode' and my config (i.e. outline
headings are `comment-start' + one or many *s).  You would comment your
code anyway (I hope so!), and adding a few * to make a comment a
headline to make the structure of the file visible is worth it.

But I agree, that I don't like folding.el's obtrusive {{{ ... }}}
syntax, too.

Bye,
Tassilo




reply via email to

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