all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: John Wiegley <jwiegley@gmail.com>,
	Marcin Borkowski <mbork@mbork.pl>,
	22873@debbugs.gnu.org, Richard Stallman <rms@gnu.org>
Subject: bug#22873: Can we support multiple Cursors?
Date: Sun, 25 Jun 2017 15:09:16 -0700	[thread overview]
Message-ID: <m21sq7zpmb.wl%esq@lawlist.com> (raw)
In-Reply-To: <m2oaayavh1.wl%esq@lawlist.com>

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

WHAT'S NEW:

-  Fake cursors now only appear in the selected-window if the `mc-list' is defined -- i.e., the fake cursors are removed when the window loses focus, and they are added again when the window acquires focus.

-  `mc_color_vector_calculate` will take the familiar Emacs way of specifying colors (e.g., "red" and "#FF0000") and convert them internally to the LSL color vector.  The conversion process is transparent to the user.

-  `mc_remove_when_scrolled` will remove multiple cursors when scrolling.  This is important because `update_window_end` will not remove the cursors when scrolling.  [There was an emacs-devel thread (about 1.5 years ago) where I had sought help tracking the multiple cursors when scrolling.  It turned out that the method of tracking cursors was not the problem (since they don't move) -- it was simply that `update_window_end` was not being called in that circumstance.]

-  `mc_x_y_hpos_vpos' contains some extra `stuff` that is irrelevant to the functionality of this patch -- the extra `stuff` is used by me as a workaround to deal with the overlay after-string property that gets in the way of properly calculating coordinates.  [See the TODO section below.]

-  The patch applies to commit a30e7e12ed8465e2565dd318d921bc87f52ce18e from 03/28/2016.  [See apology for the inconvenience further down below.]


TODO:

-  Optimize drawing and removal of multiple fake cursors.

-  Fix any bugs (there will surely be many).

-  Implement a way to properly calculate x, y, hpos, vpos when overlays are present -- e.g., the overlay after-string property wreaks havoc on the current method of calculating coordinates.

-  Try and convince one or more real programmers to take over from here, since we now have a working proof concept.  [I am just a weekend hobbyist without any formal programming study.]


SUGGESTION:

I would respectfully suggest to the Emacs development team that multiple cursors be implemented in two stages:

-  The first stage would be the creation and removal of fake cursors to be used kind of like overlays.  I.e., specify the `point`, cursor-style, and color.  The suggestion by Eli Z. to support specifying colors with strings like "red" and "#FF0000" has now been implemented.

-  The second stage would be to implement built-in functionality similar to the multiple cursors library by Magnar Sveen.


[In an earlier section of this thread, I mentioned a substantial slow-down that I experienced when using the library written by Mr. Sveen.  I have since discovered that it was due to `line-number-at-pos', and I have already reached out to the author with an alternative suggestion to use (format-mode-line "%l").]


INSTALLATION (for anyone a little less familiar):

STEP #1 (clone master branch):  git clone -b master git://git.sv.gnu.org/emacs.git

STEP #2:  cd over to the root of the `emacs` source directory cloned in the first step above.

STEP #3 (hard reset):  git reset --hard a30e7e12ed8465e2565dd318d921bc87f52ce18e

You will see a message:  "HEAD is now at a30e7e1 Mention the `M-q' changes"

[We need to go back in time to 03/28/2016 as that is the master branch version that I am still using -- sorry for the inconvenience.  I will update to the latest version of Emacs at some point in the future as time permits.  Creating patches that apply to a "moving target" is challenging.]

STEP #4 (put the patch in place):  Copy the latest patch (multiple_cursors_008.diff) to the root of the emacs source directory cloned in the first step above.

STEP #5 (apply the patch):  git apply multiple_cursors_008.diff

STEP #6:  ./autogen.sh

STEP #7:  Configure the build for X, MS Windows, or OSX; e.g.,:  ./configure --with-ns

STEP #8:  make

STEP #9:  make install

STEP #10:  Launch the newly built Emacs, and copy the following function to the `*scratch*` buffer, and type `M-x mc-test`.

(defun mc-test ()
"Draw fake cursors at all POS defined in the `mc-list'.  Multiple fake cursors
are supported by GUI versions of Emacs built for X, Windows and OSX.
Popular forms of specifying colors such as \"red\" and \"#FF0000\" are now
supported, as well as LSL color vectors such as [1.0 0.0 0.0].  For those users
who choose the former familiar methods of specifying colors with strings,
`mc_color_vector_calculate' will convert those strings to LSL color vectors.
The color vectors are commonly referred to as LSL (The Linden Scripting Language).
`nsterm.m' uses `NSColor', which works well with LSL.  `w32term.c' uses
`PALETTERGB' or `RGB', and the conversion from LSL is done internally by
multiplying each element of the LSL color vector by 255.  `xterm.c' uses
`x_make_truecolor_pixel', which uses 16-bit RGB -- the conversion from LSL
happens internally by multiplying each element of the LSL color vector by 65535."
(interactive)
  (let ((buffer (get-buffer-create "*MC-TEST*")))
    (with-current-buffer buffer
      (erase-buffer)
      (insert "This is a test!")
      (setq mc-list '((1 "hbar" "red")
                      (2 "bar" "yellow")
                      (3 "box" "#00FF00")
                      (4 "hollow" "#0000FF")
                      (5 ("hbar" 3) [1.0 0.0 1.0])
                      (6 ("bar" 3) [0.0 1.0 1.0]))))
    (select-window (display-buffer buffer))
    ;;; The trigger in `keyboard.c` is not activated in this example, so we
    ;;; Force the multiple cursors to be drawn.
    (mc-draw-erase (selected-window))))



