unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Can we support multiple Cursors?
       [not found] <m2oaayavh1.wl%esq@lawlist.com>
@ 2016-03-03  6:30 ` John Wiegley
  2016-03-03  6:54   ` Marcin Borkowski
  0 siblings, 1 reply; 15+ messages in thread
From: John Wiegley @ 2016-03-03  6:30 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 22873, emacs-devel

>>>>> Keith David Bershatsky <esq@lawlist.com> writes:

> As a feature request, it would be appreciated if the Emacs development team
> could please consider adding built-in support for multiple cursors similar
> to the Lisp library that Magnar Sveen has written:
> https://github.com/magnars

I like this request, but my spidey sense tells me that implementing this at
the C level will introduce a huge number of ramifications that may not be
immediately apparent. For example, (point) conceptually goes from being one
position, to many. The implications of that are huge, which will mean
introducing special cases to avoid them, which then has its own implications,
etc.

I'd like to see discussion on this idea in emacs-devel, so I'm copying there.
This is something that deserves a larger audience than just those following
bug #22873. Is multiple-cursor editing a realistic possibility? And is it
worth the complexity?

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

* Re: Can we support multiple Cursors?
  2016-03-03  6:30 ` Can we support multiple Cursors? John Wiegley
@ 2016-03-03  6:54   ` Marcin Borkowski
  2016-03-03 11:20     ` bug#22873: " Richard Stallman
  0 siblings, 1 reply; 15+ messages in thread
From: Marcin Borkowski @ 2016-03-03  6:54 UTC (permalink / raw)
  To: John Wiegley; +Cc: Keith David Bershatsky, 22873, emacs-devel


On 2016-03-03, at 07:30, John Wiegley <jwiegley@gmail.com> wrote:

>>>>>> Keith David Bershatsky <esq@lawlist.com> writes:
>
>> As a feature request, it would be appreciated if the Emacs development team
>> could please consider adding built-in support for multiple cursors similar
>> to the Lisp library that Magnar Sveen has written:
>> https://github.com/magnars
>
> I like this request, but my spidey sense tells me that implementing this at
> the C level will introduce a huge number of ramifications that may not be
> immediately apparent. For example, (point) conceptually goes from being one
> position, to many. The implications of that are huge, which will mean
> introducing special cases to avoid them, which then has its own implications,
> etc.
>
> I'd like to see discussion on this idea in emacs-devel, so I'm copying there.
> This is something that deserves a larger audience than just those following
> bug #22873. Is multiple-cursor editing a realistic possibility? And is it
> worth the complexity?

What would be the added value of having that built-in vs. having it on
M?elpa?

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-03  6:54   ` Marcin Borkowski
@ 2016-03-03 11:20     ` Richard Stallman
  2016-03-03 15:05       ` Marcin Borkowski
  0 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2016-03-03 11:20 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: esq, johnw, 22873, 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 would be the added value of having that built-in vs. having it on
  > M?elpa?

Melpa and ELPA are totally different.

ELPA is effectively an extension of Emacs, and we refer users there.

