all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to expertly fold perl or other scripting code.
@ 2009-09-19 21:58 Harry Putnam
  2009-09-19 23:16 ` Andreas Politz
       [not found] ` <mailman.7073.1253402286.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Harry Putnam @ 2009-09-19 21:58 UTC (permalink / raw)
  To: help-gnu-emacs

I see too much output on google that looks very complex when I try to
delve into folding code in emacs.

Is it horribly complicated?

I know some windows editors or ide's do such folding very
quickly... but I'm not going to do my coding on windows.  I'm far to
comfortable on linux or opensolaris, but I would really like to have
the ability to fold/unfold code as needed, quickly and easily.





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

* Re: How to expertly fold perl or other scripting code.
  2009-09-19 21:58 How to expertly fold perl or other scripting code Harry Putnam
@ 2009-09-19 23:16 ` Andreas Politz
  2009-09-20  1:44   ` Bernardo
       [not found] ` <mailman.7073.1253402286.2239.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Andreas Politz @ 2009-09-19 23:16 UTC (permalink / raw)
  To: help-gnu-emacs

Harry Putnam <reader@newsguy.com> writes:

> I see too much output on google that looks very complex when I try to
> delve into folding code in emacs.
>
> Is it horribly complicated?
>
> I know some windows editors or ide's do such folding very
> quickly... but I'm not going to do my coding on windows.  I'm far to
> comfortable on linux or opensolaris, but I would really like to have
> the ability to fold/unfold code as needed, quickly and easily.

M-x outline-minor-mode RET
C-c @ C-t

For a start...

-ap





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

* Re: How to expertly fold perl or other scripting code.
  2009-09-19 23:16 ` Andreas Politz
@ 2009-09-20  1:44   ` Bernardo
  2009-09-20 17:24     ` Harry Putnam
  0 siblings, 1 reply; 9+ messages in thread
From: Bernardo @ 2009-09-20  1:44 UTC (permalink / raw)
  To: help-gnu-emacs


> Harry Putnam <reader@newsguy.com> writes:
> 
>> I see too much output on google that looks very complex when I try to
>> delve into folding code in emacs.
>>
>> Is it horribly complicated?
>>
>> I know some windows editors or ide's do such folding very
>> quickly... but I'm not going to do my coding on windows.  I'm far to
>> comfortable on linux or opensolaris, but I would really like to have
>> the ability to fold/unfold code as needed, quickly and easily.
> 
> M-x outline-minor-mode RET
> C-c @ C-t
> 
> For a start...
> 
> -ap
i never investigated what is the difference between outline-minor-mode 
and hs-minor-mode but the later is also a possibility

(they seem to be defined in different files but the commands have the 
same prefix key, C-c @)




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

* Re: How to expertly fold perl or other scripting code.
       [not found] ` <mailman.7073.1253402286.2239.help-gnu-emacs@gnu.org>
@ 2009-09-20  4:01   ` Tim X
  2009-09-20  5:22     ` Wang Lei
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Tim X @ 2009-09-20  4:01 UTC (permalink / raw)
  To: help-gnu-emacs

Andreas Politz <politza@fh-trier.de> writes:

> Harry Putnam <reader@newsguy.com> writes:
>
>> I see too much output on google that looks very complex when I try to
>> delve into folding code in emacs.
>>
>> Is it horribly complicated?
>>
>> I know some windows editors or ide's do such folding very
>> quickly... but I'm not going to do my coding on windows.  I'm far to
>> comfortable on linux or opensolaris, but I would really like to have
>> the ability to fold/unfold code as needed, quickly and easily.
>
> M-x outline-minor-mode RET
> C-c @ C-t
>
> For a start...
>

I personally find outline of limited use when it comes to folding
code. However, there are a few folding modes out there (check the emacs
wiki). I use an old mode called folding.el (which is bundled in the
emacs-goodies debian package. It works quite well, is easy to install
and provides good functionality. 
>
>Tim


-- 
tcross (at) rapttech dot com dot au


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

* Re: How to expertly fold perl or other scripting code.
  2009-09-20  4:01   ` Tim X