[-- Attachment #2: multiple_cursors_008.diff --]
[-- Type: application/diff, Size: 68462 bytes --]

  parent reply	other threads:[~2017-06-25 22:09 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 18:44 bug#22873: 25.1.50; Feature Request -- Multiple Cursors (built-in support) Keith David Bershatsky
2016-03-03  6:30 ` Can we support multiple Cursors? John Wiegley
2016-03-03  6:54   ` bug#22873: " Marcin Borkowski
2016-03-03  6:54   ` Marcin Borkowski
2016-03-03 11:20     ` bug#22873: " Richard Stallman
2016-03-03 11:20     ` Richard Stallman
2016-03-03 15:05       ` Marcin Borkowski
2016-03-03 15:05       ` Marcin Borkowski
2016-03-04  9:19         ` Richard Stallman
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
2016-03-03  6:30 ` John Wiegley
2016-03-04 23:16 ` Keith David Bershatsky
2016-03-05  6:59   ` Marcin Borkowski
2016-03-09  6:50   ` Keith David Bershatsky
2016-03-09  6:27 ` Keith David Bershatsky
2016-03-09  6:45   ` Keith David Bershatsky
2016-03-09 16:03   ` Eli Zaretskii
2016-03-09 18:30 ` Keith David Bershatsky
2016-03-11  7:18 ` Keith David Bershatsky
2016-03-14 18:35 ` Keith David Bershatsky
2016-03-14 18:49   ` Eli Zaretskii
2016-03-14 22:38 ` Keith David Bershatsky
2016-03-16  8:00 ` Keith David Bershatsky
2016-03-18  4:00 ` Keith David Bershatsky
2016-03-26 23:58   ` John Wiegley
2016-03-29  3:45 ` Keith David Bershatsky
2016-03-29 14:58   ` Eli Zaretskii
2016-03-29 17:26 ` Keith David Bershatsky
2017-06-25 22:09 ` Keith David Bershatsky [this message]
2017-07-30 17:39 ` Keith David Bershatsky
2017-08-11  0:00 ` bug#22873: Can we support multiple cursors? Keith David Bershatsky
2017-08-13 18:19 ` Keith David Bershatsky
2017-08-13 18:36   ` Eli Zaretskii
2017-08-14  3:20 ` Keith David Bershatsky
2017-08-14 15:01   ` Eli Zaretskii
2017-08-14 20:35 ` Keith David Bershatsky
2017-12-27 17:13 ` bug#22873: #22873 (multiple fake cursors); and, #17684 (crosshairs) Keith David Bershatsky
2017-12-27 23:55   ` John Wiegley
2017-12-28  1:20 ` bug#22873: #22873 (multiple fake cursors) Keith David Bershatsky
2017-12-28  1:26 ` Keith David Bershatsky
2018-07-17 19:09 ` bug#22873: #22873 (multiple fake cursors); and, #17684 (crosshairs) Keith David Bershatsky
2018-08-29  6:39 ` Keith David Bershatsky
2019-05-03  0:48 ` Keith David Bershatsky
2019-05-06 18:39 ` Keith David Bershatsky
2019-05-28  8:31 ` Keith David Bershatsky
2019-06-02  7:29 ` Keith David Bershatsky
2019-07-16 19:28 ` Keith David Bershatsky
2019-07-23  6:01 ` Keith David Bershatsky
2019-08-23  5:19 ` Keith David Bershatsky
2019-10-17 21:08 ` bug#22873: #22873 (multiple fake cursors); and, #17684 (crosshairs / fill-column) Keith David Bershatsky
2020-03-04  9:03 ` Keith David Bershatsky
  -- strict thread matches above, loose matches on Subject: below --
2014-06-03 20:36 bug#17684: 24.4.50; Feature Request -- Vertical Lines to the Left of and Through Characters Keith David Bershatsky
2018-07-09  5:28 ` bug#17684: #22873 (multiple fake cursors); and, #17684 (crosshairs) Keith David Bershatsky
2018-11-11  3:36 ` Keith David Bershatsky
2018-11-11 16:51 ` Keith David Bershatsky
2018-11-21  4:53 ` bug#17684: #22873 (multiple fake cursors); and, #17684 (crosshairs / fill-column) Keith David Bershatsky
2018-12-14  7:11 ` Keith David Bershatsky
2019-04-09  4:03 ` bug#17684: #22873 (multiple fake cursors); and, #17684 (crosshairs) Keith David Bershatsky
2019-04-21  5:15 ` Keith David Bershatsky
2019-04-29  1:21 ` Keith David Bershatsky
2019-06-08 23:44 ` Keith David Bershatsky
2019-06-16  8:07 ` Keith David Bershatsky
2019-06-24  2:25 ` Keith David Bershatsky
2019-06-30  5:42 ` Keith David Bershatsky
2019-07-31 19:39 ` Keith David Bershatsky
2019-10-18  1:12 ` bug#17684: #22873 (multiple fake cursors); and, #17684 (crosshairs / fill-column) Keith David Bershatsky
2019-11-18  6:58 ` Keith David Bershatsky
2020-01-27  7:39 ` Keith David Bershatsky
2020-05-02 20:50 ` Keith David Bershatsky
2020-10-01  3:00   ` bug#17684: bug#22873: " Lars Ingebrigtsen
2020-10-01  3:54     ` Keith David Bershatsky
2020-10-01 16:21       ` Lars Ingebrigtsen
2020-10-01 17:00         ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m21sq7zpmb.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=22873@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jwiegley@gmail.com \
    --cc=mbork@mbork.pl \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.