Melpa is someone else's repository, which we cannot treat as part of
Emacs.  We do not steer users there.

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.




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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-03 11:20     ` bug#22873: " Richard Stallman
@ 2016-03-03 15:05       ` Marcin Borkowski
  2016-03-04  9:19         ` Richard Stallman
  0 siblings, 1 reply; 15+ messages in thread
From: Marcin Borkowski @ 2016-03-03 15:05 UTC (permalink / raw)
  To: rms; +Cc: esq, johnw, 22873, emacs-devel


On 2016-03-03, at 12:20, Richard Stallman <rms@gnu.org> wrote:

> [[[ 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 would be the added value of having that built-in vs. having it on
>   > M?elpa?
>
> Melpa and ELPA are totally different.
>
> ELPA is effectively an extension of Emacs, and we refer users there.
>
> Melpa is someone else's repository, which we cannot treat as part of
> Emacs.  We do not steer users there.

I understand all this.  (In fact, I wanted to write Elpa, only to
discover - to my surprise - that Magnar's multiple-cursors package is
actually on Melpa.  It is GPL'd, however.)

Still, I think that trying to implement that in core would be duplicated
effort, and the feature does not seem essential (it is roughly
equivalent to keyboard macros, though admittedly way cooler).  If
anything, I'd check whether it can be put on Elpa.

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-03 15:05       ` Marcin Borkowski
@ 2016-03-04  9:19         ` Richard Stallman
  2016-03-04 14:59           ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2016-03-04  9:19 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: esq, johnw, 22873, 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 understand all this.  (In fact, I wanted to write Elpa, only to
  > discover - to my surprise - that Magnar's multiple-cursors package is
  > actually on Melpa.  It is GPL'd, however.)

Would he / can he contribute it so we can put it in ELPA?

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.




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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-04  9:19         ` Richard Stallman
@ 2016-03-04 14:59           ` Stefan Monnier
  2016-03-04 22:18             ` Magnar Sveen
  2016-03-05 12:58             ` Richard Stallman
  0 siblings, 2 replies; 15+ messages in thread
From: Stefan Monnier @ 2016-03-04 14:59 UTC (permalink / raw)
  To: emacs-devel

>> I understand all this.  (In fact, I wanted to write Elpa, only to
>> discover - to my surprise - that Magnar's multiple-cursors package is
>> actually on Melpa.  It is GPL'd, however.)

> Would he / can he contribute it so we can put it in ELPA?

He already signed all the needed paperwork.  But there are probably
other contributors who haven't.


        Stefan




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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-04 14:59           ` Stefan Monnier
@ 2016-03-04 22:18             ` Magnar Sveen
  2016-03-05  2:16               ` Stefan Monnier
  2016-03-06 20:33               ` Clément Pit--Claudel
  2016-03-05 12:58             ` Richard Stallman
  1 sibling, 2 replies; 15+ messages in thread
From: Magnar Sveen @ 2016-03-04 22:18 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

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

I'm pretty sure you don't want my multiple-cursors.el as an official
package. It's a major hack, basically trying to emulate the emacs command
loop in a post-command hook. After quite a lot of work, it now functions
properly for most commands - but it doesn't play so well in the presence of
other major hacks (like Evil).

I would say multiple cursors should be done properly if official.

Things that would help the multiple-cursors package, and also be a step
towards real support:

- allowing rendering of faux cursors. Right now I'm using inverted overlays
to create a block cursor (only).
- introduce the concept of cursor-local vars, much like buffer-local vars.
Right now I'm keeping track of a curated list of these in the package.
- document the inner workings of the command loop somewhere. This is what I
have right now:

