unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Narrow: How to hide a specific part?
@ 2013-06-10 12:03 Marius Hofert
  2013-06-10 12:59 ` daniel
  0 siblings, 1 reply; 8+ messages in thread
From: Marius Hofert @ 2013-06-10 12:03 UTC (permalink / raw)
  To: Emacs help

Hi,

I recently discovered narrowing (C-x n n). Say I have three
consecutive paragraphs...

A
B
C

... and I want to hide the 'middle' one, that is, B, while keeping A
and C visible. Can this be done with narrowing? (or in any similar
way?). As far as I know, with narrowing, I can only narrow down to A
or C but can't make them both visible simultaneously.

Cheers,

Marius



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

* Re: Narrow: How to hide a specific part?
  2013-06-10 12:03 Narrow: How to hide a specific part? Marius Hofert
@ 2013-06-10 12:59 ` daniel
  2013-06-10 13:18   ` Marius Hofert
  0 siblings, 1 reply; 8+ messages in thread
From: daniel @ 2013-06-10 12:59 UTC (permalink / raw)
  To: Marius Hofert; +Cc: Emacs help

You could create an overlay in the B area and make it invisible, I think...
I did that one time.

But most emacs function, like search, will continue to see the hidden part.


2013/6/10 Marius Hofert <marius.hofert@math.ethz.ch>

> Hi,
>
> I recently discovered narrowing (C-x n n). Say I have three
> consecutive paragraphs...
>
> A
> B
> C
>
> ... and I want to hide the 'middle' one, that is, B, while keeping A
> and C visible. Can this be done with narrowing? (or in any similar
> way?). As far as I know, with narrowing, I can only narrow down to A
> or C but can't make them both visible simultaneously.
>
> Cheers,
>
> Marius
>
>


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

* Re: Narrow: How to hide a specific part?
  2013-06-10 12:59 ` daniel
@ 2013-06-10 13:18   ` Marius Hofert
  2013-06-10 13:43     ` daniel
  0 siblings, 1 reply; 8+ messages in thread
From: Marius Hofert @ 2013-06-10 13:18 UTC (permalink / raw)
  To: daniel, help-gnu-emacs

Hi Daniel,

Thanks for your quick reply.

You mean selecting B? But how do you make it invisible? AFAIK,
narrowing only makes regions visible, not invisible (?)

Cheers,

Marius

On Mon, Jun 10, 2013 at 2:59 PM, daniel <idnael@gmail.com> wrote:
> You could create an overlay in the B area and make it invisible, I think...
> I did that one time.
>
> But most emacs function, like search, will continue to see the hidden part.
>
>
> 2013/6/10 Marius Hofert <marius.hofert@math.ethz.ch>
>>
>> Hi,
>>
>> I recently discovered narrowing (C-x n n). Say I have three
>> consecutive paragraphs...
>>
>> A
>> B
>> C
>>
>> ... and I want to hide the 'middle' one, that is, B, while keeping A
>> and C visible. Can this be done with narrowing? (or in any similar
>> way?). As far as I know, with narrowing, I can only narrow down to A
>> or C but can't make them both visible simultaneously.
>>
>> Cheers,
>>
>> Marius
>>
>



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

* Re: Narrow: How to hide a specific part?
  2013-06-10 13:18   ` Marius Hofert
@ 2013-06-10 13:43     ` daniel
  2013-06-10 13:48       ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: daniel @ 2013-06-10 13:43 UTC (permalink / raw)
  To: Marius Hofert; +Cc: help-gnu-emacs@gnu.org

hi! that was an elisp programming answear, not an user answear!

But you can load this elisp and then use functions hide-region and
unhide-region


