unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Rectangular regions
@ 2013-10-30  1:59 Stefan Monnier
  2013-10-30  2:15 ` Dmitry Gutov
                   ` (9 more replies)
  0 siblings, 10 replies; 92+ messages in thread
From: Stefan Monnier @ 2013-10-30  1:59 UTC (permalink / raw)
  To: emacs-devel

I've installed earlier today a patch which adds basic support for
rectangular regions.  The entry point currently is `M-x rectangle-mark'.
Besides making commands aware of rectangular regions (currently only
things like C-w, M-w, C-y, and M-y pay attention to the shape of the
region), I have one main UI issues: provide a key binding for
rectangle-mark.

Maybe we could also push the design a bit further and provide shorter
key-bindings in "rectangular region mode" (no, it's not a mode
currently) to access string-rectangle and open-rectangle, but for now,
the main issue is how to quickly start selecting a rectangle.
I.e. a good key binding for rectangle-mark.

A related issue is to find a mouse-binding for it.


        Stefan



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

* Re: Rectangular regions
  2013-10-30  1:59 Rectangular regions Stefan Monnier
@ 2013-10-30  2:15 ` Dmitry Gutov
  2013-10-30  2:59   ` Stefan Monnier
  2013-10-30  3:22 ` Leo Liu
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 92+ messages in thread
From: Dmitry Gutov @ 2013-10-30  2:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Maybe we could also push the design a bit further and provide shorter
> key-bindings in "rectangular region mode" (no, it's not a mode
> currently) to access string-rectangle and open-rectangle, but for now,
> the main issue is how to quickly start selecting a rectangle.
> I.e. a good key binding for rectangle-mark.

C-RET? cua-mode uses this binding by default for a similar feature (see
`cua-rectangle-mark-key').



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

* Re: Rectangular regions
  2013-10-30  2:15 ` Dmitry Gutov
@ 2013-10-30  2:59   ` Stefan Monnier
  0 siblings, 0 replies; 92+ messages in thread
From: Stefan Monnier @ 2013-10-30  2:59 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

>> Maybe we could also push the design a bit further and provide shorter
>> key-bindings in "rectangular region mode" (no, it's not a mode
>> currently) to access string-rectangle and open-rectangle, but for now,
>> the main issue is how to quickly start selecting a rectangle.
>> I.e. a good key binding for rectangle-mark.
> C-RET? cua-mode uses this binding by default for a similar feature (see
> `cua-rectangle-mark-key').

Hmm... not available on most (all?) ttys (they send the same
byte-sequence for RET and for C-RET).

Also, it's not terribly intuitive/mnemonic (neither the "C-" part, nor
the "RET" part).

Maybe M-+ or M-#?  Not great either, but at least their glyph has a kind
of "rectangle-related shape"?


        Stefan



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

* Re: Rectangular regions
  2013-10-30  1:59 Rectangular regions Stefan Monnier
  2013-10-30  2:15 ` Dmitry Gutov
@ 2013-10-30  3:22 ` Leo Liu
  2013-10-30  3:29   ` Daniel Colascione
                     ` (2 more replies)
  2013-10-30  3:52 ` Eli Zaretskii
                   ` (7 subsequent siblings)
  9 siblings, 3 replies; 92+ messages in thread
From: Leo Liu @ 2013-10-30  3:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 2013-10-30 09:59 +0800, Stefan Monnier wrote:
> Maybe we could also push the design a bit further and provide shorter
> key-bindings in "rectangular region mode" (no, it's not a mode
> currently) to access string-rectangle and open-rectangle, but for now,
> the main issue is how to quickly start selecting a rectangle.
> I.e. a good key binding for rectangle-mark.

Maybe steal M-SPC from just-one-space since it is similar to C-SPC and
works well in gui and tty. We could fold just-one-space into
delete-horizontal-space somehow.

Leo



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

* Re: Rectangular regions
  2013-10-30  3:22 ` Leo Liu
@ 2013-10-30  3:29   ` Daniel Colascione
  2013-10-30 18:09     ` Stefan Monnier
  2013-10-31 20:23     ` Richard Stallman
  2013-10-30  4:55   ` Stephen J. Turnbull
  2013-10-31 13:39   ` Xue Fuqiao
  2 siblings, 2 replies; 92+ messages in thread
From: Daniel Colascione @ 2013-10-30  3:29 UTC (permalink / raw)
  To: Leo Liu, Stefan Monnier; +Cc: emacs-devel

On 10/29/2013 08:22 PM, Leo Liu wrote:
> On 2013-10-30 09:59 +0800, Stefan Monnier wrote:
>> Maybe we could also push the design a bit further and provide shorter
>> key-bindings in "rectangular region mode" (no, it's not a mode
>> currently) to access string-rectangle and open-rectangle, but for now,
>> the main issue is how to quickly start selecting a rectangle.
>> I.e. a good key binding for rectangle-mark.
>
> Maybe steal M-SPC from just-one-space since it is similar to C-SPC and
> works well in gui and tty. We could fold just-one-space into
> delete-horizontal-space somehow.

Good idea. I completely agree. I don't think I've ever deliberately used 
just-one-space; I always go for delete-horizontal-space or 
delete-indentation to cover just-one-space's job. If we do end up using 
M-SPC, though, it'll be important to remind users that they can also run 
the command as ESC SPC (which is convenient enough): many popular window 
managers steal M-SPC for bringing up a window menu.



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

* Re: Rectangular regions
  2013-10-30  1:59 Rectangular regions Stefan Monnier
  2013-10-30  2:15 ` Dmitry Gutov
  2013-10-30  3:22 ` Leo Liu
@ 2013-10-30  3:52 ` Eli Zaretskii
  2013-10-30  4:22   ` Stefan Monnier
  2013-10-31 20:23   ` Richard Stallman
  2013-10-30  3:55 ` Eli Zaretskii
                   ` (6 subsequent siblings)
  9 siblings, 2 replies; 92+ messages in thread
From: Eli Zaretskii @ 2013-10-30  3:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Tue, 29 Oct 2013 21:59:20 -0400
> 
> I've installed earlier today a patch which adds basic support for
> rectangular regions.  The entry point currently is `M-x rectangle-mark'.

What did you mean that to do when the rectangle crosses bidirectional
text?  Currently, the rectangle is "broken".  Similarly when the
rectangle includes characters of different sizes.

IOW, this "rectangle" works in character cell positions in the logical
order.  If this is what you meant, fine (but then it's not really a
rectangle in many use cases).  Otherwise, there's a lot of work yet to
make it a real rectangle.



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

* Re: Rectangular regions
  2013-10-30  1:59 Rectangular regions Stefan Monnier
                   ` (2 preceding siblings ...)
  2013-10-30  3:52 ` Eli Zaretskii
@ 2013-10-30  3:55 ` Eli Zaretskii
  2013-10-30 10:36 ` Bastien
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 92+ messages in thread
From: Eli Zaretskii @ 2013-10-30  3:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Tue, 29 Oct 2013 21:59:20 -0400
> 
> I have one main UI issues: provide a key binding for rectangle-mark.

"C-x SPC" is available, AFAIK.



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

* Re: Rectangular regions
  2013-10-30  3:52 ` Eli Zaretskii
@ 2013-10-30  4:22   ` Stefan Monnier
  2013-10-31 20:23   ` Richard Stallman
  1 sibling, 0 replies; 92+ messages in thread
From: Stefan Monnier @ 2013-10-30  4:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

> "C-x SPC" is available, AFAIK.

Kind of, but it's used for gud-break.

> What did you mean that to do when the rectangle crosses bidirectional
> text?

The same thing that the usual suspects from rect.el do.

> Currently, the rectangle is "broken".  Similarly when the
> rectangle includes characters of different sizes.

Indeed, but that's been the case pretty much every since Emacs-21 added
support for variable-sized characters.  Or even before that in the case
of line-wrapping.  The new code only highlights the "rectangle", but
doesn't attempt to change the definition of that rectangle.

> IOW, this "rectangle" works in character cell positions in the logical
> order.  If this is what you meant, fine (but then it's not really a
> rectangle in many use cases).

Yes, I just wanted to provide "visual access" to the existing
rectangle functionality, since it's been requested many times.

> Otherwise, there's a lot of work yet to make it a real rectangle.

Indeed.


        Stefan



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

* Re: Rectangular regions
  2013-10-30  3:22 ` Leo Liu
  2013-10-30  3:29   ` Daniel Colascione
@ 2013-10-30  4:55   ` Stephen J. Turnbull
  2013-10-31 13:39   ` Xue Fuqiao
  2 siblings, 0 replies; 92+ messages in thread
From: Stephen J. Turnbull @ 2013-10-30  4:55 UTC (permalink / raw)
  To: Leo Liu; +Cc: Stefan Monnier, emacs-devel

Leo Liu writes:

 > Maybe steal M-SPC from just-one-space since it is similar to C-SPC and
 > works well in gui and tty. We could fold just-one-space into
 > delete-horizontal-space somehow.

I use both regularly (in XEmacs, so I don't really care what Emacs
does).

I *think* I most frequently invoke just-one-space when joining lines
(ie, C-e C-d M-SPC), which is more efficiently done with
`delete-indentation' anyway.  Maybe there should be a note in NEWS to
the effect that `delete-indentation' (bound to M-^ in XEmacs) is often
a good alternative, if you make this change?



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

* Re: Rectangular regions
  2013-10-30  1:59 Rectangular regions Stefan Monnier
                   ` (3 preceding siblings ...)
  2013-10-30  3:55 ` Eli Zaretskii
@ 2013-10-30 10:36 ` Bastien
  2013-10-30 10:39   ` Bastien
  2013-10-30 10:49   ` Andreas Schwab
  2013-10-30 13:19 ` Jambunathan K
                   ` (4 subsequent siblings)
  9 siblings, 2 replies; 92+ messages in thread
From: Bastien @ 2013-10-30 10:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I.e. a good key binding for rectangle-mark.