(defun mc/execute-command (cmd)
  "Run command, simulating the parts of the command loop that makes sense
for fake cursors."
  (setq this-command cmd)
  (run-hooks 'pre-command-hook)
  (unless (eq this-command 'ignore)
    (call-interactively cmd))
  (run-hooks 'post-command-hook)
  (when deactivate-mark (deactivate-mark)))

I'm sure there's some nuance I'm missing, since there are still the odd
command that interacts oddly with it.

- Magnar


On Fri, Mar 4, 2016 at 3:59 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> >> I understand all this.  (In fact, I wanted to write Elpa, only to
> >> discover - to my surprise - that Magnar's multiple-cursors package is
> >> actually on Melpa.  It is GPL'd, however.)
>
> > Would he / can he contribute it so we can put it in ELPA?
>
> He already signed all the needed paperwork.  But there are probably
> other contributors who haven't.
>
>
>         Stefan
>
>
>

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

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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-04 22:18             ` Magnar Sveen
@ 2016-03-05  2:16               ` Stefan Monnier
  2016-03-05 13:00                 ` Richard Stallman
                                   ` (2 more replies)
  2016-03-06 20:33               ` Clément Pit--Claudel
  1 sibling, 3 replies; 15+ messages in thread
From: Stefan Monnier @ 2016-03-05  2:16 UTC (permalink / raw)
  To: Magnar Sveen; +Cc: emacs-devel

> I'm pretty sure you don't want my multiple-cursors.el as an official
> package.

Being in GNU ELPA doesn't mean it's "official".  It does grant some kind
of respectability, but the main things it does is:
- make sure the code has a reliable license (usually, not a bug deal
  for the end user).
- make sure it can be installed out of the box without any extra customization.
- gets to be seen (and can be fixed) by Emacs's maintainers, so tends to
  follow the conventions a bit better.
- gets to be seen by whoever watches elpa-diffs, so might be ever so
  slightly less at risk of malware.
- gets to be seen by Emacs's maintainers so they may become aware of
  some issues that might require changes to the core.
...

> - allowing rendering of faux cursors. Right now I'm using inverted overlays
> to create a block cursor (only).

Seems like a good solution.  If this bumps into problems, we should
probably try and improve overlay support rather than try to add
specific "multi-cursor" support in the redisplay engine.

> (defun mc/execute-command (cmd)
>   "Run command, simulating the parts of the command loop that makes sense
> for fake cursors."
>   (setq this-command cmd)
>   (run-hooks 'pre-command-hook)
>   (unless (eq this-command 'ignore)
>     (call-interactively cmd))
>   (run-hooks 'post-command-hook)
>   (when deactivate-mark (deactivate-mark)))

FWIW, we could/should work to move execute-command as well as the
read-eval loop from C to Elisp.

Note that the above is "wrong" also in the sense that execute-command does
not run pre/post command hooks (this is done by the read-eval loop
instead, around the call to command-execute).


        Stefan



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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-04 14:59           ` Stefan Monnier
  2016-03-04 22:18             ` Magnar Sveen
@ 2016-03-05 12:58             ` Richard Stallman
  1 sibling, 0 replies; 15+ messages in thread
From: Richard Stallman @ 2016-03-05 12:58 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. ]]]

  > He already signed all the needed paperwork.  But there are probably
  > other contributors who haven't.

Could you talk with him about the situation?  Maybe we can
do without them.

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.




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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-05  2:16               ` Stefan Monnier
@ 2016-03-05 13:00                 ` Richard Stallman
  2016-03-06  4:47                 ` John Wiegley
  2016-03-06 20:30                 ` Clément Pit--Claudel
  2 siblings, 0 replies; 15+ messages in thread
From: Richard Stallman @ 2016-03-05 13:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, magnar

[[[ 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. ]]]

  > Being in GNU ELPA doesn't mean it's "official".

It does, in some ways.  The packages in GNU ELPA are treated
mostly like part of Emacs, just distributed separately.

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.




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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-05  2:16               ` Stefan Monnier
  2016-03-05 13:00                 ` Richard Stallman
@ 2016-03-06  4:47                 ` John Wiegley
  2016-03-06 20:30                 ` Clément Pit--Claudel
  2 siblings, 0 replies; 15+ messages in thread
From: John Wiegley @ 2016-03-06  4:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, Magnar Sveen

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

> FWIW, we could/should work to move execute-command as well as the read-eval
> loop from C to Elisp.

I would like to see that happen too, if it makes sense.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-05  2:16               ` Stefan Monnier
  2016-03-05 13:00                 ` Richard Stallman
  2016-03-06  4:47                 ` John Wiegley
@ 2016-03-06 20:30                 ` Clément Pit--Claudel
  2016-03-08  4:53                   ` Stefan Monnier
  2 siblings, 1 reply; 15+ messages in thread
From: Clément Pit--Claudel @ 2016-03-06 20:30 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 596 bytes --]

On 03/04/2016 09:16 PM, Stefan Monnier wrote:
>> > - allowing rendering of faux cursors. Right now I'm using inverted overlays
>> > to create a block cursor (only).
>
> Seems like a good solution.  If this bumps into problems, we should
> probably try and improve overlay support rather than try to add
> specific "multi-cursor" support in the redisplay engine.

It already bumps into problems: when you set your cursor to a bar and use use multiple cursors, only the real one actually looks like a bar.
Maybe we could add an overlay property to display a cursor at the left edge?
 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-04 22:18             ` Magnar Sveen
  2016-03-05  2:16               ` Stefan Monnier
@ 2016-03-06 20:33               ` Clément Pit--Claudel
  2016-03-08  4:55                 ` Stefan Monnier
  1 sibling, 1 reply; 15+ messages in thread
From: Clément Pit--Claudel @ 2016-03-06 20:33 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 367 bytes --]

On 03/04/2016 05:18 PM, Magnar Sveen wrote:
> I'm sure there's some nuance I'm missing, since there are still the odd command that interacts oddly with it. 

Indeed: one such example is moving out of a composed region: secondary cursors (fake ones) move into prettified (composed) symbols, while the real cursor skips straight to the edges of composed regions.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-06 20:30                 ` Clément Pit--Claudel
@ 2016-03-08  4:53                   ` Stefan Monnier
  0 siblings, 0 replies; 15+ messages in thread
From: Stefan Monnier @ 2016-03-08  4:53 UTC (permalink / raw)
  To: emacs-devel

>>> > - allowing rendering of faux cursors. Right now I'm using inverted
>>> > overlays to create a block cursor (only).
>> Seems like a good solution.  If this bumps into problems, we should
>> probably try and improve overlay support rather than try to add
>> specific "multi-cursor" support in the redisplay engine.
> It already bumps into problems: when you set your cursor to a bar and use
> use multiple cursors, only the real one actually looks like a bar.
> Maybe we could add an overlay property to display a cursor at the left edge?
 
Sounds like a fair solution.  Tho maybe it'd be even better to be able
to specify an overlay with a "bar cursor like thingy" regardless of what
kind of cursor is currently used.


        Stefan




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

* Re: bug#22873: Can we support multiple Cursors?
  2016-03-06 20:33               ` Clément Pit--Claudel
@ 2016-03-08  4:55                 ` Stefan Monnier
  0 siblings, 0 replies; 15+ messages in thread
From: Stefan Monnier @ 2016-03-08  4:55 UTC (permalink / raw)
  To: emacs-devel

>> I'm sure there's some nuance I'm missing, since there are still the odd
>> command that interacts oddly with it. 

> Indeed: one such example is moving out of a composed region: secondary
> cursors (fake ones) move into prettified (composed) symbols, while the real
> cursor skips straight to the edges of composed regions.

Right: the adjust_point_for_property (in src/keyboard.c) functionality
should be exposed to Elisp.  It would be a part of a rewrite of the
read-eval loop.


        Stefan




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

end of thread, other threads:[~2016-03-08  4:55 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m2oaayavh1.wl%esq@lawlist.com>
2016-03-03  6:30 ` Can we support multiple Cursors? John Wiegley
2016-03-03  6:54   ` Marcin Borkowski
2016-03-03 11:20     ` bug#22873: " Richard Stallman
2016-03-03 15:05       ` Marcin Borkowski
2016-03-04  9:19         ` Richard Stallman
2016-03-04 14:59           ` Stefan Monnier
2016-03-04 22:18             ` Magnar Sveen
2016-03-05  2:16               ` Stefan Monnier
2016-03-05 13:00                 ` Richard Stallman
2016-03-06  4:47                 ` John Wiegley
2016-03-06 20:30                 ` Clément Pit--Claudel
2016-03-08  4:53                   ` Stefan Monnier
2016-03-06 20:33               ` Clément Pit--Claudel
2016-03-08  4:55                 ` Stefan Monnier
2016-03-05 12:58             ` Richard Stallman

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