(defun hide-region ()
  (interactive)
  (setq ov (make-overlay (region-beginning) (region-end)))
  (overlay-put ov 'invisible t)
  (overlay-put ov 'my-overlay t)
  )

(defun unhide-region ()
  (interactive)
  (loop for ov in (overlays-in (region-beginning) (region-end))
if (overlay-get ov 'my-overlay)
 do (delete-overlay ov)
)
  )



2013/6/10 Marius Hofert <marius.hofert@math.ethz.ch>

> Hi Daniel,
>
> Thanks for your quick reply.
>
> You mean selecting B? But how do you make it invisible? AFAIK,
> narrowing only makes regions visible, not invisible (?)
>
> Cheers,
>
> Marius
>
> On Mon, Jun 10, 2013 at 2:59 PM, daniel <idnael@gmail.com> wrote:
> > You could create an overlay in the B area and make it invisible, I
> think...
> > I did that one time.
> >
> > But most emacs function, like search, will continue to see the hidden
> part.
> >
> >
> > 2013/6/10 Marius Hofert <marius.hofert@math.ethz.ch>
> >>
> >> Hi,
> >>
> >> I recently discovered narrowing (C-x n n). Say I have three
> >> consecutive paragraphs...
> >>
> >> A
> >> B
> >> C
> >>
> >> ... and I want to hide the 'middle' one, that is, B, while keeping A
> >> and C visible. Can this be done with narrowing? (or in any similar
> >> way?). As far as I know, with narrowing, I can only narrow down to A
> >> or C but can't make them both visible simultaneously.
> >>
> >> Cheers,
> >>
> >> Marius
> >>
> >
>


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

* Re: Narrow: How to hide a specific part?
  2013-06-10 13:43     ` daniel
@ 2013-06-10 13:48       ` Bastien
  2013-06-10 14:46         ` Marius Hofert
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2013-06-10 13:48 UTC (permalink / raw)
  To: daniel; +Cc: help-gnu-emacs@gnu.org, Marius Hofert

daniel <idnael@gmail.com> writes:

> hi! that was an elisp programming answear, not an user answear!

Mhh... deserves a new entry for the Urban Dictionary:

Answear: like an answer, but with the promise that it is true.

  "- Did you cheat on me?
   - What do you think?
   - Don't espace, answear me!"

      -- Harold Pinter, The Lover

(No offense Daniel, of course!)

:)

-- 
 Bastien



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

* Re: Narrow: How to hide a specific part?
  2013-06-10 13:48       ` Bastien
@ 2013-06-10 14:46         ` Marius Hofert
  2013-06-10 15:04           ` daniel
  0 siblings, 1 reply; 8+ messages in thread
From: Marius Hofert @ 2013-06-10 14:46 UTC (permalink / raw)
  To: Bastien; +Cc: help-gnu-emacs@gnu.org, daniel

Hi,

hide-region works, unhide-region does not (no matter whether I first
select the 'hidden region' or not)

Cheers,

Marius

On Mon, Jun 10, 2013 at 3:48 PM, Bastien <bzg@altern.org> wrote:
> daniel <idnael@gmail.com> writes:
>
>> hi! that was an elisp programming answear, not an user answear!
>
> Mhh... deserves a new entry for the Urban Dictionary:
>
> Answear: like an answer, but with the promise that it is true.
>
>   "- Did you cheat on me?
>    - What do you think?
>    - Don't espace, answear me!"
>
>       -- Harold Pinter, The Lover
>
> (No offense Daniel, of course!)
>
> :)
>
> --
>  Bastien



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

* Re: Narrow: How to hide a specific part?
  2013-06-10 14:46         ` Marius Hofert
@ 2013-06-10 15:04           ` daniel
  2013-06-10 15:12             ` Marius Hofert
  0 siblings, 1 reply; 8+ messages in thread
From: daniel @ 2013-06-10 15:04 UTC (permalink / raw)
  To: Marius Hofert; +Cc: Bastien, help-gnu-emacs@gnu.org

2013/6/10 Marius Hofert <marius.hofert@math.ethz.ch>

> Hi,
>
> hide-region works, unhide-region does not (no matter whether I first
> select the 'hidden region' or not)



unhide-region should make visible all the areas that are inside the current
region

Or try this:

(defun unhide-all ()
  (interactive)
  (loop for ov in (overlays-in (point-min) (point-max))
if (overlay-get ov 'my-overlay)
 do (delete-overlay ov)
)
  )


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

* Re: Narrow: How to hide a specific part?
  2013-06-10 15:04           ` daniel
@ 2013-06-10 15:12             ` Marius Hofert
  0 siblings, 0 replies; 8+ messages in thread
From: Marius Hofert @ 2013-06-10 15:12 UTC (permalink / raw)
  To: daniel; +Cc: Bastien, help-gnu-emacs@gnu.org

Okay, thanks a lot!

Cheers,

Marius

On Mon, Jun 10, 2013 at 5:04 PM, daniel <idnael@gmail.com> wrote:
> 2013/6/10 Marius Hofert <marius.hofert@math.ethz.ch>
>>
>> Hi,
>>
>> hide-region works, unhide-region does not (no matter whether I first
>> select the 'hidden region' or not)
>
>
>
> unhide-region should make visible all the areas that are inside the current
> region
>
> Or try this:
>
> (defun unhide-all ()
>   (interactive)
>   (loop for ov in (overlays-in (point-min) (point-max))
> if (overlay-get ov 'my-overlay)
> do (delete-overlay ov)
> )
>   )
>



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

end of thread, other threads:[~2013-06-10 15:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-10 12:03 Narrow: How to hide a specific part? Marius Hofert
2013-06-10 12:59 ` daniel
2013-06-10 13:18   ` Marius Hofert
2013-06-10 13:43     ` daniel
2013-06-10 13:48       ` Bastien
2013-06-10 14:46         ` Marius Hofert
2013-06-10 15:04           ` daniel
2013-06-10 15:12             ` Marius Hofert

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).