unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: multi-region.el --- Mapping commands over multiple active regions.
       [not found] <?fnord?871xcp586t.fsf@ID-97657.usr.dfncis.de>
@ 2006-01-02 15:03 ` Richard M. Stallman
  2006-01-02 16:28   ` Stefan Monnier
  2006-01-07  9:58   ` Mathias Dahl
  0 siblings, 2 replies; 8+ messages in thread
From: Richard M. Stallman @ 2006-01-02 15:03 UTC (permalink / raw)
  Cc: emacs-devel

I was going through old mail and came across your posting
of multi-region.el, last January.

Can someone imagine a way to integrate this into Emacs, so that
ordinary Emacs commands, which now operate on the region, could
operate on multi-regions when the user has specified multiple regions?

Here's one idea.  Suppose that region-beginning returned a list of
region beginnings, and region-end returned a list of region ends.
That would be a clean way to tell a command that there are
multi-regions in effect.

This could be done for (interactive "R"), whereas use
of (interactive "r") would simply repeat the command on each
sub-region in the list.

Now is not the time to install such a change, but we could think about
it now.

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

* Re: multi-region.el --- Mapping commands over multiple active regions.
  2006-01-02 15:03 ` multi-region.el --- Mapping commands over multiple active regions Richard M. Stallman
@ 2006-01-02 16:28   ` Stefan Monnier
  2006-01-03 16:26     ` Richard M. Stallman
  2006-01-07  9:58   ` Mathias Dahl
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2006-01-02 16:28 UTC (permalink / raw)
  Cc: Lawrence Mitchell, emacs-devel

> Here's one idea.  Suppose that region-beginning returned a list of
> region beginnings, and region-end returned a list of region ends.
> That would be a clean way to tell a command that there are
> multi-regions in effect.

> This could be done for (interactive "R"), whereas use
> of (interactive "r") would simply repeat the command on each
> sub-region in the list.

I completely agree.  As a matter of fact I suggested something along the
same lines some years ago on gnu.emacs.help (I especially remember the
(interative "r") automatically looping over all the sub-regions).


        Stefan

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

* Re: multi-region.el --- Mapping commands over multiple active regions.
  2006-01-02 16:28   ` Stefan Monnier
@ 2006-01-03 16:26     ` Richard M. Stallman
  0 siblings, 0 replies; 8+ messages in thread
From: Richard M. Stallman @ 2006-01-03 16:26 UTC (permalink / raw)
  Cc: wence, emacs-devel

    I completely agree.  As a matter of fact I suggested something along the
    same lines some years ago on gnu.emacs.help (I especially remember the
    (interative "r") automatically looping over all the sub-regions).

Would you be interested in working on implementing something
for later installation?

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

* Re: multi-region.el --- Mapping commands over multiple active regions.
  2006-01-02 15:03 ` multi-region.el --- Mapping commands over multiple active regions Richard M. Stallman
  2006-01-02 16:28   ` Stefan Monnier
@ 2006-01-07  9:58   ` Mathias Dahl
  2006-01-08 14:47     ` Richard M. Stallman
  1 sibling, 1 reply; 8+ messages in thread
From: Mathias Dahl @ 2006-01-07  9:58 UTC (permalink / raw)


"Richard M. Stallman" <rms@gnu.org> writes:

> Here's one idea.  Suppose that region-beginning returned a list of
> region beginnings, and region-end returned a list of region ends.
> That would be a clean way to tell a command that there are
> multi-regions in effect.

Could there be risk here?

Suppose I have three regions:

r1: 10 to 20

r2: 30 to 40

r3: 50 to 60

If I understand your suggestion, `region-beginning' and `region-end',
respectively, would return the following values:

 (region-beginning) => (10 30 50)

 (region-end) => (20 40 60)

Could I, as a programmer, trust that the ordering of those values are
always in sync?

Maybe these functions are only helper functions, and when I need the
*real* end of a region, I will ask for it explicitly using the
beginning of the region as argument?

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

