From: Jambunathan K <kjambunathan@gmail.com>
To: Le Wang <l26wang@gmail.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: code folding
Date: Tue, 16 Aug 2011 17:09:06 +0530 [thread overview]
Message-ID: <81y5ytbn6t.fsf@gmail.com> (raw)
In-Reply-To: <CAM=K+io8yxdooyzqHQidoOFRzH24Ku2nq86eRiZBrs3HFOYyPw@mail.gmail.com> (Le Wang's message of "Tue, 16 Aug 2011 18:39:10 +0800")
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.
--
next prev parent reply other threads:[~2011-08-16 11:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=81y5ytbn6t.fsf@gmail.com \
--to=kjambunathan@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=l26wang@gmail.com \
/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.