@ 2009-09-20  5:22     ` Wang Lei
  2009-09-20 16:36     ` Harry Putnam
       [not found]     ` <mailman.7099.1253464623.2239.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 9+ messages in thread
From: Wang Lei @ 2009-09-20  5:22 UTC (permalink / raw)
  To: help-gnu-emacs

On 9/20/09, Tim X <timx@nospam.dev.null> wrote:
> Andreas Politz <politza@fh-trier.de> writes:
>
>> Harry Putnam <reader@newsguy.com> writes:
>>
>>> I see too much output on google that looks very complex when I try to
>>> delve into folding code in emacs.
>>>
>>> Is it horribly complicated?
>>>
>>> I know some windows editors or ide's do such folding very
>>> quickly... but I'm not going to do my coding on windows.  I'm far to
>>> comfortable on linux or opensolaris, but I would really like to have
>>> the ability to fold/unfold code as needed, quickly and easily.
>>
>> M-x outline-minor-mode RET
>> C-c @ C-t
>>
>> For a start...
>>
>
> I personally find outline of limited use when it comes to folding
> code. However, there are a few folding modes out there (check the emacs
> wiki). I use an old mode called folding.el (which is bundled in the
> emacs-goodies debian package. It works quite well, is easy to install
> and provides good functionality.
>>
>>Tim
>
>
> --
> tcross (at) rapttech dot com dot au
>
After reading these from folding.el, I decided to use hs-minor-mode.

;;
;;      Please note, that the maintainers do not recommend to use only
;;      folding for you your code layout and navigation. Folding.el is
;;      on its best when it can "chunk" large sections of code inside
;;      folds. The larger the chunks, the more the usability of
;;      folding will increase. Folding.el is not meant to hide
;;      individual functions: you may be better served by hideshow.el
;;      or imenu.el (which can parse the function indexes)



-- 
Regards,
Lei




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

* Re: How to expertly fold perl or other scripting code.
  2009-09-20  4:01   ` Tim X
  2009-09-20  5:22     ` Wang Lei
@ 2009-09-20 16:36     ` Harry Putnam
       [not found]     ` <mailman.7099.1253464623.2239.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 9+ messages in thread
From: Harry Putnam @ 2009-09-20 16:36 UTC (permalink / raw)
  To: help-gnu-emacs

Tim X <timx@nospam.dev.null> writes:

> I personally find outline of limited use when it comes to folding
> code. However, there are a few folding modes out there (check the emacs
> wiki). I use an old mode called folding.el (which is bundled in the
> emacs-goodies debian package. It works quite well, is easy to install
> and provides good functionality. 

Tim, does it byte-compile with emacs 23? for you.

I get what looks like some errors that will require editing.
When byte-compiling the version offered at the wiki you cite:

http://git.savannah.gnu.org/cgit/emacs-tiny-tools.git/tree/lisp/other/folding.el?h=devel

Maybe the debian pkg has an edited version?
=====     *     =====     *     =====     *     =====
 
In folding-install-keymaps:
folding.el:2360:8:Warning: `mapcar' called for effect; use `mapc' or `dolist'
    instead

In folding-event-posn:
folding.el:2669:7:Warning: `error' called with 1 args to fill 0 format
    field(s)
folding.el:2671:5:Warning: `error' called with 1 args to fill 0 format
    field(s)

In folding-is-hooked:
folding.el:2702:39:Warning: `write-file-hooks' is an obsolete variable (as of
    Emacs 22.1); use `write-file-functions' instead.
folding.el:2703:39:Warning: `find-file-hooks' is an obsolete variable (as of
    Emacs 22.1); use `find-file-hook' instead.

In folding-install-hooks:
folding.el:2718:38:Warning: `write-file-hooks' is an obsolete variable (as of
    Emacs 22.1); use `write-file-functions' instead.

In folding-mode-add-find-file-hook:
folding.el:2996:37:Warning: `find-file-hooks' is an obsolete variable (as of
    Emacs 22.1); use `find-file-hook' instead.





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

* Re: How to expertly fold perl or other scripting code.
  2009-09-20  1:44   ` Bernardo
@ 2009-09-20 17:24     ` Harry Putnam
  2009-09-20 22:31       ` Wang Lei
  0 siblings, 1 reply; 9+ messages in thread
From: Harry Putnam @ 2009-09-20 17:24 UTC (permalink / raw)
  To: help-gnu-emacs

[...]

Andreas wrote:
>> M-x outline-minor-mode RET
>> C-c @ C-t
>>
>> For a start...

Bernardo replied:
> i never investigated what is the difference between outline-minor-mode
> and hs-minor-mode but the later is also a possibility
>
> (they seem to be defined in different files but the commands have the
> same prefix key, C-c @)

TimX replied:

[...]

