* Re: multiple collapse sections of code?
@ 2006-10-05 16:06 Mickey Ferguson
0 siblings, 0 replies; 8+ messages in thread
From: Mickey Ferguson @ 2006-10-05 16:06 UTC (permalink / raw)
"Mathias Dahl" <brakjoller@gmail.com> wrote in message
news:<ubqorgrjr.fsf@gmail.com>...
> "Mickey Ferguson" <MFerguson@plantcml.com> writes:
> Did you even try? :) As far as I understand, it should work in all
> C-like modes, but I could be wrong.
Did I try? Short answer - no. :-) Longer answer - first, I had no idea
where to start, but second, I'm really not conversant in elisp at all.
In college I studied lisp for about a week, but that was well over
twenty years ago. The few remaining brain cells from those days have
long since forgotten how to link together to comprehend lisp, and
certainly not to write new lisp code!
As for working in C-like modes, the two languages I have to use the
most, VB6 and InstallShield script, do not work. Obviously VB is not
very C-like, and InstallShield script is C-like only in terms of
understandability, but not syntax - no curly braces, slight keyword
differences, etc. I figured I would be out of luck for both of these
languages, but it never hurts to ask.
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.7708.1159895103.9609.help-gnu-emacs@gnu.org>]
* Re: multiple collapse sections of code?
[not found] <mailman.7708.1159895103.9609.help-gnu-emacs@gnu.org>
@ 2006-10-04 7:37 ` Mathias Dahl
2006-10-04 17:18 ` Colin S. Miller
1 sibling, 0 replies; 8+ messages in thread
From: Mathias Dahl @ 2006-10-04 7:37 UTC (permalink / raw)
"Mickey Ferguson" <MFerguson@plantcml.com> writes:
> For simplification, I've made the function much smaller, and not
> used real function calls or anything. But as I'm viewing the code,
> suppose that right now I'm not interested in seeing the error
> handling code. Within Visual Studio you can click on a little minus
> sign that is to the left of the braces, and it will collapse and
> hide all of the code that is within the braces, replacing it with a
> plus sign. Clicking on that plus sign expands it so that the error
> handling code is visible again. You can have many parts collapsed
> at any given time.
You should try out `outline-minor-mode'. I use it in Java files
sometimes to hide blocks of code.
For easy access, I have bound new keys to the hide- and show-subtree
commands:
(defun my-outline-minor-mode-keys ()
(define-key outline-minor-mode-map (kbd "<C-kp-subtract>") 'hide-subtree)
(define-key outline-minor-mode-map (kbd "<C-kp-add>") 'show-subtree))
(add-hook 'outline-minor-mode-hook 'my-outline-minor-mode-keys)
To use, place point at a opening bracket and type C-kp-substract (that
is the minus key on the numeric keypad).
Try it out and see if it works for you.
/Mathias
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multiple collapse sections of code?
[not found] <mailman.7708.1159895103.9609.help-gnu-emacs@gnu.org>
2006-10-04 7:37 ` Mathias Dahl
@ 2006-10-04 17:18 ` Colin S. Miller
1 sibling, 0 replies; 8+ messages in thread
From: Colin S. Miller @ 2006-10-04 17:18 UTC (permalink / raw)
Mickey Ferguson wrote:
> Suppose I'm writing some C++ code that looks like the following:
>
>
>
> if (MyFunc() != NO_ERROR)
>
> {
>
> // now we start a big, complicated error handling routine
>
> CallFirstErrorHandlingRoutine();
>
> CallSecondEHRoutine();
>
> CallYetMore();
>
> // there would be much more, but I've abbreviated for simplicity
>
> }
>
>
>
Mickey,
hs-minor-mode also does this.
I find these bindings more comfortable than the defaults
(add-hook 'hs-minor-mode-hook '(lambda ()
(define-key hs-minor-mode-map [(control c) (control \') (control h)] 'hs-hide-block)
(define-key hs-minor-mode-map [(control c) (control \') (control s)] 'hs-show-block)
(define-key hs-minor-mode-map [(control c) (control \') (control meta h)] 'hs-hide-all)
(define-key hs-minor-mode-map [(control c) (control \') (control meta s)] 'hs-show-all)
(define-key hs-minor-mode-map [(control c) (control \') (control l)] 'hs-hide-level)
(define-key hs-minor-mode-map [(control c) (control \') (control c)] 'hs-toggle-hiding)
))
It will place ellipsises after each folded block.
You can expand the block by right clicking on the ellipsis,
although I agree that a [+] icon would be more intuitive.
HTH,
Colin S. Miller
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.7729.1159981526.9609.help-gnu-emacs@gnu.org>]
* Re: multiple collapse sections of code?
[not found] <mailman.7729.1159981526.9609.help-gnu-emacs@gnu.org>
@ 2006-10-04 17:15 ` Charles philip Chan
2006-10-05 7:17 ` Mathias Dahl
1 sibling, 0 replies; 8+ messages in thread
From: Charles philip Chan @ 2006-10-04 17:15 UTC (permalink / raw)
On 4 Oct 2006, MFerguson@plantcml.com wrote:
> Any chance it can be customized to work with other programming
> languages? I frequently work in C++, C#, VB (VB6, not VB.NET), and
> InstallShield Script (which is somewhat C-like). It would be great if
> I could get support for some of them as well. If it was easy to
> configure to support other languages, I would be interested in
> learning how to do that.
You should check out hideshow mode which is part of Emacs:
http://www.emacswiki.org/cgi-bin/wiki/HideShow
Charles
--
linux: because a PC is a terrible thing to waste
(ksh@cis.ufl.edu put this on Tshirts in '93)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multiple collapse sections of code?
[not found] <mailman.7729.1159981526.9609.help-gnu-emacs@gnu.org>
2006-10-04 17:15 ` Charles philip Chan
@ 2006-10-05 7:17 ` Mathias Dahl
1 sibling, 0 replies; 8+ messages in thread
From: Mathias Dahl @ 2006-10-05 7:17 UTC (permalink / raw)
"Mickey Ferguson" <MFerguson@plantcml.com> writes:
> Looks interesting. I wish it would use a plus and minus sign at the far
> left, instead of the ellipses right next to the braces. It would make
> it easier to spot, but I could live with that.
It is probably possible to change what chars are displayed.
> Any chance it can be customized to work with other programming
> languages? I frequently work in C++, C#, VB (VB6, not VB.NET), and
> InstallShield Script (which is somewhat C-like). It would be great
> if I could get support for some of them as well. If it was easy to
> configure to support other languages, I would be interested in
> learning how to do that.
Did you even try? :) As far as I understand, it should work in all
C-like modes, but I could be wrong.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multiple collapse sections of code?
@ 2006-10-04 17:05 Mickey Ferguson
0 siblings, 0 replies; 8+ messages in thread
From: Mickey Ferguson @ 2006-10-04 17:05 UTC (permalink / raw)
"Mathias Dahl" wrote in message news:<ufye4h6q3.fsf@gmail.com>...
> You should try out `outline-minor-mode'. I use it in Java files
> sometimes to hide blocks of code.
>
> For easy access, I have bound new keys to the hide- and show-subtree
> commands:
>
> (defun my-outline-minor-mode-keys ()
> (define-key outline-minor-mode-map (kbd "<C-kp-subtract>")
'hide-subtree)
> (define-key outline-minor-mode-map (kbd "<C-kp-add>")
'show-subtree))
>
> (add-hook 'outline-minor-mode-hook 'my-outline-minor-mode-keys)
>
> To use, place point at a opening bracket and type C-kp-substract (that
> is the minus key on the numeric keypad).
Looks interesting. I wish it would use a plus and minus sign at the far
left, instead of the ellipses right next to the braces. It would make
it easier to spot, but I could live with that.
Any chance it can be customized to work with other programming
languages? I frequently work in C++, C#, VB (VB6, not VB.NET), and
InstallShield Script (which is somewhat C-like). It would be great if I
could get support for some of them as well. If it was easy to configure
to support other languages, I would be interested in learning how to do
that.
Thanks for the suggestion and help!
Mickey
^ permalink raw reply [flat|nested] 8+ messages in thread
* multiple collapse sections of code?
@ 2006-10-03 17:04 Mickey Ferguson
0 siblings, 0 replies; 8+ messages in thread
From: Mickey Ferguson @ 2006-10-03 17:04 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 1172 bytes --]
Suppose I'm writing some C++ code that looks like the following:
if (MyFunc() != NO_ERROR)
{
// now we start a big, complicated error handling routine
CallFirstErrorHandlingRoutine();
CallSecondEHRoutine();
CallYetMore();
// there would be much more, but I've abbreviated for simplicity
}
For simplification, I've made the function much smaller, and not used
real function calls or anything. But as I'm viewing the code, suppose
that right now I'm not interested in seeing the error handling code.
Within Visual Studio you can click on a little minus sign that is to the
left of the braces, and it will collapse and hide all of the code that
is within the braces, replacing it with a plus sign. Clicking on that
plus sign expands it so that the error handling code is visible again.
You can have many parts collapsed at any given time.
The above code, collapsed, might look like:
if (MyFunc() != NO_ERROR)
+ {}
Is there any package for GNU Emacs (I'm currently on 21.3.1, though I
could upgrade to the latest if necessary) that will provide this
functionality?
[-- Attachment #1.2: Type: text/html, Size: 5152 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-10-08 13:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.7769.1160064366.9609.help-gnu-emacs@gnu.org>
2006-10-08 13:36 ` multiple collapse sections of code? Mathias Dahl
2006-10-05 16:06 Mickey Ferguson
[not found] <mailman.7708.1159895103.9609.help-gnu-emacs@gnu.org>
2006-10-04 7:37 ` Mathias Dahl
2006-10-04 17:18 ` Colin S. Miller
[not found] <mailman.7729.1159981526.9609.help-gnu-emacs@gnu.org>
2006-10-04 17:15 ` Charles philip Chan
2006-10-05 7:17 ` Mathias Dahl
-- strict thread matches above, loose matches on Subject: below --
2006-10-04 17:05 Mickey Ferguson
2006-10-03 17:04 Mickey Ferguson
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.