* Re: multi-region.el --- Mapping commands over multiple active regions.
  2006-01-07  9:58   ` Mathias Dahl
@ 2006-01-08 14:47     ` Richard M. Stallman
  2006-01-09 11:27       ` Kim F. Storm
  2006-01-09 12:47       ` Mathias Dahl
  0 siblings, 2 replies; 8+ messages in thread
From: Richard M. Stallman @ 2006-01-08 14:47 UTC (permalink / raw)
  Cc: emacs-devel

     (region-beginning) => (10 30 50)

     (region-end) => (20 40 60)

    Could I, as a programmer, trust that the ordering of those values are
    always in sync?

Sure, if you don't change anything between one call and the other.
They would both operate from the same data structure.

    Maybe these functions are only helper functions, and when I need the
    *real* end of a region, I will ask for it explicitly using the
    beginning of the region as argument?

Sorry, I do not understand the issue or the scenario.

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

* Re: multi-region.el --- Mapping commands over multiple active regions.
  2006-01-08 14:47     ` Richard M. Stallman
@ 2006-01-09 11:27       ` Kim F. Storm
  2006-01-09 21:35         ` Richard M. Stallman
  2006-01-09 12:47       ` Mathias Dahl
  1 sibling, 1 reply; 8+ messages in thread
From: Kim F. Storm @ 2006-01-09 11:27 UTC (permalink / raw)
  Cc: emacs-devel, Mathias Dahl

"Richard M. Stallman" <rms@gnu.org> writes:

>      (region-beginning) => (10 30 50)
>
>      (region-end) => (20 40 60)
>
>     Could I, as a programmer, trust that the ordering of those values are
>     always in sync?
>
> Sure, if you don't change anything between one call and the other.
> They would both operate from the same data structure.

Shouldn't those start/end positions be markers rather than simple numbers?
E.g. so that "delete-region" on a multi-region would work correctly...

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: multi-region.el --- Mapping commands over multiple active regions.
  2006-01-08 14:47     ` Richard M. Stallman
  2006-01-09 11:27       ` Kim F. Storm
@ 2006-01-09 12:47       ` Mathias Dahl
  1 sibling, 0 replies; 8+ messages in thread
From: Mathias Dahl @ 2006-01-09 12:47 UTC (permalink / raw)


"Richard M. Stallman" <rms@gnu.org> writes:

> Sure, if you don't change anything between one call and the other.
> They would both operate from the same data structure.
> ...
> 
>     Maybe these functions are only helper functions, and when I need the
>     *real* end of a region, I will ask for it explicitly using the
>     beginning of the region as argument?
>
> Sorry, I do not understand the issue or the scenario.

I cannot explain it better than that. I just got a bad feeling,
sorry. It's probably just me. :)

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

* Re: multi-region.el --- Mapping commands over multiple active regions.
  2006-01-09 11:27       ` Kim F. Storm
@ 2006-01-09 21:35         ` Richard M. Stallman
  0 siblings, 0 replies; 8+ messages in thread
From: Richard M. Stallman @ 2006-01-09 21:35 UTC (permalink / raw)
  Cc: brakjoller, emacs-devel

    Shouldn't those start/end positions be markers rather than simple numbers?

The underlying mechanism should use markers, so that they relocate.
And it makes sense to have a way to get at those markers themselves.
Perhaps that is the only interface we need.

We can work out those details as part of designing the feature,
if and when we do.]

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

end of thread, other threads:[~2006-01-09 21:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <?fnord?871xcp586t.fsf@ID-97657.usr.dfncis.de>
2006-01-02 15:03 ` multi-region.el --- Mapping commands over multiple active regions Richard M. Stallman
2006-01-02 16:28   ` Stefan Monnier
2006-01-03 16:26     ` Richard M. Stallman
2006-01-07  9:58   ` Mathias Dahl
2006-01-08 14:47     ` Richard M. Stallman
2006-01-09 11:27       ` Kim F. Storm
2006-01-09 21:35         ` Richard M. Stallman
2006-01-09 12:47       ` Mathias Dahl

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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