help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Narrowing to non-adjacent regions


From: Andreas Röhler
Subject: Re: Narrowing to non-adjacent regions
Date: Fri, 1 Feb 2008 20:00:33 +0100
User-agent: KMail/1.9.5

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]