all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to auto hide all functions when open a source file
@ 2008-05-10 13:25 Ke Lu
  2008-05-11 20:52 ` Colin S. Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Ke Lu @ 2008-05-10 13:25 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I use emacs to edit c/c++/java/php files.
Is there any way to auto hide all functions when I open  a source file.
For example,It hope it looks like
Class XXX {
   var v1 = "a";
   var v2 = "b";

   function f1 ..
   function f2 ..

}
I would like it can automatic be done,not by  hs-hide-block,etc.



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

* Re: How to auto hide all functions when open a source file
  2008-05-10 13:25 How to auto hide all functions when open a source file Ke Lu
@ 2008-05-11 20:52 ` Colin S. Miller
  2008-05-22 16:16   ` Thien-Thi Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Colin S. Miller @ 2008-05-11 20:52 UTC (permalink / raw)
  To: help-gnu-emacs

Ke Lu wrote:
> Hi,
> 
> I use emacs to edit c/c++/java/php files.
> Is there any way to auto hide all functions when I open  a source file.
> For example,It hope it looks like
> Class XXX {
>    var v1 = "a";
>    var v2 = "b";
> 
>    function f1 ..
>    function f2 ..
> 
> }
> I would like it can automatic be done,not by  hs-hide-block,etc.
> 
Adding this code snippit to your .emacs .

(add-hook 'hs-minor-mode-hook '(lambda () (hs-hide-all)))

will do an auto hs-hide-all when you open a file that uses hs-minor-mode.
However, it will also hide the classes' bodies, as well as any inline code.

There might be a way to stop the hiding of the bodies, but I'm not sure what it is.

HTH,
Colin S. Miller


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

* Re: How to auto hide all functions when open a source file
  2008-05-11 20:52 ` Colin S. Miller
@ 2008-05-22 16:16   ` Thien-Thi Nguyen
  0 siblings, 0 replies; 3+ messages in thread
From: Thien-Thi Nguyen @ 2008-05-22 16:16 UTC (permalink / raw)
  To: help-gnu-emacs

() "Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk>
() Sun, 11 May 2008 21:52:23 +0100

   (add-hook 'hs-minor-mode-hook '(lambda () (hs-hide-all)))

The hideshow.el commentary sez:

;; Some languages (e.g., Java) are deeply nested, so the normal behavior
;; of `hs-hide-all' (hiding all but top-level blocks) results in very
;; little information shown, which is not very useful.  You can use the
;; variable `hs-hide-all-non-comment-function' to implement your idea of
;; what is more useful.  For example, the following code shows the next
;; nested level in addition to the top-level:
;;
;;   (defun ttn-hs-hide-level-1 ()
;;     (hs-hide-level 1)
;;     (forward-sexp 1))
;;   (setq hs-hide-all-non-comment-function 'ttn-hs-hide-level-1)

This was suggested a hideshow user; i haven't tested it personally.

thi




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

end of thread, other threads:[~2008-05-22 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-10 13:25 How to auto hide all functions when open a source file Ke Lu
2008-05-11 20:52 ` Colin S. Miller
2008-05-22 16:16   ` Thien-Thi Nguyen

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.