>> I personally find outline of limited use when it comes to folding
>> code. However, there are a few folding modes out there (check the emacs
>> wiki). I use an old mode called folding.el (which is bundled in the
>> emacs-goodies debian package. It works quite well, is easy to install
>> and provides good functionality.
>>>
>>>Tim

Wang replied:
> After reading these from folding.el, I decided to use hs-minor-mode.
>
> ;;
> ;;      Please note, that the maintainers do not recommend to use only
> ;;      folding for you your code layout and navigation. Folding.el is
> ;;      on its best when it can "chunk" large sections of code inside
> ;;      folds. The larger the chunks, the more the usability of
> ;;      folding will increase. Folding.el is not meant to hide
> ;;      individual functions: you may be better served by hideshow.el
> ;;      or imenu.el (which can parse the function indexes)

Good input... thanks.

hs-minor-mode, on first blush looks to be what I'm after. However I've
been unable to byte-compile folding.el offered on emacs-wiki... so
once I've got it to byte-compile... I might like it better... but for
now hs-minor-mode seems to do what I had in mind.

Especially after changing a couple of those really awkward keybindings
with `@' in the middle.

Changing: C-c @ c-s  to C-c s  (hs-show-block)
          C-c @ c-h  to C-c h  (hs-hide-block)

Seems not to collide with anything when in cperl-mode at least.
Buy maybe it will be a problem somewhere else.





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

* Re: How to expertly fold perl or other scripting code.
  2009-09-20 17:24     ` Harry Putnam
@ 2009-09-20 22:31       ` Wang Lei
  0 siblings, 0 replies; 9+ messages in thread
From: Wang Lei @ 2009-09-20 22:31 UTC (permalink / raw)
  To: Harry Putnam; +Cc: help-gnu-emacs

On 9/21/09, Harry Putnam <reader@newsguy.com> wrote:
> [...]
>
> Changing: C-c @ c-s  to C-c s  (hs-show-block)
>           C-c @ c-h  to C-c h  (hs-hide-block)
>
> Seems not to collide with anything when in cperl-mode at least.
> Buy maybe it will be a problem somewhere else.
>
I use these key too.
  (define-key hs-minor-mode-map [?\C-c ?h] 'hs-hide-block)
  (define-key hs-minor-mode-map [?\C-c ?s] 'hs-show-block)
  (define-key hs-minor-mode-map [?\C-c ?\C-\M-h] 'hs-hide-all)
  (define-key hs-minor-mode-map [?\C-c ?\C-\M-s] 'hs-show-all)

-- 
Regards,
Lei




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

* Re: How to expertly fold perl or other scripting code.
       [not found]     ` <mailman.7099.1253464623.2239.help-gnu-emacs@gnu.org>
@ 2009-09-21  7:51       ` Tim X
  0 siblings, 0 replies; 9+ messages in thread
From: Tim X @ 2009-09-21  7:51 UTC (permalink / raw)
  To: help-gnu-emacs

Harry Putnam <reader@newsguy.com> writes:

> Tim X <timx@nospam.dev.null> writes:
>
>> I personally find outline of limited use when it comes to folding
>> code. However, there are a few folding modes out there (check the emacs
>> wiki). I use an old mode called folding.el (which is bundled in the
>> emacs-goodies debian package. It works quite well, is easy to install
>> and provides good functionality. 
>
> Tim, does it byte-compile with emacs 23? for you.
>
> I get what looks like some errors that will require editing.
> When byte-compiling the version offered at the wiki you cite:
>
> http://git.savannah.gnu.org/cgit/emacs-tiny-tools.git/tree/lisp/other/folding.el?h=devel
>
> Maybe the debian pkg has an edited version?
> =====     *     =====     *     =====     *     =====
>  
> In folding-install-keymaps:
> folding.el:2360:8:Warning: `mapcar' called for effect; use `mapc' or `dolist'
>     instead
>
> In folding-event-posn:
> folding.el:2669:7:Warning: `error' called with 1 args to fill 0 format
>     field(s)
> folding.el:2671:5:Warning: `error' called with 1 args to fill 0 format
>     field(s)
>
> In folding-is-hooked:
> folding.el:2702:39:Warning: `write-file-hooks' is an obsolete variable (as of
>     Emacs 22.1); use `write-file-functions' instead.
> folding.el:2703:39:Warning: `find-file-hooks' is an obsolete variable (as of
>     Emacs 22.1); use `find-file-hook' instead.
>
> In folding-install-hooks:
> folding.el:2718:38:Warning: `write-file-hooks' is an obsolete variable (as of
>     Emacs 22.1); use `write-file-functions' instead.
>
> In folding-mode-add-find-file-hook:
> folding.el:2996:37:Warning: `find-file-hooks' is an obsolete variable (as of
>     Emacs 22.1); use `find-file-hook' instead.

Hi Harry,

to be honest, I have no idea. The package is automatically built when
you install it and I've not looked at the compile output. It seems to
work. 

Note that there are at least three packages called folding.el. The one
use is an old one that has ben around for a while (last update I think
was in 2004). There were other versions that attempted to update how
the package owrked using 'newer' emacs features. 

I'll try to look and see what version info I can find in the source
file.

Not sure how many of those 'warnings' are a real issue. The ones about
obsolete versions of functions can be ignored. The ones concerning wrong
number of arguments may be a concern. 


Tim
>

-- 
tcross (at) rapttech dot com dot au


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

end of thread, other threads:[~2009-09-21  7:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-19 21:58 How to expertly fold perl or other scripting code Harry Putnam
2009-09-19 23:16 ` Andreas Politz
2009-09-20  1:44   ` Bernardo
2009-09-20 17:24     ` Harry Putnam
2009-09-20 22:31       ` Wang Lei
     [not found] ` <mailman.7073.1253402286.2239.help-gnu-emacs@gnu.org>
2009-09-20  4:01   ` Tim X
2009-09-20  5:22     ` Wang Lei
2009-09-20 16:36     ` Harry Putnam
     [not found]     ` <mailman.7099.1253464623.2239.help-gnu-emacs@gnu.org>
2009-09-21  7:51       ` Tim X

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.