M-[ seems a good fit to me.

-- 
 Bastien



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

* Re: Rectangular regions
  2013-10-30 10:36 ` Bastien
@ 2013-10-30 10:39   ` Bastien
  2013-10-30 10:49   ` Andreas Schwab
  1 sibling, 0 replies; 92+ messages in thread
From: Bastien @ 2013-10-30 10:39 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Bastien <bzg@gnu.org> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> I.e. a good key binding for rectangle-mark.
>
> M-[ seems a good fit to me.

PS: and thanks for implementing this!

-- 
 Bastien



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

* Re: Rectangular regions
  2013-10-30 10:36 ` Bastien
  2013-10-30 10:39   ` Bastien
@ 2013-10-30 10:49   ` Andreas Schwab
  2013-10-31 20:22     ` Richard Stallman
  1 sibling, 1 reply; 92+ messages in thread
From: Andreas Schwab @ 2013-10-30 10:49 UTC (permalink / raw)
  To: Bastien; +Cc: Stefan Monnier, emacs-devel

Bastien <bzg@gnu.org> writes:

> M-[ seems a good fit to me.

Taken by function keys on terminals.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

* Re: Rectangular regions
  2013-10-30  1:59 Rectangular regions Stefan Monnier
                   ` (4 preceding siblings ...)
  2013-10-30 10:36 ` Bastien
@ 2013-10-30 13:19 ` Jambunathan K
  2013-10-30 14:53   ` Josh
  2013-10-30 16:56   ` Jambunathan K
  2013-10-30 18:07 ` Jambunathan K
                   ` (3 subsequent siblings)
  9 siblings, 2 replies; 92+ messages in thread
From: Jambunathan K @ 2013-10-30 13:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> `M-x rectangle-mark'.

The command toggles 'rectangularity' of the region.  So the command name
should have toggle somewhere.

> provide a key binding for rectangle-mark.

C-x r C-SPC

The mnemonic would be
   
    C-x r => rectangle
    C-SPC => mark, unmark




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

* Re: Rectangular regions
  2013-10-30 13:19 ` Jambunathan K
@ 2013-10-30 14:53   ` Josh
  2013-10-30 16:56   ` Jambunathan K
  1 sibling, 0 replies; 92+ messages in thread
From: Josh @ 2013-10-30 14:53 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Stefan Monnier, emacs-devel

On Wed, Oct 30, 2013 at 6:19 AM, Jambunathan K <kjambunathan@gmail.com> wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> provide a key binding for rectangle-mark.
>
> C-x r C-SPC
>
> The mnemonic would be
>
>     C-x r => rectangle
>     C-SPC => mark, unmark

+1, even though this would displace one of point-to-register's
current bindings (though leaving it accessible via `C-x r SPC').
Furthermore, this would make the new command discoverable with
`C-x r C-h', which would go a long way toward Stefan's stated goal
of providing visual access to the existing rectangle functionality.



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

* Re: Rectangular regions
  2013-10-30 13:19 ` Jambunathan K
  2013-10-30 14:53   ` Josh
@ 2013-10-30 16:56   ` Jambunathan K
  1 sibling, 0 replies; 92+ messages in thread
From: Jambunathan K @ 2013-10-30 16:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel


>> `M-x rectangle-mark'.
> C-x r C-SPC

One of the problems with the above binding is this: If your fingers
don't do what you mean, you will end up with C-x C-r or C-x r SPC.

Yet another option would be

    C-x C-y 

The above binding is easy to recall. After this command region will span
both X and Y axes.



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

* Re: Rectangular regions
  2013-10-30  1:59 Rectangular regions Stefan Monnier
                   ` (5 preceding siblings ...)
  2013-10-30 13:19 ` Jambunathan K
@ 2013-10-30 18:07 ` Jambunathan K
  2013-10-31 20:22 ` Richard Stallman
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 92+ messages in thread
From: Jambunathan K @ 2013-10-30 18:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 665 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> `M-x rectangle-mark'.

I am seeing some problems.  When I mark a rectangle, it is 'modifying'
the buffer.  (The modification is only visual and not textual.)

In the attached screenshot, there are two windows.  In the lower window
the cursor has moved to the right by a single column.  Both the windows
are in whitespace-mode showing SPCs and TABs.

Note the following:

1. The rectangle is no longer a rectangle.  It is very confusing.
2. The second and subsequent lines have moved to the right.

I think (1) and (2) are because of presence of tabs.  

(2) is definitely an issue.  It shouldn't happen at all.


[-- Attachment #2: snippet.el --]
[-- Type: application/emacs-lisp, Size: 294 bytes --]

[-- Attachment #3: rectangle-mark.png --]
[-- Type: image/png, Size: 89369 bytes --]

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

* Re: Rectangular regions
  2013-10-30  3:29   ` Daniel Colascione
@ 2013-10-30 18:09     ` Stefan Monnier
  2013-10-30 18:24       ` Bastien
                         ` (2 more replies)
  2013-10-31 20:23     ` Richard Stallman
  1 sibling, 3 replies; 92+ messages in thread
From: Stefan Monnier @ 2013-10-30 18:09 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: Leo Liu, emacs-devel

>> Maybe steal M-SPC from just-one-space since it is similar to C-SPC and
>> works well in gui and tty. We could fold just-one-space into
>> delete-horizontal-space somehow.

I do agree that M-SPC would be "natural".  Also there's a lot of overlap
between M-^, M-\ and M-SPC, so we could try and rely on that to make the
hijacking of M-SPC more bearable (I actually dislike all of M-SPC, M-\,
and M-^, and instead use a command that does "the reverse of M-j",
removing all whitespace and newlines, except for between 0 and
2 depending on the surrounding chars, e.g. 0 between two closing
parens, but two between a "." and an capital letter).

C-x r C-SPC is also very natural, tho it also suffers from being already
taken.  Its advantage is that the existing command is already available
under C-x r SPC, so it's not that much of a loss for users.
The disadvantage is that it's a rather long-winded key-sequence.


        Stefan "who doesn't use any of M-SPC, M-\, or M-^ but uses C-u
                M-j instead (where M-j is modified to treat the prefix
                as meaning to «undo» a M-j)"



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

* Re: Rectangular regions
  2013-10-30 18:09     ` Stefan Monnier
@ 2013-10-30 18:24       ` Bastien
  2013-10-30 19:20       ` Eli Zaretskii
  2013-10-30 20:31       ` John Yates
  2 siblings, 0 replies; 92+ messages in thread
From: Bastien @ 2013-10-30 18:24 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Daniel Colascione, Leo Liu, emacs-devel

What about M-_ ?

The shape of the underscore is quite mnemonic I'd say.

-- 
 Bastien



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

* Re: Rectangular regions
  2013-10-30 18:09     ` Stefan Monnier
  2013-10-30 18:24       ` Bastien
@ 2013-10-30 19:20       ` Eli Zaretskii
  2013-10-30 23:35         ` Bastien
  2013-10-30 20:31       ` John Yates
  2 siblings, 1 reply; 92+ messages in thread
From: Eli Zaretskii @ 2013-10-30 19:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: dancol, sdl.web, emacs-devel

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Date: Wed, 30 Oct 2013 14:09:26 -0400
> Cc: Leo Liu <sdl.web@gmail.com>, emacs-devel@gnu.org
> 
> >> Maybe steal M-SPC from just-one-space since it is similar to C-SPC and
> >> works well in gui and tty. We could fold just-one-space into
> >> delete-horizontal-space somehow.
> 
> I do agree that M-SPC would be "natural".  Also there's a lot of overlap
> between M-^, M-\ and M-SPC, so we could try and rely on that to make the
> hijacking of M-SPC more bearable (I actually dislike all of M-SPC, M-\,
> and M-^, and instead use a command that does "the reverse of M-j",
> removing all whitespace and newlines, except for between 0 and
> 2 depending on the surrounding chars, e.g. 0 between two closing
> parens, but two between a "." and an capital letter).
> 
> C-x r C-SPC is also very natural, tho it also suffers from being already
> taken.  Its advantage is that the existing command is already available
> under C-x r SPC, so it's not that much of a loss for users.
> The disadvantage is that it's a rather long-winded key-sequence.

Why is everybody ignoring the "C-x SPC" suggestion?



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

* Re: Rectangular regions
  2013-10-30 18:09     ` Stefan Monnier
  2013-10-30 18:24       ` Bastien
  2013-10-30 19:20       ` Eli Zaretskii
@ 2013-10-30 20:31       ` John Yates
  2 siblings, 0 replies; 92+ messages in thread
From: John Yates @ 2013-10-30 20:31 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Daniel Colascione, Leo Liu, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

On Wed, Oct 30, 2013 at 2:09 PM, Stefan Monnier <monnier@iro.umontreal.ca>wrote:

> (I actually dislike all of M-SPC, M-\,
> and M-^, and instead use a command that does "the reverse of M-j",
> removing all whitespace and newlines, except for between 0 and
> 2 depending on the surrounding chars, e.g. 0 between two closing
> parens, but two between a "." and an capital letter).
>

Please share.

/john

[-- Attachment #2: Type: text/html, Size: 871 bytes --]

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

* Re: Rectangular regions
  2013-10-30 19:20       ` Eli Zaretskii
@ 2013-10-30 23:35         ` Bastien
  2013-10-31 12:05           ` Jose E. Marchesi
  2013-10-31 17:17           ` Stefan Monnier
  0 siblings, 2 replies; 92+ messages in thread
From: Bastien @ 2013-10-30 23:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dancol, emacs-devel, Stefan Monnier, sdl.web

Eli Zaretskii <eliz@gnu.org> writes:

> Why is everybody ignoring the "C-x SPC" suggestion?

I like it too, indeed.

-- 
 Bastien



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

* Re: Rectangular regions
  2013-10-30 23:35         ` Bastien
@ 2013-10-31 12:05           ` Jose E. Marchesi
  2013-11-05 18:57             ` Stefan Monnier
  2013-10-31 17:17           ` Stefan Monnier
  1 sibling, 1 reply; 92+ messages in thread
From: Jose E. Marchesi @ 2013-10-31 12:05 UTC (permalink / raw)
  To: Bastien; +Cc: sdl.web, Eli Zaretskii, dancol, Stefan Monnier, emacs-devel

    
    > Why is everybody ignoring the "C-x SPC" suggestion?
    
    I like it too, indeed.

Same here.



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

* Re: Rectangular regions
  2013-10-30  3:22 ` Leo Liu
  2013-10-30  3:29   ` Daniel Colascione
  2013-10-30  4:55   ` Stephen J. Turnbull
@ 2013-10-31 13:39   ` Xue Fuqiao
  2 siblings, 0 replies; 92+ messages in thread
From: Xue Fuqiao @ 2013-10-31 13:39 UTC (permalink / raw)
  To: Leo Liu; +Cc: Stefan Monnier, emacs-devel

On Wed, Oct 30, 2013 at 11:22 AM, Leo Liu <sdl.web@gmail.com> wrote:
> Maybe steal M-SPC from just-one-space since it is similar to C-SPC and
> works well in gui and tty. We could fold just-one-space into
> delete-horizontal-space somehow.

cycle-spacing is a good alternative.

-- 
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/



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

* Re: Rectangular regions
  2013-10-30 23:35         ` Bastien
  2013-10-31 12:05           ` Jose E. Marchesi
@ 2013-10-31 17:17           ` Stefan Monnier
  2013-10-31 18:11             ` Jambunathan K
                               ` (3 more replies)
  1 sibling, 4 replies; 92+ messages in thread
From: Stefan Monnier @ 2013-10-31 17:17 UTC (permalink / raw)
  To: Bastien; +Cc: Eli Zaretskii, dancol, sdl.web, emacs-devel

So, current mid-course status:

- `rectangle-mark' will be renamed `rectangle-mark-mode' and made into
  a proper minor mode.

- It could be bound to:
  M-#
  M-_
  M-+
  M-SPC
  C-x SPC
  C-x r C-SPC
  C-SPC C-SPC C-SPC
  C-x C-x C-x C-x C-x C-x
  [ Anything longer to suggest here? ]

- Now that it's a minor mode, it can have some key-bindings of its own.
  Good candidate commands to provide on that keymap:
    string-rectangle and open-rectangle.
  Any suggestion of keys to use for those commands?

- Still no candidate for mouse-based rectangle marking.


        Stefan



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

* Re: Rectangular regions
  2013-10-31 17:17           ` Stefan Monnier
@ 2013-10-31 18:11             ` Jambunathan K
  2013-10-31 18:36             ` Jay Finger
                               ` (2 subsequent siblings)
  3 siblings, 0 replies; 92+ messages in thread
From: Jambunathan K @ 2013-10-31 18:11 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Bastien, Eli Zaretskii, dancol, sdl.web, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> - It could be bound to:
>   M-#
>   M-_
>   M-+
>   M-SPC
>   C-x SPC
>   C-x r C-SPC
>   C-SPC C-SPC C-SPC
>   C-x C-x C-x C-x C-x C-x
>   [ Anything longer to suggest here? ]

C-x C-y.  

x,y signifying the 2-D nature of the region.



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

* Re: Rectangular regions
  2013-10-31 17:17           ` Stefan Monnier
  2013-10-31 18:11             ` Jambunathan K
@ 2013-10-31 18:36             ` Jay Finger
  2013-10-31 18:54               ` Eli Zaretskii
                                 ` (3 more replies)
  2013-10-31 21:03             ` Josh
  2013-11-05 19:47             ` Mathias Dahl
  3 siblings, 4 replies; 92+ messages in thread
From: Jay Finger @ 2013-10-31 18:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Bastien, Eli Zaretskii, dancol, sdl.web, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2014 bytes --]

M-SPC is typically the chord Alt-Space, which activates the window menu on
many systems, both X and Windows, and is consumed by the window manager
before Emacs can get to it.  At least that's the case on the gnome 3.8
system I'm typing this on.  And I would not want to disable the binding for
the window-menu as I like it's functionality and have many years of muscle
memory for it.  So while M-SPC seems to me an obvious variation on C-SPC,
it should probably not be the primary way to access this feature.

I _do_ think that this should be easily accessible.  I have fond memories
of rectangular cut/copy/paste being a first class citizen in the Brief text
editor that I haven't used since probably '88.  So I would prefer as simple
a chord (or sequence) as possible that still identifies it as being just a
variation on C-SPC.

So to the extent that there is a vote, I would go for either 'M-x SPC' or
'C-SPC C-SPC', or 'C-M-SPC'.

Have you also considered, though, making rectangular regions work well at
the elisp level?  For example, so many commands take (point mark) from
(interactive "r") and presume to think that it's a non-rectangular region.
 Would it be useful to have a new interactive code that instead supplies
three arguments, (point mark shape) where shape is 'linear or 'rectangle.

On Thu, Oct 31, 2013 at 10:17 AM, Stefan Monnier
<monnier@iro.umontreal.ca>wrote:

> So, current mid-course status:
>
> - `rectangle-mark' will be renamed `rectangle-mark-mode' and made into
>   a proper minor mode.
>
> - It could be bound to:
>   M-#
>   M-_
>   M-+
>   M-SPC
>   C-x SPC
>   C-x r C-SPC
>   C-SPC C-SPC C-SPC
>   C-x C-x C-x C-x C-x C-x
>   [ Anything longer to suggest here? ]
>
> - Now that it's a minor mode, it can have some key-bindings of its own.
>   Good candidate commands to provide on that keymap:
>     string-rectangle and open-rectangle.
>   Any suggestion of keys to use for those commands?
>
> - Still no candidate for mouse-based rectangle marking.
>
>
>         Stefan
>
>

[-- Attachment #2: Type: text/html, Size: 2629 bytes --]

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

* Re: Rectangular regions
  2013-10-31 18:36             ` Jay Finger
@ 2013-10-31 18:54               ` Eli Zaretskii
  2013-10-31 19:28                 ` Daniel Colascione
  2013-10-31 19:38               ` Daniel Colascione
                                 ` (2 subsequent siblings)
  3 siblings, 1 reply; 92+ messages in thread
From: Eli Zaretskii @ 2013-10-31 18:54 UTC (permalink / raw)
  To: jay.finger; +Cc: bzg, dancol, emacs-devel, monnier, sdl.web

> Date: Thu, 31 Oct 2013 11:36:56 -0700
> From: Jay Finger <jay.finger@pobox.com>
> Cc: Bastien <bzg@gnu.org>, Eli Zaretskii <eliz@gnu.org>, dancol@dancol.org, sdl.web@gmail.com, 
> 	emacs-devel@gnu.org
> 
> M-SPC is typically the chord Alt-Space, which activates the window menu on
> many systems, both X and Windows, and is consumed by the window manager
> before Emacs can get to it.

Not on MS-Windows.



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

* Re: Rectangular regions
  2013-10-31 18:54               ` Eli Zaretskii
@ 2013-10-31 19:28                 ` Daniel Colascione
  0 siblings, 0 replies; 92+ messages in thread
From: Daniel Colascione @ 2013-10-31 19:28 UTC (permalink / raw)
  To: Eli Zaretskii, jay.finger; +Cc: bzg, emacs-devel, monnier, sdl.web

On 10/31/2013 11:54 AM, Eli Zaretskii wrote:
>> Date: Thu, 31 Oct 2013 11:36:56 -0700
>> From: Jay Finger <jay.finger@pobox.com>
>> Cc: Bastien <bzg@gnu.org>, Eli Zaretskii <eliz@gnu.org>, dancol@dancol.org, sdl.web@gmail.com,
>> 	emacs-devel@gnu.org
>>
>> M-SPC is typically the chord Alt-Space, which activates the window menu on
>> many systems, both X and Windows, and is consumed by the window manager
>> before Emacs can get to it.
>
> Not on MS-Windows.

By default. Many users (like myself, when I work on Windows) configure 
Emacs to pass M-SPC through to the window manager. I like being to 
minimize any window on the system with M-SPC n.

>



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

* Re: Rectangular regions
  2013-10-31 18:36             ` Jay Finger
  2013-10-31 18:54               ` Eli Zaretskii
@ 2013-10-31 19:38               ` Daniel Colascione
  2013-10-31 19:44                 ` Eli Zaretskii
  2013-11-01  1:50                 ` Stefan Monnier
  2013-10-31 22:50               ` Xue Fuqiao
  2013-11-01  1:40               ` Stefan Monnier
  3 siblings, 2 replies; 92+ messages in thread
From: Daniel Colascione @ 2013-10-31 19:38 UTC (permalink / raw)
  To: jay.finger, Stefan Monnier; +Cc: Bastien, Eli Zaretskii, sdl.web, emacs-devel

On 10/31/2013 11:36 AM, Jay Finger wrote:
> M-SPC is typically the chord Alt-Space, which activates the window menu
> on many systems, both X and Windows, and is consumed by the window
> manager before Emacs can get to it.  At least that's the case on the
> gnome 3.8 system I'm typing this on.  And I would not want to disable
> the binding for the window-menu as I like it's functionality and have
> many years of muscle memory for it.  So while M-SPC seems to me an
> obvious variation on C-SPC, it should probably not be the primary way to
> access this feature.
>
> I _do_ think that this should be easily accessible.  I have fond
> memories of rectangular cut/copy/paste being a first class citizen in
> the Brief text editor that I haven't used since probably '88.  So I
> would prefer as simple a chord (or sequence) as possible that still
> identifies it as being just a variation on C-SPC.
>
> So to the extent that there is a vote, I would go for either 'M-x SPC'
> or 'C-SPC C-SPC', or 'C-M-SPC'.
>
> Have you also considered, though, making rectangular regions work well
> at the elisp level?  For example, so many commands take (point mark)
> from (interactive "r") and presume to think that it's a non-rectangular
> region.  Would it be useful to have a new interactive code that instead
> supplies three arguments, (point mark shape) where shape is 'linear or
> 'rectangle.

Or better yet --- just take an interval list. An interval list would 
allow us to select a "rectangle" in bidi buffers, the underlying 
character-range chunks of which would actually be arbitrary and 
non-contiguous.



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

* Re: Rectangular regions
  2013-10-31 19:38               ` Daniel Colascione
@ 2013-10-31 19:44                 ` Eli Zaretskii
  2013-11-01  1:50                 ` Stefan Monnier
  1 sibling, 0 replies; 92+ messages in thread
From: Eli Zaretskii @ 2013-10-31 19:44 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: bzg, emacs-devel, monnier, jay.finger, sdl.web

> Date: Thu, 31 Oct 2013 12:38:49 -0700
> From: Daniel Colascione <dancol@dancol.org>
> CC: Bastien <bzg@gnu.org>, Eli Zaretskii <eliz@gnu.org>, 
>  sdl.web@gmail.com, emacs-devel@gnu.org
> 
> Or better yet --- just take an interval list. An interval list would 
> allow us to select a "rectangle" in bidi buffers, the underlying 
> character-range chunks of which would actually be arbitrary and 
> non-contiguous.

Before we even try doing that, we need to decide what would be the
semantics of pasting such a list of intervals, especially if some of
them are from R2L text.  It's nowhere near trivial.



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

* Re: Rectangular regions
  2013-10-30  1:59 Rectangular regions Stefan Monnier
                   ` (6 preceding siblings ...)
  2013-10-30 18:07 ` Jambunathan K
@ 2013-10-31 20:22 ` Richard Stallman
  2013-11-01  9:25 ` Yuri Khan
  2013-11-02 17:36 ` Jambunathan K
  9 siblings, 0 replies; 92+ messages in thread
From: Richard Stallman @ 2013-10-31 20:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

        [ To any NSA and FBI agents reading my email: please consider
        [ whether defending the US Constitution against all enemies,
        [ foreign or domestic, requires you to follow Snowden's example.

    I've installed earlier today a patch which adds basic support for
    rectangular regions.  The entry point currently is `M-x rectangle-mark'.
    Besides making commands aware of rectangular regions (currently only
    things like C-w, M-w, C-y, and M-y pay attention to the shape of the
    region).

This is an interesting feature.  To make it really bloom,
we need to have a way to operate on a rectangular region
that works for all the functions that take a pair of buffer
positions.

The idea that occurs to me is to pass a start and end of the form
(rectangle . POS), to tell these functions to operate on a rectangle
with two specified corners.

One issue thaht will require attention: when we properly handle
formatting with variable with fonts, a rectangle will be defined
by two horizontal positions, and each line will need a computation
to determine which characters are between those positions.
As we implement support for rectangular region in primitives,
we should do it in a way that will handle this in the future.


-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




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

* Re: Rectangular regions
  2013-10-30 10:49   ` Andreas Schwab
@ 2013-10-31 20:22     ` Richard Stallman
  2013-11-01  0:54       ` Leo Liu
  0 siblings, 1 reply; 92+ messages in thread
From: Richard Stallman @ 2013-10-31 20:22 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: bzg, monnier, emacs-devel

        [ To any NSA and FBI agents reading my email: please consider
        [ whether defending the US Constitution against all enemies,
        [ foreign or domestic, requires you to follow Snowden's example.

    > M-[ seems a good fit to me.

    Taken by function keys on terminals.

M-] is unused.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




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

* Re: Rectangular regions
  2013-10-30  3:52 ` Eli Zaretskii
  2013-10-30  4:22   ` Stefan Monnier
@ 2013-10-31 20:23   ` Richard Stallman
  2013-11-01  1:59     ` Stefan Monnier
  1 sibling, 1 reply; 92+ messages in thread
From: Richard Stallman @ 2013-10-31 20:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: monnier, emacs-devel

        [ To any NSA and FBI agents reading my email: please consider
        [ whether defending the US Constitution against all enemies,
        [ foreign or domestic, requires you to follow Snowden's example.

    What did you mean that to do when the rectangle crosses bidirectional
    text?  Currently, the rectangle is "broken".  Similarly when the
    rectangle includes characters of different sizes.

If we can't see a reasonable thing to do in such cases,
we could give an error when trying to use the rectangular region
if the text isn't suitable to cope with.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




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

* Re: Rectangular regions
  2013-10-30  3:29   ` Daniel Colascione
  2013-10-30 18:09     ` Stefan Monnier
@ 2013-10-31 20:23     ` Richard Stallman
  2013-11-01  7:40       ` Eli Zaretskii
  1 sibling, 1 reply; 92+ messages in thread
From: Richard Stallman @ 2013-10-31 20:23 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: emacs-devel, sdl.web, monnier

        [ To any NSA and FBI agents reading my email: please consider
        [ whether defending the US Constitution against all enemies,
        [ foreign or domestic, requires you to follow Snowden's example.

I use M-SPC often, and I would be unhappy if that command became hard
to type.  It has become a habit, so I end up typing it sometimes when there
is already just one space (because I developed a reflex for cases where
often there are multiple spaces).

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




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

* Re: Rectangular regions
  2013-10-31 17:17           ` Stefan Monnier
  2013-10-31 18:11             ` Jambunathan K
  2013-10-31 18:36             ` Jay Finger
@ 2013-10-31 21:03             ` Josh
  2013-11-01  2:01               ` Stefan Monnier
  2013-11-05 19:47             ` Mathias Dahl
  3 siblings, 1 reply; 92+ messages in thread
From: Josh @ 2013-10-31 21:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Bastien, Eli Zaretskii, dancol, Leo Liu, emacs-devel

On Thu, Oct 31, 2013 at 10:17 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
> - `rectangle-mark' will be renamed `rectangle-mark-mode' and made into
>   a proper minor mode.

Most of my own uses of rectangle commands tend to be isolated, i.e. with
intervening non-rectangular operations.  I can see that a modal notion of
rectangularity could certainly make it more convenient to perform
sequences of rectangle operations, but for isolated rectangule operations
doing e.g. `<toggle r-m-m binding> C-w <toggle r-m-mbinding>' would be
less convenient than the current `C-x r k'.

Have you considered implementing a `set-rectangular-mark-command'
that would behave like `set-mark-command' except that the new mark
would have a property indicating that regions it delimits should be treated
as rectangular by rectangle-aware commands?  If this property were
propagated into kill-ring entries appropriately then C-y and friends could
easily DTRT.  If this approach isn't feasible, please consider some other
way to support ephemerally specifying rectangular interpretation of the
region, for example something like `append-next-kill' might be suitable.



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

* Re: Rectangular regions
  2013-10-31 18:36             ` Jay Finger
  2013-10-31 18:54               ` Eli Zaretskii
  2013-10-31 19:38               ` Daniel Colascione
@ 2013-10-31 22:50               ` Xue Fuqiao
  2013-11-01 17:12                 ` Jay Finger
  2013-11-01  1:40               ` Stefan Monnier
  3 siblings, 1 reply; 92+ messages in thread
From: Xue Fuqiao @ 2013-10-31 22:50 UTC (permalink / raw)
  To: jay.finger
  Cc: emacs-devel, Bastien, Stefan Monnier, Eli Zaretskii, dancol,
	sdl.web

On Fri, Nov 1, 2013 at 2:36 AM, Jay Finger <jay.finger@pobox.com> wrote:
> So to the extent that there is a vote, I would go for either 'M-x SPC'

Make M-x a prefix key?

> or 'C-SPC C-SPC'

It handy when you want to use the mark to remember a position to which
you may wish to return (although I don't use it much).

> or 'C-M-SPC'.

Overriding mark-sexp?

Since Stefan will make it a minor mode, perhaps we can follow the
convention in (info "(elisp) Key Binding Conventions").  That is to say,
use ‘C-c’ followed by a punctuation character, like ‘#’, ‘_’, ‘+’, ‘[’,
‘]’, etc.

-- 
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/



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

* Re: Rectangular regions
  2013-10-31 20:22     ` Richard Stallman
@ 2013-11-01  0:54       ` Leo Liu
  0 siblings, 0 replies; 92+ messages in thread
From: Leo Liu @ 2013-11-01  0:54 UTC (permalink / raw)
  To: rms; +Cc: bzg, Andreas Schwab, monnier, emacs-devel

On 2013-11-01 04:22 +0800, Richard Stallman wrote:
> M-] is unused.

This is probably not important.

I use this key in ggtags.el for finding references. I don't know if
`etags' will every grow to differentiate definitions and references. But
GNU Global can and ggtags.el supports it well.

Leo



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

* Re: Rectangular regions
  2013-10-31 18:36             ` Jay Finger
                                 ` (2 preceding siblings ...)
  2013-10-31 22:50               ` Xue Fuqiao
@ 2013-11-01  1:40               ` Stefan Monnier
  2013-11-01  2:13                 ` Leo Liu
                                   ` (2 more replies)
  3 siblings, 3 replies; 92+ messages in thread
From: Stefan Monnier @ 2013-11-01  1:40 UTC (permalink / raw)
  To: Jay Finger; +Cc: Bastien, Eli Zaretskii, dancol, sdl.web, emacs-devel

> So to the extent that there is a vote, I would go for either 'M-x SPC' or
> 'C-SPC C-SPC', or 'C-M-SPC'.

I assume you meant C-x SPC instead of M-x SPC (I guess we could
technically make M-x SPC do the job, but it would be a majorly ugly
hack).

C-SPC C-SPC is already taken, so it'd have to be C-SPC C-SPC C-SPC.
And C-M-SPC is also already taken (and I don't know about you, but
I use it extensively).

> Have you also considered, though, making rectangular regions work well at
> the elisp level?

From rect.el:

;; FIXME: lots of known problems with the new rectangle support:
;; - no key binding for mark-rectangle.
;; - no access to the `string-rectangle' functionality.
;; - lots of commands handle the region without paying attention to its
;;   rectangular shape.

So, I guess, in summary, this counts as an additional vote for C-x SPC.
It looks like GUD will have to adapt.


        Stefan



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

* Re: Rectangular regions
  2013-10-31 19:38               ` Daniel Colascione
  2013-10-31 19:44                 ` Eli Zaretskii
@ 2013-11-01  1:50                 ` Stefan Monnier
  2013-11-01  8:01                   ` Eli Zaretskii
  1 sibling, 1 reply; 92+ messages in thread
From: Stefan Monnier @ 2013-11-01  1:50 UTC (permalink / raw)
  To: Daniel Colascione
  Cc: Bastien, Eli Zaretskii, sdl.web, jay.finger, emacs-devel

> Or better yet --- just take an interval list.

Or provide a `region-iterator-function', so that count-words could do
something like:

   (let ((total 0))
     (funcall region-iterator-function
              (lambda (beg end)
                (cl-incf total (count-words-internal beg end))))
     total)

I'm not sure yet what this really should look like.  We'll need to take
a closer look at the various uses of the region and see what primitives
would be useful.

Some of the issues have to do with modifying the buffer while we go
through the various chunks of the region, as well as dealing with things
like "the region starts in the middle of a TAB character" or "the region
starts/ends after the end of the line".

> An interval list would allow us to select a "rectangle" in bidi
> buffers, the underlying character-range chunks of which would actually
> be arbitrary and non-contiguous.

I'm in no hurry to go down that path.  Lots of potholes on the way, and
from where I stand, there doesn't seem to be much gold at the end of
that road.


        Stefan



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

* Re: Rectangular regions
  2013-10-31 20:23   ` Richard Stallman
@ 2013-11-01  1:59     ` Stefan Monnier
  0 siblings, 0 replies; 92+ messages in thread
From: Stefan Monnier @ 2013-11-01  1:59 UTC (permalink / raw)
  To: Richard Stallman; +Cc: Eli Zaretskii, emacs-devel

> If we can't see a reasonable thing to do in such cases,
> we could give an error when trying to use the rectangular region
> if the text isn't suitable to cope with.

I think the current visual feedback is enough to "indicate an error".


        Stefan



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

* Re: Rectangular regions
  2013-10-31 21:03             ` Josh
@ 2013-11-01  2:01               ` Stefan Monnier
  0 siblings, 0 replies; 92+ messages in thread
From: Stefan Monnier @ 2013-11-01  2:01 UTC (permalink / raw)
  To: Josh; +Cc: Bastien, Eli Zaretskii, dancol, Leo Liu, emacs-devel

> Most of my own uses of rectangle commands tend to be isolated, i.e. with
> intervening non-rectangular operations.  I can see that a modal notion of
> rectangularity could certainly make it more convenient to perform

It's just a change of name and implementation.  The behavior will be
the same.  I.e. the minor mode is disabled whenever the mark
is deactivated.


        Stefan



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

* Re: Rectangular regions
  2013-11-01  1:40               ` Stefan Monnier
@ 2013-11-01  2:13                 ` Leo Liu
  2013-11-01  3:06                   ` Josh
                                     ` (2 more replies)
  2013-11-01  7:57                 ` Eli Zaretskii
  2013-11-01 16:57                 ` Jay Finger
  2 siblings, 3 replies; 92+ messages in thread
From: Leo Liu @ 2013-11-01  2:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Bastien, Eli Zaretskii, dancol, Jay Finger, emacs-devel

On 2013-11-01 09:40 +0800, Stefan Monnier wrote:
> So, I guess, in summary, this counts as an additional vote for C-x SPC.
> It looks like GUD will have to adapt.
>
>
>         Stefan

May I venture another proposal: C-]?

Come to think about it one would (usually) have to move lines to use
rectangle-mark? C-] C-n C-n ... seems quite natural to type.

If I understand the difference between abort-recursive-edit and
exit-recursive-edit correctly, the former exits to the top-level, which
make sense as part of exit-recursive-edit but with C-u.

Keys are precious resources and if there are ones we can GC, it is one
stone for two birds.

But I never use C-] for abort-recursive-edit. Comments?

Leo



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

* Re: Rectangular regions
  2013-11-01  2:13                 ` Leo Liu
@ 2013-11-01  3:06                   ` Josh
  2013-11-01  4:42                     ` Leo Liu
  2013-11-01 15:04                     ` Drew Adams
  2013-11-01  8:04                   ` Eli Zaretskii
  2013-11-01 15:04                   ` Drew Adams
  2 siblings, 2 replies; 92+ messages in thread
From: Josh @ 2013-11-01  3:06 UTC (permalink / raw)
  To: Leo Liu
  Cc: Jay Finger, emacs-devel, Bastien, Stefan Monnier, Eli Zaretskii,
	Daniel Colascione

On Thu, Oct 31, 2013 at 7:13 PM, Leo Liu <sdl.web@gmail.com> wrote:
> Keys are precious resources and if there are ones we can GC, it is one
> stone for two birds.
>
> But I never use C-] for abort-recursive-edit. Comments?

IMO for most users setting a rectangular mark will be done infrequently
enough that it would be a waste to dedicate C-] to it.  C-x r C-SPC seems
like a reasonable default binding to me for the reasons I mentioned earlier,
and naturally users that prefer shorter bindings would be free to assign
them in their init files.



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

* Re: Rectangular regions
  2013-11-01  3:06                   ` Josh
@ 2013-11-01  4:42                     ` Leo Liu
  2013-11-01  5:55                       ` Josh
  2013-11-01 15:04                       ` Drew Adams
  2013-11-01 15:04                     ` Drew Adams
  1 sibling, 2 replies; 92+ messages in thread
From: Leo Liu @ 2013-11-01  4:42 UTC (permalink / raw)
  To: Josh
  Cc: Jay Finger, emacs-devel, Bastien, Stefan Monnier, Eli Zaretskii,
	Daniel Colascione

On 2013-11-01 11:06 +0800, Josh wrote:
> IMO for most users setting a rectangular mark will be done infrequently
> enough that it would be a waste to dedicate C-] to it.  C-x r C-SPC seems
> like a reasonable default binding to me for the reasons I mentioned earlier,
> and naturally users that prefer shorter bindings would be free to assign
> them in their init files.

You are too pessimistic. There are many interesting things that can be
built on this feature. For example, I no longer need to `C-x r k', when
C-w will do just fine.

Leo



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

* Re: Rectangular regions
  2013-11-01  4:42                     ` Leo Liu
@ 2013-11-01  5:55                       ` Josh
  2013-11-01  8:33                         ` Jambunathan K
  2013-11-01 15:04                       ` Drew Adams
  1 sibling, 1 reply; 92+ messages in thread
From: Josh @ 2013-11-01  5:55 UTC (permalink / raw)
  To: Leo Liu
  Cc: Jay Finger, emacs-devel, Bastien, Stefan Monnier, Eli Zaretskii,
	Daniel Colascione

On Thu, Oct 31, 2013 at 9:42 PM, Leo Liu <sdl.web@gmail.com> wrote:
> On 2013-11-01 11:06 +0800, Josh wrote:
>> IMO for most users setting a rectangular mark will be done infrequently
>> enough that it would be a waste to dedicate C-] to it.  C-x r C-SPC seems
>> like a reasonable default binding to me for the reasons I mentioned earlier,
>> and naturally users that prefer shorter bindings would be free to assign
>> them in their init files.
>
> You are too pessimistic. There are many interesting things that can be
> built on this feature. For example, I no longer need to `C-x r k', when
> C-w will do just fine.

Based on my personal experience and the mentions of rectangle commands
I've seen on blogs, IRC, and elsewhere, my impression is that rectangle
commands usually fall into the "occasionally very useful" category, with the
emphasis on "occasionally."  Perhaps I'm in the minority, but it doesn't seem
worthwhile to give up C-] in exchange for saving a single keystroke for
infrequent operations like kill-rectangle.



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

* Re: Rectangular regions
  2013-10-31 20:23     ` Richard Stallman
@ 2013-11-01  7:40       ` Eli Zaretskii
  0 siblings, 0 replies; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-01  7:40 UTC (permalink / raw)
  To: rms; +Cc: dancol, sdl.web, monnier, emacs-devel

> Date: Thu, 31 Oct 2013 16:23:07 -0400
> From: Richard Stallman <rms@gnu.org>
> Cc: emacs-devel@gnu.org, sdl.web@gmail.com, monnier@iro.umontreal.ca
> 
> I use M-SPC often, and I would be unhappy if that command became hard
> to type.

I hope it is unthinkable to remove such a veteran keybinding.



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

* Re: Rectangular regions
  2013-11-01  1:40               ` Stefan Monnier
  2013-11-01  2:13                 ` Leo Liu
@ 2013-11-01  7:57                 ` Eli Zaretskii
  2013-11-01 12:35                   ` Stefan Monnier
  2013-11-01 16:57                 ` Jay Finger
  2 siblings, 1 reply; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-01  7:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: bzg, dancol, sdl.web, jay.finger, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Bastien <bzg@gnu.org>,  Eli Zaretskii <eliz@gnu.org>,  dancol@dancol.org,  sdl.web@gmail.com,  emacs-devel@gnu.org
> Date: Thu, 31 Oct 2013 21:40:48 -0400
> 
> So, I guess, in summary, this counts as an additional vote for C-x SPC.
> It looks like GUD will have to adapt.

GUD could simply override the binding: I find it hard to believe a
rectangular region could be useful in GUD buffers.



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

* Re: Rectangular regions
  2013-11-01  1:50                 ` Stefan Monnier
@ 2013-11-01  8:01                   ` Eli Zaretskii
  0 siblings, 0 replies; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-01  8:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: bzg, dancol, sdl.web, jay.finger, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Thu, 31 Oct 2013 21:50:25 -0400
> Cc: Bastien <bzg@gnu.org>, Eli Zaretskii <eliz@gnu.org>, sdl.web@gmail.com,
> 	jay.finger@pobox.com, emacs-devel@gnu.org
> 
> We'll need to take a closer look at the various uses of the region
> and see what primitives would be useful.

Indeed.  I'm not sure we fully understand the pertinent use cases of
yanking such regions into various contexts, let alone other operations
on region.  I would like to believe that counting words is not the
most important one of them.

> > An interval list would allow us to select a "rectangle" in bidi
> > buffers, the underlying character-range chunks of which would actually
> > be arbitrary and non-contiguous.
> 
> I'm in no hurry to go down that path.  Lots of potholes on the way, and
> from where I stand, there doesn't seem to be much gold at the end of
> that road.

Agreed.  Not before we are confident we have the rectangular region
features right in the unidirectional case.



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

* Re: Rectangular regions
  2013-11-01  2:13                 ` Leo Liu
  2013-11-01  3:06                   ` Josh
@ 2013-11-01  8:04                   ` Eli Zaretskii
  2013-11-01 15:04                   ` Drew Adams
  2 siblings, 0 replies; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-01  8:04 UTC (permalink / raw)
  To: Leo Liu; +Cc: bzg, dancol, monnier, jay.finger, emacs-devel

> From:  Leo Liu <sdl.web@gmail.com>
> Cc: Jay Finger <jay.finger@pobox.com>,  Bastien <bzg@gnu.org>,  Eli Zaretskii <eliz@gnu.org>,  dancol@dancol.org,  emacs-devel@gnu.org
> Date: Fri, 01 Nov 2013 10:13:52 +0800
> 
> But I never use C-] for abort-recursive-edit.

I use it all the time.  And the problem with redefining it is that
this binding must be available in every mode.




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

* Re: Rectangular regions
  2013-11-01  5:55                       ` Josh
@ 2013-11-01  8:33                         ` Jambunathan K
  2013-11-02 10:25                           ` Xue Fuqiao
  0 siblings, 1 reply; 92+ messages in thread
From: Jambunathan K @ 2013-11-01  8:33 UTC (permalink / raw)
  To: Josh; +Cc: emacs-devel

Josh <josh@foxtail.org> writes:

> Based on my personal experience and the mentions of rectangle commands
> I've seen on blogs, IRC, and elsewhere, my impression is that rectangle
> commands usually fall into the "occasionally very useful" category, with the
> emphasis on "occasionally."

The command 

    C-x r o 

is quite a useful command.  It can *actually* be used for indentation.



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

* Re: Rectangular regions
  2013-10-30  1:59 Rectangular regions Stefan Monnier
                   ` (7 preceding siblings ...)
  2013-10-31 20:22 ` Richard Stallman
@ 2013-11-01  9:25 ` Yuri Khan
  2013-11-01 11:20   ` Eli Zaretskii
  2013-11-02 17:36 ` Jambunathan K
  9 siblings, 1 reply; 92+ messages in thread
From: Yuri Khan @ 2013-11-01  9:25 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> I've installed earlier today a patch which adds basic support for
> rectangular regions.  The entry point currently is `M-x rectangle-mark'.
> Besides making commands aware of rectangular regions (currently only
> things like C-w, M-w, C-y, and M-y pay attention to the shape of the
> region), I have one main UI issues: provide a key binding for
> rectangle-mark.
> 
> A related issue is to find a mouse-binding for it.

For us cua-mode junkies, please consider Alt+arrows (alternatively
Alt+Shift+arrows) and Alt+drag (alternatively, click at one corner,
Alt+click at opposite corner). Granted, none of these are very
terminal-friendly; also, Alt+drag will conflict with many X window managers.




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

* Re: Rectangular regions
  2013-11-01  9:25 ` Yuri Khan
@ 2013-11-01 11:20   ` Eli Zaretskii
  2013-11-01 12:57     ` Stefan Monnier
  0 siblings, 1 reply; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-01 11:20 UTC (permalink / raw)
  To: Yuri Khan; +Cc: emacs-devel

> From: Yuri Khan <yuri.v.khan@gmail.com>
> Date: Fri, 1 Nov 2013 09:25:06 +0000 (UTC)
> 
> For us cua-mode junkies, please consider Alt+arrows (alternatively
> Alt+Shift+arrows) and Alt+drag (alternatively, click at one corner,
> Alt+click at opposite corner).

That will only make sense if the functionality is similar enough to
what cua-rect does.  I didn't test this well enough to know whether it
is; I do know that cua-rect has some tricks up its sleeve.



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

* Re: Rectangular regions
  2013-11-01  7:57                 ` Eli Zaretskii
@ 2013-11-01 12:35                   ` Stefan Monnier
  2013-11-01 19:26                     ` Eli Zaretskii
  0 siblings, 1 reply; 92+ messages in thread
From: Stefan Monnier @ 2013-11-01 12:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: bzg, dancol, sdl.web, jay.finger, emacs-devel

> GUD could simply override the binding: I find it hard to believe a
> rectangular region could be useful in GUD buffers.

GUD's binding is global (it's useless in the *gud* buffer, since it's
to be used at the location where you want to place a breakpoint).


        Stefan



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

* Re: Rectangular regions
  2013-11-01 11:20   ` Eli Zaretskii
@ 2013-11-01 12:57     ` Stefan Monnier
  2013-11-01 14:31       ` Eli Zaretskii
  2013-11-01 15:08       ` Yuri Khan
  0 siblings, 2 replies; 92+ messages in thread
From: Stefan Monnier @ 2013-11-01 12:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, Yuri Khan

>> For us cua-mode junkies, please consider Alt+arrows (alternatively
>> Alt+Shift+arrows) and Alt+drag (alternatively, click at one corner,
>> Alt+click at opposite corner).

AFAICT, this is not part of the default cua-mode behavior.

I see some code to provide the Alt+click/drag if
cua-rectangle-modifier-key is not `meta', but I don't see any code to
support the Alt+arrows option.

> That will only make sense if the functionality is similar enough to
> what cua-rect does.  I didn't test this well enough to know whether it
> is; I do know that cua-rect has some tricks up its sleeve.

There several important differences.  But that shouldn't preclude us
from looking at cua-mode for inspiration.


        Stefan



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

* Re: Rectangular regions
  2013-11-01 12:57     ` Stefan Monnier
@ 2013-11-01 14:31       ` Eli Zaretskii
  2013-11-01 15:08       ` Yuri Khan
  1 sibling, 0 replies; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-01 14:31 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: yuri.v.khan, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 01 Nov 2013 08:57:12 -0400
> Cc: emacs-devel@gnu.org, Yuri Khan <yuri.v.khan@gmail.com>
> 
> > That will only make sense if the functionality is similar enough to
> > what cua-rect does.  I didn't test this well enough to know whether it
> > is; I do know that cua-rect has some tricks up its sleeve.
> 
> There several important differences.  But that shouldn't preclude us
> from looking at cua-mode for inspiration.

I wasn't talking about inspiration, I was talking about copying
keybindings.



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

* RE: Rectangular regions
  2013-11-01  4:42                     ` Leo Liu
  2013-11-01  5:55                       ` Josh
@ 2013-11-01 15:04                       ` Drew Adams
  2013-11-02  6:31                         ` Stephen J. Turnbull
  1 sibling, 1 reply; 92+ messages in thread
From: Drew Adams @ 2013-11-01 15:04 UTC (permalink / raw)
  To: Leo Liu, Josh
  Cc: Jay Finger, emacs-devel, Bastien, Stefan Monnier, Eli Zaretskii,
	Daniel Colascione

> > it would be a waste to dedicate C-] to it.  C-x r C-SPC
> > seems like a reasonable default binding...
>
> You are too pessimistic. There are many interesting things
> that can be built on this feature.

All the more reason to move it to the rectangle-command prefix,
`C-x r', where additional interesting things that are related
can also be placed.



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

* RE: Rectangular regions
  2013-11-01  3:06                   ` Josh
  2013-11-01  4:42                     ` Leo Liu
@ 2013-11-01 15:04                     ` Drew Adams
  1 sibling, 0 replies; 92+ messages in thread
From: Drew Adams @ 2013-11-01 15:04 UTC (permalink / raw)
  To: Josh, Leo Liu
  Cc: Jay Finger, emacs-devel, Bastien, Stefan Monnier, Eli Zaretskii,
	Daniel Colascione

> > But I never use C-] for abort-recursive-edit. Comments?
> 
> IMO for most users setting a rectangular mark will be done
> infrequently enough that it would be a waste to dedicate C-]
> to it.

Agreed; it would be a waste - whether or not it is used
frequently.  Likewise for other simple repeatable keys mentioned,
such as `M-]', `M-SPC', `C-SPC', `M-#', and `M-+'.

> C-x r C-SPC seems like a reasonable default binding to me for
> the reasons I mentioned earlier, and naturally users that
> prefer shorter bindings would be free to assign them in their
> init files.

Yes.  Put the key on prefix `C-x r'.  Do not waste a quick key
on it.



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

* RE: Rectangular regions
  2013-11-01  2:13                 ` Leo Liu
  2013-11-01  3:06                   ` Josh
  2013-11-01  8:04                   ` Eli Zaretskii
@ 2013-11-01 15:04                   ` Drew Adams
  2 siblings, 0 replies; 92+ messages in thread
From: Drew Adams @ 2013-11-01 15:04 UTC (permalink / raw)
  To: Leo Liu, Stefan Monnier
  Cc: Bastien, Eli Zaretskii, dancol, Jay Finger, emacs-devel

> But I never use C-] for abort-recursive-edit. Comments?

No thanks.  I use `C-]' all the time.  (And I use recursive
minibuffers, where `C-]' pops a level.)

Put the new command on prefix key `C-x r', along with the
other rectangle commands.

`C-x r #' is a fine choice (= `C-x R #', by default), as is
`C-x r ]' and some others.  And no, it does not need to be a
quick key.

We can also move the register commands to prefix key `C-x w'.

Leave simple repeatable keys alone - `M-]', `M-SPC', `C-SPC',
`M-#', `M-+',...  Leave keys such as `C-x SPC' and `C-x C-y'
alone.



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

* Re: Rectangular regions
  2013-11-01 12:57     ` Stefan Monnier
  2013-11-01 14:31       ` Eli Zaretskii
@ 2013-11-01 15:08       ` Yuri Khan
  1 sibling, 0 replies; 92+ messages in thread
From: Yuri Khan @ 2013-11-01 15:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, emacs-devel

On Fri, Nov 1, 2013 at 7:57 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>> For us cua-mode junkies, please consider Alt+arrows (alternatively
>>> Alt+Shift+arrows) and Alt+drag (alternatively, click at one corner,
>>> Alt+click at opposite corner).
>
> AFAICT, this is not part of the default cua-mode behavior.

No, it’s not. But it’s part of other software that uses the CUA
interaction model.

>> That will only make sense if the functionality is similar enough to
>> what cua-rect does.  I didn't test this well enough to know whether it
>> is; I do know that cua-rect has some tricks up its sleeve.

cua-rect is a mode (in the general meaning, as in, you press C-RET and
arrows now work differently). Alt+arrows is a quasimode — arrows work
differently while the modifier is pressed, but revert to their normal
meaning when it is released. Quasimodes are much more pleasant to work
with (if we liked modes, we’d be using vi).

As far as I understand, before this change, the model is that you have
a mark and a point, and they mean different things to different
commands. If the model is to be changed to (mark, point, shape) and
differently-named commands to be united and made to depend on the
shape, then there needs to be a means of rectangle selection as
convenient as Shift+arrows in cua-mode.



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

* Re: Rectangular regions
  2013-11-01  1:40               ` Stefan Monnier
  2013-11-01  2:13                 ` Leo Liu
  2013-11-01  7:57                 ` Eli Zaretskii
@ 2013-11-01 16:57                 ` Jay Finger
  2 siblings, 0 replies; 92+ messages in thread
From: Jay Finger @ 2013-11-01 16:57 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: Bastien, Eli Zaretskii, Daniel Colascione, Leo Liu, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]

On Thu, Oct 31, 2013 at 6:40 PM, Stefan Monnier <monnier@iro.umontreal.ca>wrote:

> > So to the extent that there is a vote, I would go for either 'M-x SPC' or
> > 'C-SPC C-SPC', or 'C-M-SPC'.
>
> I assume you meant C-x SPC instead of M-x SPC (I guess we could
> technically make M-x SPC do the job, but it would be a majorly ugly
> hack).
>

You are correct.

[-- Attachment #2: Type: text/html, Size: 748 bytes --]

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

* Re: Rectangular regions
  2013-10-31 22:50               ` Xue Fuqiao
@ 2013-11-01 17:12                 ` Jay Finger
  2013-11-01 18:25                   ` Stefan Monnier
  0 siblings, 1 reply; 92+ messages in thread
From: Jay Finger @ 2013-11-01 17:12 UTC (permalink / raw)
  To: Xue Fuqiao
  Cc: emacs-devel, Bastien, Stefan Monnier, Eli Zaretskii,
	Daniel Colascione, Leo Liu

[-- Attachment #1: Type: text/plain, Size: 628 bytes --]

> or 'C-M-SPC'.

>
> Overriding mark-sexp?
>

Yes, IMO.  I can imagine this list has a preponderance of people that would
miss the binding, though.  Personally, even though I have always written
more elisp than the people immediately around me, I'm a C/C++ programmer,
and mark-sexp doesn't do anything intuitively useful for me in c++-mode, so
I've never internalized it.

Even though I voted for C-x SPC, I would miss gud-break.  Lots of muscle
memory around that, although not as much as Alt-Space. I suppose the M-[
and M-] suggstions aren't so bad.

Oooh.  s-SPC is free.  I shall bind it to s-SPC in my own .emacs anyhow.

[-- Attachment #2: Type: text/html, Size: 940 bytes --]

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

* Re: Rectangular regions
  2013-11-01 17:12                 ` Jay Finger
@ 2013-11-01 18:25                   ` Stefan Monnier
  2013-11-01 19:05                     ` Drew Adams
  2013-11-05 22:44                     ` Davis Herring
  0 siblings, 2 replies; 92+ messages in thread
From: Stefan Monnier @ 2013-11-01 18:25 UTC (permalink / raw)
  To: Jay Finger
  Cc: Xue Fuqiao, emacs-devel, Bastien, Eli Zaretskii,
	Daniel Colascione, Leo Liu

> Yes, IMO.  I can imagine this list has a preponderance of people that would
> miss the binding, though.  Personally, even though I have always written
> more elisp than the people immediately around me, I'm a C/C++ programmer,
> and mark-sexp doesn't do anything intuitively useful for me in c++-mode, so
> I've never internalized it.

In C (and friends), C-M-SPC in front of a semi-colon should select the
whole subsequent instruction.  And in front of a comma, it should select
the next argument.  Admittedly, it doesn't.

But that's what major modes relying on SMIE do, and I find it makes
C-M-SPC very useful in such major modes, even tho their syntax is
not Lispish.

Of course I'm biased: I made C-M-SPC do that in SMIE-based modes
specifically because I wanted such a thing (similarly with C-M-t to swap
two arguments).

> Even though I voted for C-x SPC, I would miss gud-break.

So would I, but so far it looks like the strongest contender.  Of course
gud-break is available as C-x C-a C-b, as well as a toolbar button, but
indeed C-x C-a C-b is pretty poor :-(

> Oooh.  s-SPC is free.  I shall bind it to s-SPC in my own .emacs anyhow.

Indeed, we could also use S-SPC: it's not available under ttys, but is
otherwise free.


        Stefan



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

* RE: Rectangular regions
  2013-11-01 18:25                   ` Stefan Monnier
@ 2013-11-01 19:05                     ` Drew Adams
  2013-11-01 19:25                       ` John Yates
  2013-11-05 22:44                     ` Davis Herring
  1 sibling, 1 reply; 92+ messages in thread
From: Drew Adams @ 2013-11-01 19:05 UTC (permalink / raw)
  To: Stefan Monnier, Jay Finger
  Cc: Xue Fuqiao, emacs-devel, Bastien, Eli Zaretskii,
	Daniel Colascione, Leo Liu

> > Even though I voted for C-x SPC, I would miss gud-break.
> 
> So would I, but so far it looks like the strongest contender.

It does?  Why?  What arguments favor it?  I haven't seen a
single one, so far.  Have you?

All I've seen is Eli's "`C-x SPC' is available", followed by
his "Why is everybody ignoring the `C-x SPC' suggestion?".

Reasons.

> we could also use S-SPC: it's not available under ttys, but
> is otherwise free.

S-SPC is an even worse choice than C-x SPC.

The key for this command does not need to be particularly quick.
And it certainly does not need to be easily repeatable.  This
would be a royal waste of a key that has such attributes.

Put the command on prefix `C-x r', together with the other
rectangle commands.  Easy to use, easy to discover, easy to
remember.



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

* Re: Rectangular regions
  2013-11-01 19:05                     ` Drew Adams
@ 2013-11-01 19:25                       ` John Yates
  0 siblings, 0 replies; 92+ messages in thread
From: John Yates @ 2013-11-01 19:25 UTC (permalink / raw)
  To: Drew Adams
  Cc: Jay Finger, Xue Fuqiao, emacs-devel, Bastien, Stefan Monnier,
	Eli Zaretskii, Daniel Colascione, Leo Liu

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]

> Put the command on prefix `C-x r', together with the other
> rectangle commands.  Easy to use, easy to discover, easy to
> remember.

I am with Drew on this one (a rare occurrence :-).

/john

[-- Attachment #2: Type: text/html, Size: 249 bytes --]

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

* Re: Rectangular regions
  2013-11-01 12:35                   ` Stefan Monnier
@ 2013-11-01 19:26                     ` Eli Zaretskii
  2013-11-01 19:55                       ` Stefan Monnier
  0 siblings, 1 reply; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-01 19:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 01 Nov 2013 08:35:25 -0400
> Cc: bzg@gnu.org, dancol@dancol.org, sdl.web@gmail.com, jay.finger@pobox.com,
> 	emacs-devel@gnu.org
> 
> > GUD could simply override the binding: I find it hard to believe a
> > rectangular region could be useful in GUD buffers.
> 
> GUD's binding is global (it's useless in the *gud* buffer, since it's
> to be used at the location where you want to place a breakpoint).

Then how about if GUD binds "C-x SPC" locally in buffers whose major
mode inherits from prog-mode?



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

* Re: Rectangular regions
  2013-11-01 19:26                     ` Eli Zaretskii
@ 2013-11-01 19:55                       ` Stefan Monnier
  2013-11-01 19:59                         ` Eli Zaretskii
  0 siblings, 1 reply; 92+ messages in thread
From: Stefan Monnier @ 2013-11-01 19:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

>> > GUD could simply override the binding: I find it hard to believe a
>> > rectangular region could be useful in GUD buffers.
>> GUD's binding is global (it's useless in the *gud* buffer, since it's
>> to be used at the location where you want to place a breakpoint).
> Then how about if GUD binds "C-x SPC" locally in buffers whose major
> mode inherits from prog-mode?

We could clearly do that (or even be more discriminating and only
affecting buffers whose major mode is "related" to the debugged
program).

But there can be good reasons to use rectangle operations in programming
modes as well, so it would still clash.  I don't think it would be
better than just dropping the C-x SPC binding for gud-break.


        Stefan



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

* Re: Rectangular regions
  2013-11-01 19:55                       ` Stefan Monnier
@ 2013-11-01 19:59                         ` Eli Zaretskii
  2013-11-01 20:02                           ` Daniel Colascione
  0 siblings, 1 reply; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-01 19:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: emacs-devel@gnu.org
> Date: Fri, 01 Nov 2013 15:55:45 -0400
> 
> But there can be good reasons to use rectangle operations in programming
> modes as well

I'm surprised: could you give an idea why that could be useful?



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

* Re: Rectangular regions
  2013-11-01 19:59                         ` Eli Zaretskii
@ 2013-11-01 20:02                           ` Daniel Colascione
  2013-11-01 20:20                             ` Eli Zaretskii
  0 siblings, 1 reply; 92+ messages in thread
From: Daniel Colascione @ 2013-11-01 20:02 UTC (permalink / raw)
  To: Eli Zaretskii, Stefan Monnier; +Cc: emacs-devel

On 11/01/2013 12:59 PM, Eli Zaretskii wrote:
>> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
>> Cc: emacs-devel@gnu.org
>> Date: Fri, 01 Nov 2013 15:55:45 -0400
>>
>> But there can be good reasons to use rectangle operations in programming
>> modes as well
>
> I'm surprised: could you give an idea why that could be useful?

I've used them to deal with ASCII art diagrams.



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

* Re: Rectangular regions
  2013-11-01 20:02                           ` Daniel Colascione
@ 2013-11-01 20:20                             ` Eli Zaretskii
  2013-11-01 23:35                               ` Josh
  0 siblings, 1 reply; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-01 20:20 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: monnier, emacs-devel

> Date: Fri, 01 Nov 2013 13:02:12 -0700
> From: Daniel Colascione <dancol@dancol.org>
> CC: emacs-devel@gnu.org
> 
> On 11/01/2013 12:59 PM, Eli Zaretskii wrote:
> >> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> >> Cc: emacs-devel@gnu.org
> >> Date: Fri, 01 Nov 2013 15:55:45 -0400
> >>
> >> But there can be good reasons to use rectangle operations in programming
> >> modes as well
> >
> > I'm surprised: could you give an idea why that could be useful?
> 
> I've used them to deal with ASCII art diagrams.

In a program source?  If so, it must have been in comments, where you
would never set a breakpoint, right?



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

* Re: Rectangular regions
  2013-11-01 20:20                             ` Eli Zaretskii
@ 2013-11-01 23:35                               ` Josh
  2013-11-02  7:00                                 ` Eli Zaretskii
  0 siblings, 1 reply; 92+ messages in thread
From: Josh @ 2013-11-01 23:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Daniel Colascione, Stefan Monnier, emacs-devel

On Fri, Nov 1, 2013 at 1:20 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Fri, 01 Nov 2013 13:02:12 -0700
>> From: Daniel Colascione <dancol@dancol.org>
>> CC: emacs-devel@gnu.org
>>
>> On 11/01/2013 12:59 PM, Eli Zaretskii wrote:
>> >> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
>> >> Cc: emacs-devel@gnu.org
>> >> Date: Fri, 01 Nov 2013 15:55:45 -0400
>> >>
>> >> But there can be good reasons to use rectangle operations in programming
>> >> modes as well
>> >
>> > I'm surprised: could you give an idea why that could be useful?
>>
>> I've used them to deal with ASCII art diagrams.
>
> In a program source?  If so, it must have been in comments, where you
> would never set a breakpoint, right?

I also use rectangle commands in programming modes from time to
time, and not in comments.  For example, I can often perform
simultaneous edits to common substrings of columnar data such as
enum elements far more efficiently with a rectangle command than I
could using a keyboard macro or replace-regexp.  I also use
rectangle commands quite often when when transforming extracts from
log files into a form suitable for programmatic use.



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

* RE: Rectangular regions
  2013-11-01 15:04                       ` Drew Adams
@ 2013-11-02  6:31                         ` Stephen J. Turnbull
  2013-11-02  8:14                           ` Jambunathan K
  2013-11-03  0:59                           ` Stefan Monnier
  0 siblings, 2 replies; 92+ messages in thread
From: Stephen J. Turnbull @ 2013-11-02  6:31 UTC (permalink / raw)
  To: Drew Adams
  Cc: Jay Finger, emacs-devel, Bastien, Stefan Monnier, Josh,
	Eli Zaretskii, Daniel Colascione, Leo Liu

Drew Adams writes:

 > All the more reason to move it to the rectangle-command prefix,
 > `C-x r', where additional interesting things that are related
 > can also be placed.

+1

Discoverability of the default bindings is very important.  If it's on
C-x r, C-x r C-h will list it for you.

Users who use the function frequently can put it on an more accessible
sequence.




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

* Re: Rectangular regions
  2013-11-01 23:35                               ` Josh
@ 2013-11-02  7:00                                 ` Eli Zaretskii
  2013-11-02 18:20                                   ` Josh
  0 siblings, 1 reply; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-02  7:00 UTC (permalink / raw)
  To: Josh; +Cc: dancol, monnier, emacs-devel

> From: Josh <josh@foxtail.org>
> Date: Fri, 1 Nov 2013 16:35:05 -0700
> Cc: Daniel Colascione <dancol@dancol.org>,
> 	Stefan Monnier <monnier@iro.umontreal.ca>,
> 	emacs-devel <emacs-devel@gnu.org>
> 
> I also use rectangle commands in programming modes from time to
> time, and not in comments.  For example, I can often perform
> simultaneous edits to common substrings of columnar data such as
> enum elements far more efficiently with a rectangle command than I
> could using a keyboard macro or replace-regexp.

The important questions: are these uses more frequent than using GUD
on the same sources?

> I also use rectangle commands quite often when when transforming
> extracts from log files into a form suitable for programmatic use.

In this case, the rectangular mark is not set in a buffer where the
major mode supports some programming language.  So I don't think these
cases count for the discussion at hand.



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

* Re: Rectangular regions
  2013-11-02  6:31                         ` Stephen J. Turnbull
@ 2013-11-02  8:14                           ` Jambunathan K
  2013-11-02  9:56                             ` Stephen J. Turnbull
  2013-11-02 15:30                             ` Drew Adams
  2013-11-03  0:59                           ` Stefan Monnier
  1 sibling, 2 replies; 92+ messages in thread
From: Jambunathan K @ 2013-11-02  8:14 UTC (permalink / raw)
  To: Stephen J. Turnbull
  Cc: Jay Finger, emacs-devel, Bastien, Stefan Monnier, Josh,
	Eli Zaretskii, Daniel Colascione, Leo Liu, Drew Adams


> Users who use the function frequently can put it on an more accessible
> sequence.

So, please provide multiple bindings - one on C-x r one on whatever.

If the number and nature of what the new mode can potentially do is a
bit unclear, it might actually be better NOT to choose a prefix key
right now.



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

* Re: Rectangular regions
  2013-11-02  8:14                           ` Jambunathan K
@ 2013-11-02  9:56                             ` Stephen J. Turnbull
  2013-11-02 10:05                               ` [SPAM] " Jarek Czekalski
  2013-11-02 15:30                             ` Drew Adams
  1 sibling, 1 reply; 92+ messages in thread
From: Stephen J. Turnbull @ 2013-11-02  9:56 UTC (permalink / raw)
  To: Jambunathan K
  Cc: Jay Finger, emacs-devel, Bastien, Stefan Monnier, Josh,
	Eli Zaretskii, Daniel Colascione, Leo Liu, Drew Adams

Jambunathan K writes:

 > > Users who use the function frequently can put it on an more
 > > accessible sequence.
 > 
 > So, please provide multiple bindings - one on C-x r one on
 > whatever.

Let's not.  There's an obvious mnemonic and more discoverable place to
bind it, and there are a bunch of more or less plausible places that
screw other users, although they may be easier to type.  Why is it so
hard to figure out that this function is no more special than a couple
thousand other commands?

 > If the number and nature of what the new mode can potentially do is a
 > bit unclear, it might actually be better NOT to choose a prefix key
 > right now.

It's quite clear what it does: it works on rectangles in any buffer,
just as the region functions work on linear intervals in any buffer.
That makes the choice of prefix key obvious.

If, at some time, we decide that rectangle functions deserve to be
given the same prominence that region functions do, we can bulldoze
the whole keymap.  My money is on "nope, won't happen" (see that
concurrent thread on Emacsspeak-friendly Emacsen for why regions beat
rectangles).




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

* Re: [SPAM] Re: Rectangular regions
  2013-11-02  9:56                             ` Stephen J. Turnbull
@ 2013-11-02 10:05                               ` Jarek Czekalski
  2013-11-02 11:00                                 ` Stephen J. Turnbull
  0 siblings, 1 reply; 92+ messages in thread
From: Jarek Czekalski @ 2013-11-02 10:05 UTC (permalink / raw)
  To: emacs-devel

W dniu 11/02/2013 10:56 AM, Stephen J. Turnbull pisze:
> (see that
> concurrent thread on Emacsspeak-friendly Emacsen for why regions beat
> rectangles).

Link please, this is not googleable.

Thanks,
Jarek



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

* Re: Rectangular regions
  2013-11-01  8:33                         ` Jambunathan K
@ 2013-11-02 10:25                           ` Xue Fuqiao
  0 siblings, 0 replies; 92+ messages in thread
From: Xue Fuqiao @ 2013-11-02 10:25 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Josh, emacs-devel

On Fri, Nov 1, 2013 at 4:33 PM, Jambunathan K <kjambunathan@gmail.com> wrote:
>> Based on my personal experience and the mentions of rectangle commands
>> I've seen on blogs, IRC, and elsewhere, my impression is that rectangle
>> commands usually fall into the "occasionally very useful" category, with the
>> emphasis on "occasionally."
>
> The command
>
>     C-x r o
>
> is quite a useful command.  It can *actually* be used for indentation.

FWIW I use indent-rigidly or kmacro for indenting.

-- 
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/



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

* Re: [SPAM] Re: Rectangular regions
  2013-11-02 10:05                               ` [SPAM] " Jarek Czekalski
@ 2013-11-02 11:00                                 ` Stephen J. Turnbull
  2013-11-02 14:56                                   ` Jambunathan K
  0 siblings, 1 reply; 92+ messages in thread
From: Stephen J. Turnbull @ 2013-11-02 11:00 UTC (permalink / raw)
  To: Jarek Czekalski; +Cc: emacs-devel

Jarek Czekalski writes:
 > W dniu 11/02/2013 10:56 AM, Stephen J. Turnbull pisze:
 > > (see that
 > > concurrent thread on Emacsspeak-friendly Emacsen for why regions beat
 > > rectangles).
 > 
 > Link please, this is not googleable.

Rather than make you search for something that isn't actually there,
I'll explain.

The point is that Emacsspeak is an inherently linear medium, which
nevertheless makes full use of the capabilities of Emacs.  While I'm
sure people with more or less impaired sight are quite capable of
using rectangles in Emacs, this indicates to me that linear regions
are a more fundamental entity in Emacs.

The reason for mentioning an Emacsspeak thread in this context is that
in that thread Stefan and others have expressed strong support for
ensuring that Emacs can support Emacsspeak well, which is indirect
support for my claim.  Very indirect,if you wish. :-)





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

* Re: [SPAM] Re: Rectangular regions
  2013-11-02 11:00                                 ` Stephen J. Turnbull
@ 2013-11-02 14:56                                   ` Jambunathan K
  2013-11-02 16:59                                     ` Stephen J. Turnbull
  0 siblings, 1 reply; 92+ messages in thread
From: Jambunathan K @ 2013-11-02 14:56 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Jarek Czekalski, emacs-devel

"Stephen J. Turnbull" <stephen@xemacs.org> writes:

> why regions beat rectangles.

> The point is that Emacsspeak is an inherently linear medium

Rectangles are but table-cells - either belonging to table.el table or
Org tables.  Operations on a horizontal stack (a row) or a vertical
stack (a column) are indeed operations that happen on a "set of
rectangles".

Out of curiosity, how would Emacsspeak users mark a rectangle or
traverse among those.  Do they never use tables at all?

One rectangle operation that would be useful is the ability to do an M-q
on a table-cell and have it filled horizontally and expanded
automatically.  This is an useful feature to have for tables in general.
I would like these operations supported in Emacs core rather than
peripheral libraries.  (If you look at initial comments on table.el, the
impression I get is that it is a "mini"-display engine.)





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

* RE: Rectangular regions
  2013-11-02  8:14                           ` Jambunathan K
  2013-11-02  9:56                             ` Stephen J. Turnbull
@ 2013-11-02 15:30                             ` Drew Adams
  2013-11-02 17:03                               ` Jambunathan K
  1 sibling, 1 reply; 92+ messages in thread
From: Drew Adams @ 2013-11-02 15:30 UTC (permalink / raw)
  To: Jambunathan K, Stephen J. Turnbull
  Cc: Jay Finger, emacs-devel, Bastien, Stefan Monnier, Josh,
	Eli Zaretskii, Daniel Colascione, Leo Liu

> > Users who use the function frequently can put it on an more
> > accessible sequence.
> 
> So, please provide multiple bindings

Why?

> If the number and nature of what the new mode can potentially
> do is a bit unclear, it might actually be better NOT to choose
> a prefix key right now.

Why?

C'mon folks.  Let's try to give reasons for our suggestions.



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

* Re: [SPAM] Re: Rectangular regions
  2013-11-02 14:56                                   ` Jambunathan K
@ 2013-11-02 16:59                                     ` Stephen J. Turnbull
  2013-11-02 17:19                                       ` Jambunathan K
  0 siblings, 1 reply; 92+ messages in thread
From: Stephen J. Turnbull @ 2013-11-02 16:59 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Jarek Czekalski, emacs-devel

Jambunathan K writes:
 > "Stephen J. Turnbull" <stephen@xemacs.org> writes:
 > 
 > > why regions beat rectangles.
 > 
 > > The point is that Emacsspeak is an inherently linear medium
 > 
 > Rectangles are but table-cells - either belonging to table.el table or
 > Org tables.

Not the rectangles associated with C-x r <key> commands -- they're
defined by arbitrary row and column positions in the buffer between
point and mark, quite a different notion.

 > Out of curiosity, how would Emacsspeak users mark a rectangle or
 > traverse among those.

By touch (-typing), of course.  I've seen people use a mouse with
audible indications of row/column position, although I don't know if
that's been implemented in Emacsspeak.  I've not seen this, but I bet
very good accuracy could be achieved with a drawing tablet.  But even
if accurate, use of a tablet would require taking your hand(s) off the
keyboard.

 > Do they never use tables at all?

They do everything any user does, of course.  But frequency of and
preference for various activities change.

 > I would like [some] operations [on table cells] supported in Emacs
 > core rather than peripheral libraries.

You'll need to get people to agree on a specific table format before
that will make sense.  Eg, is org-mode table compatible with table.el
table (in either direction)?  How about REST or markdown tables, etc?




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

* Re: Rectangular regions
  2013-11-02 15:30                             ` Drew Adams
@ 2013-11-02 17:03                               ` Jambunathan K
  0 siblings, 0 replies; 92+ messages in thread
From: Jambunathan K @ 2013-11-02 17:03 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

Drew Adams <drew.adams@oracle.com> writes:

>> > Users who use the function frequently can put it on an more
>> > accessible sequence.
>> 
>> So, please provide multiple bindings
>
> Why?

Why not?  C-x r seems to have lost the race already.

>> If the number and nature of what the new mode can potentially
>> do is a bit unclear, it might actually be better NOT to choose
>> a prefix key right now.
>
> Why?
>
> C'mon folks.  Let's try to give reasons for our suggestions.

I am talking more from my instincts.  

Stefan wouldn't have worked on rectangular regions in first place
without a bigger bigger plan.  Just my instincts.

Also look at my other post where I note that rectangular in and off
themselves are not as interesting as when they are stacked horizontally
and vertically and contains flowing text.






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

* Re: [SPAM] Re: Rectangular regions
  2013-11-02 16:59                                     ` Stephen J. Turnbull
@ 2013-11-02 17:19                                       ` Jambunathan K
  2013-11-03  8:41                                         ` Stephen J. Turnbull
  0 siblings, 1 reply; 92+ messages in thread
From: Jambunathan K @ 2013-11-02 17:19 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Jarek Czekalski, emacs-devel

"Stephen J. Turnbull" <stephen@xemacs.org> writes:

>  > Rectangles are but table-cells - either belonging to table.el table or
>  > Org tables.
>
> Not the rectangles associated with C-x r <key> commands -- they're
> defined by arbitrary row and column positions in the buffer between
> point and mark, quite a different notion.

Table-cells are rectangles with fancy and visible orders.  A useful
question to ask in the context of current discussion is this:

I want to clear a table-cell.  Will the rectangle command consult the
oracle, figure out the region and clear it.

I have a rectangular region.  Can I draw a border around it so that I
get a table cell or an artist's text box.

Can I choose a select a column - a stack of rectangles - presumably to
shift it right or left (but not to cut)

> You'll need to get people to agree on a specific table format before
> that will make sense.  Eg, is org-mode table compatible with table.el
> table (in either direction)?  How about REST or markdown tables, etc?

Emacs will be a mother supporting all the children and unlikely that it
will side with or prefer one markup over the other.

To give an example, in iimage mode I can configure a custom variable
which says how "in this buffer inline images that match this pattern".
When I insert such a pattern in the buffer and turn on iimage mode, I
get an image rich document.

In similar vein, rectangular command can provide per-mode and per-buffer
borders so that I can table-cell-ize a rectangle.

As an aside, I have had much success with table.el tables where I set up
a grid of say 25x25 cells.  Then "erase" the top, left, right and left
borders one at a time - i.e., merging adjacent cells - so that I get a
box diagram out of it.

This is an easier way to "align" the rectangles to a "baseline" rather
than having two independently drawn rectangles and having their borders
aligned along a vertical or an horizontal axis.




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

* Re: Rectangular regions
  2013-10-30  1:59 Rectangular regions Stefan Monnier
                   ` (8 preceding siblings ...)
  2013-11-01  9:25 ` Yuri Khan
@ 2013-11-02 17:36 ` Jambunathan K
  9 siblings, 0 replies; 92+ messages in thread
From: Jambunathan K @ 2013-11-02 17:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> A related issue is to find a mouse-binding for it.

Here is M-x view-lossage as I go about drawing a rectangle in
artist-mode.  So <down-mouse-1> ..... <drag-mouse-1> seems like a good
binding to select a rectangular region.  

May be a subsequent operation - mouse or otherwise - will tell what
magic will happen in that region.

----------------------------------------------------------------

<escape> x a r t i s t - m o d e <return> <escape> x <up> <return>
<help-echo> <help-echo> <help-echo> <help-echo> <menu-bar> <artist>
<rectangle> <down-mouse-1> <mouse-movement> <mouse-movement>
<drag-mouse-1>



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

* Re: Rectangular regions
  2013-11-02  7:00                                 ` Eli Zaretskii
@ 2013-11-02 18:20                                   ` Josh
  2013-11-02 19:35                                     ` Eli Zaretskii
  0 siblings, 1 reply; 92+ messages in thread
From: Josh @ 2013-11-02 18:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Daniel Colascione, Stefan Monnier, emacs-devel

On Sat, Nov 2, 2013 at 12:00 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Josh <josh@foxtail.org>
>> Date: Fri, 1 Nov 2013 16:35:05 -0700
>> Cc: Daniel Colascione <dancol@dancol.org>,
>>       Stefan Monnier <monnier@iro.umontreal.ca>,
>>       emacs-devel <emacs-devel@gnu.org>
>>
>> I also use rectangle commands in programming modes from time to
>> time, and not in comments.  For example, I can often perform
>> simultaneous edits to common substrings of columnar data such as
>> enum elements far more efficiently with a rectangle command than I
>> could using a keyboard macro or replace-regexp.
>
> The important questions: are these uses more frequent than using GUD
> on the same sources?

As I never use GUD at all, yes.  None of my Emacs-using coworkers do
either, FWIW.  I'd be surprised if a large proportion of typical Emacs users
(i.e. not those who frequent emacs-devel) used GUD; do you have reason
to believe that is the case?

>> I also use rectangle commands quite often when when transforming
>> extracts from log files into a form suitable for programmatic use.
>
> In this case, the rectangular mark is not set in a buffer where the
> major mode supports some programming language.  So I don't think these
> cases count for the discussion at hand.

Your premise is incorrect.  I insert raw log extracts into C or Verilog mode
buffers from the system clipboard or via insert-file and perform the edits
there using rectangle commands.



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

* Re: Rectangular regions
  2013-11-02 18:20                                   ` Josh
@ 2013-11-02 19:35                                     ` Eli Zaretskii
  0 siblings, 0 replies; 92+ messages in thread
From: Eli Zaretskii @ 2013-11-02 19:35 UTC (permalink / raw)
  To: Josh; +Cc: dancol, monnier, emacs-devel

> From: Josh <josh@foxtail.org>
> Date: Sat, 2 Nov 2013 11:20:34 -0700
> Cc: Daniel Colascione <dancol@dancol.org>, Stefan Monnier <monnier@iro.umontreal.ca>, 
> 	emacs-devel <emacs-devel@gnu.org>
> 
> > The important questions: are these uses more frequent than using GUD
> > on the same sources?
> 
> As I never use GUD at all, yes.  None of my Emacs-using coworkers do
> either, FWIW.  I'd be surprised if a large proportion of typical Emacs users
> (i.e. not those who frequent emacs-devel) used GUD; do you have reason
> to believe that is the case?

Emacs is one of the best, if not the only, GUI front-end for GDB on
Posix systems.  Everybody _I_ work with use it when they work on Posix
systems.  (On Windows, they use MS tools, so GDB is not an issue.)



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

* Re: Rectangular regions
  2013-11-03  0:59                           ` Stefan Monnier
@ 2013-11-03  0:36                             ` Jambunathan K
  0 siblings, 0 replies; 92+ messages in thread
From: Jambunathan K @ 2013-11-03  0:36 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: Jay Finger, emacs-devel, Bastien, Stephen J. Turnbull, Josh,
	Eli Zaretskii, Daniel Colascione, Leo Liu, Drew Adams

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> OTOH rectangle-mark-mode makes most of the C-x r rectangle commands
> accessible without using C-x r (the main exceptions currently are
> string-rectangle and open-rectangle)

That essentially means C-x r for rectangles will be around for some
time.  Please add a binding that wouldn't use any punctuation mark - I
am against using #.



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

* Re: Rectangular regions
  2013-11-02  6:31                         ` Stephen J. Turnbull
  2013-11-02  8:14                           ` Jambunathan K
@ 2013-11-03  0:59                           ` Stefan Monnier
  2013-11-03  0:36                             ` Jambunathan K
  1 sibling, 1 reply; 92+ messages in thread
From: Stefan Monnier @ 2013-11-03  0:59 UTC (permalink / raw)
  To: Stephen J. Turnbull
  Cc: Jay Finger, emacs-devel, Bastien, Josh, Eli Zaretskii,
	Daniel Colascione, Leo Liu, Drew Adams

> Discoverability of the default bindings is very important.  If it's on
> C-x r, C-x r C-h will list it for you.

That's true.  OTOH rectangle-mark-mode makes most of the C-x r rectangle
commands accessible without using C-x r (the main exceptions currently
are string-rectangle and open-rectangle), so in a sense it makes the
"C-x r for rectangle" prefix obsolete (not the whole C-x r prefix, of
course, since the register operations are completely independent).


        Stefan



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

* Re: [SPAM] Re: Rectangular regions
  2013-11-02 17:19                                       ` Jambunathan K
@ 2013-11-03  8:41                                         ` Stephen J. Turnbull
  0 siblings, 0 replies; 92+ messages in thread
From: Stephen J. Turnbull @ 2013-11-03  8:41 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-devel

Jambunathan K writes:

 > Table-cells are rectangles with fancy and visible orders.

No, they aren't.  A "rectangle" in Emacs as currently implemented is
the intersection of the rows between the row position of point and the
row position of mark (both inclusive) and the columns between the
column position of point and the column position of mark (both
inclusive).  In other words, it is (implemented as) two buffer
positions.

Table cells (in table.el, restructured text, and markdown) are defined
rather by their borders, as indicated by actual buffer text (possibly
implicit for most cells, as in the case of restructured text simple
tables).  IIRC, in those modes, there is no "internal" (ie, Lispy)
representation of a table; rather, each table command parses the
buffer.

And that's the design issue here.  There is *no* unity, certainly not
based on the rectangle commands.  One needs to be created before it
makes sense to talk about adding a facility to core.

Steve







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

* Re: Rectangular regions
  2013-10-31 12:05           ` Jose E. Marchesi
@ 2013-11-05 18:57             ` Stefan Monnier
  2013-11-05 19:31               ` Drew Adams
  0 siblings, 1 reply; 92+ messages in thread
From: Stefan Monnier @ 2013-11-05 18:57 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: Bastien, Eli Zaretskii, dancol, sdl.web, emacs-devel

>> Why is everybody ignoring the "C-x SPC" suggestion?
>     I like it too, indeed.
> Same here.

A possible alternative would be to use a binding that's only active when
the region is highlighted.  So the way to use it would be C-SPC <rmmkey>
where rmmkey is the key bound to rectangle-mark-mode.

Not sure which key would be appropriate, but restricting this use to the
"active region case" opens up the possibility of choosing a key that's
in common use, tho not when the region is active.

A mnemonic key would be C-r, except that C-r already has a useful
meaning when the region is active.


        Stefan



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

* RE: Rectangular regions
  2013-11-05 18:57             ` Stefan Monnier
@ 2013-11-05 19:31               ` Drew Adams
  0 siblings, 0 replies; 92+ messages in thread
From: Drew Adams @ 2013-11-05 19:31 UTC (permalink / raw)
  To: Stefan Monnier, jemarch
  Cc: Bastien, Eli Zaretskii, dancol, sdl.web, emacs-devel

> A possible alternative would be to use a binding that's only active
> when the region is highlighted.
>
> Not sure which key would be appropriate, but restricting this use to
> the "active region case" opens up the possibility of choosing a key
> that's in common use, tho not when the region is active.
> 
> A mnemonic key would be C-r, except that C-r already has a useful
> meaning when the region is active.

It's a good idea.

It would be ideal if it could somehow be limited even more: not
whenever the region is active, but whenever it is active and being
used as a rectangle.  Alas, that is presumably impossible (since it
is this command that is deciding to treat the region as a rectangle).

That's OK.  But it means that whatever key is chosen should not be a
key that one might want to use to act otherwise on the active region.

In particular, it (again) should not be a simple repeatable key, as
those are likely to be useful for acting incrementally on the region.
And this applies even to future operations on the region when it is
interpreted as a rectangle - some of those might need to be easily
repeatable too.

So `C-SPC' is (again) not a good choice for the key, even when the
context is limited to the active region.  Likewise, `C-r' (even
aside from not being available because taken for Isearch).

+1 for the general idea.  But let's not waste an easily repeatable
key for this.

Future commands that operate on the region-as-rectangle would
presumably know that the region is being interpreted as a rectangle.
The keys for those commands, at least, could presumably be bound
for just that context, i.e., not bound whenever the region is
active, but only when the active region is being used as a rectangle.



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

* Re: Rectangular regions
  2013-10-31 17:17           ` Stefan Monnier
                               ` (2 preceding siblings ...)
  2013-10-31 21:03             ` Josh
@ 2013-11-05 19:47             ` Mathias Dahl
  3 siblings, 0 replies; 92+ messages in thread
From: Mathias Dahl @ 2013-11-05 19:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Bastien, Eli Zaretskii, dancol, Leo Liu, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]

> - It could be bound to:
>   M-#
>   M-_
>   M-+
>   M-SPC
>   C-x SPC
>   C-x r C-SPC
>   C-SPC C-SPC C-SPC
>   C-x C-x C-x C-x C-x C-x
>

Just a small comment from someone using a Swedish keyboard layout: many of
the key bindings suggested in this thread are really awkward to type and I
would guess some of the other European keyboard layoyts are causing the
same problems. For me, any combination that uses a modifier key (C- or M-)
together with a key that I need to use AltGr to type, are tough ones. For
me, this includes all bindings that has keys like @, ^, \, [ and ] in them,
just to take some examples. Yes, I sometimes switch to an English keyboard
layout to make use of the "classic" bindings, but I don't think we should
expect that everyone does this. And yes, I do know about input methods...

I would personally prefer this to be placed somewhere under the C-x r
keymap (I like C-x r C-SPC, even if it removes one of the bindings for
point-to-register), for consistency and discoverability, as some here has
already stated.

/Mathias

[-- Attachment #2: Type: text/html, Size: 1391 bytes --]

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

* Re: Rectangular regions
  2013-11-01 18:25                   ` Stefan Monnier
  2013-11-01 19:05                     ` Drew Adams
@ 2013-11-05 22:44                     ` Davis Herring
  1 sibling, 0 replies; 92+ messages in thread
From: Davis Herring @ 2013-11-05 22:44 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: Jay Finger, Xue Fuqiao, emacs-devel, Bastien, Eli Zaretskii,
	Daniel Colascione, Leo Liu

> Indeed, we could also use S-SPC: it's not available under ttys, but is
> otherwise free.

That would interfere with holding Shift while typing, for instance,

#define MACRO_A MACRO_B

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.



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

end of thread, other threads:[~2013-11-05 22:44 UTC | newest]

Thread overview: 92+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-30  1:59 Rectangular regions Stefan Monnier
2013-10-30  2:15 ` Dmitry Gutov
2013-10-30  2:59   ` Stefan Monnier
2013-10-30  3:22 ` Leo Liu
2013-10-30  3:29   ` Daniel Colascione
2013-10-30 18:09     ` Stefan Monnier
2013-10-30 18:24       ` Bastien
2013-10-30 19:20       ` Eli Zaretskii
2013-10-30 23:35         ` Bastien
2013-10-31 12:05           ` Jose E. Marchesi
2013-11-05 18:57             ` Stefan Monnier
2013-11-05 19:31               ` Drew Adams
2013-10-31 17:17           ` Stefan Monnier
2013-10-31 18:11             ` Jambunathan K
2013-10-31 18:36             ` Jay Finger
2013-10-31 18:54               ` Eli Zaretskii
2013-10-31 19:28                 ` Daniel Colascione
2013-10-31 19:38               ` Daniel Colascione
2013-10-31 19:44                 ` Eli Zaretskii
2013-11-01  1:50                 ` Stefan Monnier
2013-11-01  8:01                   ` Eli Zaretskii
2013-10-31 22:50               ` Xue Fuqiao
2013-11-01 17:12                 ` Jay Finger
2013-11-01 18:25                   ` Stefan Monnier
2013-11-01 19:05                     ` Drew Adams
2013-11-01 19:25                       ` John Yates
2013-11-05 22:44                     ` Davis Herring
2013-11-01  1:40               ` Stefan Monnier
2013-11-01  2:13                 ` Leo Liu
2013-11-01  3:06                   ` Josh
2013-11-01  4:42                     ` Leo Liu
2013-11-01  5:55                       ` Josh
2013-11-01  8:33                         ` Jambunathan K
2013-11-02 10:25                           ` Xue Fuqiao
2013-11-01 15:04                       ` Drew Adams
2013-11-02  6:31                         ` Stephen J. Turnbull
2013-11-02  8:14                           ` Jambunathan K
2013-11-02  9:56                             ` Stephen J. Turnbull
2013-11-02 10:05                               ` [SPAM] " Jarek Czekalski
2013-11-02 11:00                                 ` Stephen J. Turnbull
2013-11-02 14:56                                   ` Jambunathan K
2013-11-02 16:59                                     ` Stephen J. Turnbull
2013-11-02 17:19                                       ` Jambunathan K
2013-11-03  8:41                                         ` Stephen J. Turnbull
2013-11-02 15:30                             ` Drew Adams
2013-11-02 17:03                               ` Jambunathan K
2013-11-03  0:59                           ` Stefan Monnier
2013-11-03  0:36                             ` Jambunathan K
2013-11-01 15:04                     ` Drew Adams
2013-11-01  8:04                   ` Eli Zaretskii
2013-11-01 15:04                   ` Drew Adams
2013-11-01  7:57                 ` Eli Zaretskii
2013-11-01 12:35                   ` Stefan Monnier
2013-11-01 19:26                     ` Eli Zaretskii
2013-11-01 19:55                       ` Stefan Monnier
2013-11-01 19:59                         ` Eli Zaretskii
2013-11-01 20:02                           ` Daniel Colascione
2013-11-01 20:20                             ` Eli Zaretskii
2013-11-01 23:35                               ` Josh
2013-11-02  7:00                                 ` Eli Zaretskii
2013-11-02 18:20                                   ` Josh
2013-11-02 19:35                                     ` Eli Zaretskii
2013-11-01 16:57                 ` Jay Finger
2013-10-31 21:03             ` Josh
2013-11-01  2:01               ` Stefan Monnier
2013-11-05 19:47             ` Mathias Dahl
2013-10-30 20:31       ` John Yates
2013-10-31 20:23     ` Richard Stallman
2013-11-01  7:40       ` Eli Zaretskii
2013-10-30  4:55   ` Stephen J. Turnbull
2013-10-31 13:39   ` Xue Fuqiao
2013-10-30  3:52 ` Eli Zaretskii
2013-10-30  4:22   ` Stefan Monnier
2013-10-31 20:23   ` Richard Stallman
2013-11-01  1:59     ` Stefan Monnier
2013-10-30  3:55 ` Eli Zaretskii
2013-10-30 10:36 ` Bastien
2013-10-30 10:39   ` Bastien
2013-10-30 10:49   ` Andreas Schwab
2013-10-31 20:22     ` Richard Stallman
2013-11-01  0:54       ` Leo Liu
2013-10-30 13:19 ` Jambunathan K
2013-10-30 14:53   ` Josh
2013-10-30 16:56   ` Jambunathan K
2013-10-30 18:07 ` Jambunathan K
2013-10-31 20:22 ` Richard Stallman
2013-11-01  9:25 ` Yuri Khan
2013-11-01 11:20   ` Eli Zaretskii
2013-11-01 12:57     ` Stefan Monnier
2013-11-01 14:31       ` Eli Zaretskii
2013-11-01 15:08       ` Yuri Khan
2013-11-02 17:36 ` Jambunathan K

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