unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Narrowing to non-adjacent regions
@ 2008-01-30 19:42 davidjneu@gmail.com
  2008-02-01 14:27 ` Andreas Röhler
  2008-02-01 19:00 ` Andreas Röhler
  0 siblings, 2 replies; 6+ messages in thread
From: davidjneu@gmail.com @ 2008-01-30 19:42 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

Hi, I'm wondering if it's possible to narrow a buffer so that multiple
non-adjacent
regions are displayed.

The code snippet below doesn't work, but conveys what I'm looking for.

Many thanks!

Cheers,
David

(defun narrow-two ()
  (interactive "*")
  (widen)
  (goto-char (point-min))
  (let ((start-1 (point))
	(end-1 (progn (next-line 5) (point)))
	(start-2 (progn (next-line 7) (point)))
	(end-2 (progn (end-of-buffer) (point))))
  (narrow-to-region start-1 end-1)
  (narrow-to-region start-2 end-2)))

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

* Re: Narrowing to non-adjacent regions
  2008-01-30 19:42 Narrowing to non-adjacent regions davidjneu@gmail.com
@ 2008-02-01 14:27 ` Andreas Röhler
  2008-02-01 14:39   ` Lennart Borgman (gmail)
  2008-02-01 19:00 ` Andreas Röhler
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Röhler @ 2008-02-01 14:27 UTC (permalink / raw)
  To: help-gnu-emacs

Am Mittwoch, 30. Januar 2008 20:42 schrieb davidjneu@gmail.com:
> Hi,
>
> Hi, I'm wondering if it's possible to narrow a buffer so that multiple
> non-adjacent
> regions are displayed.
>
> The code snippet below doesn't work, but conveys what I'm looking for.
>
> Many thanks!
>
> Cheers,
> David
>
> (defun narrow-two ()
>   (interactive "*")
>   (widen)
>   (goto-char (point-min))
>   (let ((start-1 (point))
> 	(end-1 (progn (next-line 5) (point)))
> 	(start-2 (progn (next-line 7) (point)))
> 	(end-2 (progn (end-of-buffer) (point))))
>   (narrow-to-region start-1 end-1)
>   (narrow-to-region start-2 end-2)))
> _______________________________________________

As GNU Emacs enables only a single region at time
AFAIK, you'll need another tool to do this.

Already exists block.el, look, if it is suitable.

Once several blocks are known, set the remaining chars
to invisible. Maybe block.el delivers that already.

HTH

Andreas Röhler




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

* Re: Narrowing to non-adjacent regions
  2008-02-01 14:27 ` Andreas Röhler
@ 2008-02-01 14:39   ` Lennart Borgman (gmail)
  2008-02-01 16:58     ` Andreas Röhler
  2008-02-01 18:51     ` Andreas Röhler
  0 siblings, 2 replies; 6+ messages in thread
From: Lennart Borgman (gmail) @ 2008-02-01 14:39 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs

Andreas Röhler wrote:
> Already exists block.el, look, if it is suitable.

It does? Where?

> Once several blocks are known, set the remaining chars
> to invisible. Maybe block.el delivers that already.
> 
> HTH
> 
> Andreas Röhler
> 
> 
> 




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

* Re: Narrowing to non-adjacent regions
  2008-02-01 14:39   ` Lennart Borgman (gmail)
@ 2008-02-01 16:58     ` Andreas Röhler
  2008-02-01 18:51     ` Andreas Röhler
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Röhler @ 2008-02-01 16:58 UTC (permalink / raw)
  To: help-gnu-emacs

Am Freitag, 1. Februar 2008 15:39 schrieb Lennart Borgman (gmail):
> Andreas Röhler wrote:
> > Already exists block.el, look, if it is suitable.
>
> It does? Where?
>
> > Once several blocks are known, set the remaining chars
> > to invisible. Maybe block.el delivers that already.
> >
> > HTH
> >
> > Andreas Röhler
http://www.mathematik.uni-wuerzburg.de/~vaeth/download/mv_emacs.zip




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

* Re: Narrowing to non-adjacent regions
  2008-02-01 14:39   ` Lennart Borgman (gmail)
  2008-02-01 16:58     ` Andreas Röhler
@ 2008-02-01 18:51     ` Andreas Röhler
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Röhler @ 2008-02-01 18:51 UTC (permalink / raw)
  To: help-gnu-emacs

Am Freitag, 1. Februar 2008 15:39 schrieb Lennart Borgman (gmail):
> Andreas Röhler wrote:
> > Already exists block.el, look, if it is suitable.
>
> It does? Where?
>
> > Once several blocks are known, set the remaining chars
> > to invisible. Maybe block.el delivers that already.
> >
> > HTH
> >
> > Andreas Röhler



Just had a look into block.el after some times and see:
,----
| ;; 2. There is only one block for all buffers.
`----

That means, developing went in the opposite direction.

Nonetheless I think this might deliver a starting
point: Once a block is stored independently from unique
region, with some changes you may enable storing more
of them.

Andreas Röhler




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

* Re: Narrowing to non-adjacent regions
  2008-01-30 19:42 Narrowing to non-adjacent regions davidjneu@gmail.com
  2008-02-01 14:27 ` Andreas Röhler
@ 2008-02-01 19:00 ` Andreas Röhler
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Röhler @ 2008-02-01 19:00 UTC (permalink / raw)
  To: help-gnu-emacs

Am Mittwoch, 30. Januar 2008 20:42 schrieb davidjneu@gmail.com:
> Hi,
>
> Hi, I'm wondering if it's possible to narrow a buffer so that multiple
> non-adjacent
> regions are displayed.
>
> The code snippet below doesn't work, but conveys what I'm looking for.
>
> Many thanks!
>
> Cheers,
> David
>
> (defun narrow-two ()
>   (interactive "*")
>   (widen)
>   (goto-char (point-min))
>   (let ((start-1 (point))
> 	(end-1 (progn (next-line 5) (point)))
> 	(start-2 (progn (next-line 7) (point)))
> 	(end-2 (progn (end-of-buffer) (point))))
>   (narrow-to-region start-1 end-1)
>   (narrow-to-region start-2 end-2)))
> _______________________________________________


here is multi-region.el

working right out of the box.

http://www.ph.ed.ac.uk/~s0198183/multi-region.el

It comes with a command

,----
| (defun multi-region-execute-command (&optional arg cmd)
|   "Perform a command on all active multi-regions.
`----

Remains just to revert that, making it work at all
non-active parts.

Andreas Röhler




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

end of thread, other threads:[~2008-02-01 19:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 19:42 Narrowing to non-adjacent regions davidjneu@gmail.com
2008-02-01 14:27 ` Andreas Röhler
2008-02-01 14:39   ` Lennart Borgman (gmail)
2008-02-01 16:58     ` Andreas Röhler
2008-02-01 18:51     ` Andreas Röhler
2008-02-01 19:00 ` Andreas Röhler

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