unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Hide text
@ 2004-02-21 15:57 Fredrik Andersson
  2004-02-21 16:51 ` Roodwriter
  2004-02-21 18:14 ` Benjamin Rutt
  0 siblings, 2 replies; 4+ messages in thread
From: Fredrik Andersson @ 2004-02-21 15:57 UTC (permalink / raw)


I wonder if it is possible to hide part of text in Emacs?
I would like to compress/expand the text inside a subroutine. 

Before  compression:
--------------------
Function name(a,var z:boolean):Boolean;
Var
 x:Real;
 z:Bollean;
BEGIN
 x:=4;
 z:=True;
END;

After compression:
------------------
Function name(a,var z:boolean):Boolean;


Thanks in advance
Fredrik Andersson

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

* Re: Hide text
  2004-02-21 15:57 Hide text Fredrik Andersson
@ 2004-02-21 16:51 ` Roodwriter
  2004-02-21 18:14 ` Benjamin Rutt
  1 sibling, 0 replies; 4+ messages in thread
From: Roodwriter @ 2004-02-21 16:51 UTC (permalink / raw)


Fredrik Andersson wrote:

> I wonder if it is possible to hide part of text in Emacs?
> I would like to compress/expand the text inside a subroutine.
> 
> Before  compression:
> --------------------
> Function name(a,var z:boolean):Boolean;
> Var
>  x:Real;
>  z:Bollean;
> BEGIN
>  x:=4;
>  z:=True;
> END;
> 
> After compression:
> ------------------
> Function name(a,var z:boolean):Boolean;
> 
> 
> Thanks in advance
> Fredrik Andersson

If you're talking about just hiding text you can use the "narrow" function. 
You highlight a region, type C-x n n and everything not highlighted 
disappears. To bring everything back you "widen" it with C-x n w.

It can be handy to confine a macro or search to just a certain area. It 
might also be good if you worked in an office where people could look over 
your shoulder at privileged information.

I've found it's a little bit fragile. Sometimes it will widen all by itself 
so I always check the mode line when I'm about to do something radical.

--Rod

__________

Author of "Linux for Non-Geeks--Clear-eyed Answers for Practical Consumers" 
and "Boring Stories from Uncle Rod." Both are available at 
http://www.rodwriterpublishing.com/index.html

To reply by e-mail, take the extra "o" out of the name.

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

* Re: Hide text
  2004-02-21 15:57 Hide text Fredrik Andersson
  2004-02-21 16:51 ` Roodwriter
@ 2004-02-21 18:14 ` Benjamin Rutt
  2004-02-22  2:47   ` Brad Collins
  1 sibling, 1 reply; 4+ messages in thread
From: Benjamin Rutt @ 2004-02-21 18:14 UTC (permalink / raw)


nybban@telia.com (Fredrik Andersson) writes:

> I wonder if it is possible to hide part of text in Emacs?
> I would like to compress/expand the text inside a subroutine. 
>
> Before  compression:
> --------------------
> Function name(a,var z:boolean):Boolean;
> Var
>  x:Real;
>  z:Bollean;
> BEGIN
>  x:=4;
>  z:=True;
> END;
>
> After compression:
> ------------------
> Function name(a,var z:boolean):Boolean;

If all you have in the file are functions, try enabling
outline-minor-mode, and customizing the buffer-local variable
outline-regexp to match your function name.  The idea is that you'd
match the function signature as a top-level outline header.

Maybe something like:

(setq outline-regexp "Function [a-z]+(.*):.*;$")

Then, try M-x hide-subtree on the function name line, and it will hide
the text between that line and the next function.
-- 
Benjamin

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

* Re: Hide text
  2004-02-21 18:14 ` Benjamin Rutt
@ 2004-02-22  2:47   ` Brad Collins
  0 siblings, 0 replies; 4+ messages in thread
From: Brad Collins @ 2004-02-22  2:47 UTC (permalink / raw)




  The Emacs Wiki has some good examples on how to do this, and check
out the elisp manual for making text invisiable.

  http://www.emacswiki.org/cgi-bin/wiki

  I've had very mixed results in doing this.  It doesn't always work
  the way you intend.

b/

--
Brad Collins
Chenla Labs
Bangkok, Thailand

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

end of thread, other threads:[~2004-02-22  2:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-21 15:57 Hide text Fredrik Andersson
2004-02-21 16:51 ` Roodwriter
2004-02-21 18:14 ` Benjamin Rutt
2004-02-22  2:47   ` Brad Collins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).