GNU bug report logs - #17684
24.4.50; Feature Request -- Vertical Lines to the Left of and Through Characters

Previous Next

Package: emacs;

Reported by: Keith David Bershatsky <esq <at> lawlist.com>

Date: Tue, 3 Jun 2014 20:46:02 UTC

Severity: wishlist

Found in version 24.4.50

To reply to this bug, email your comments to 17684 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Tue, 03 Jun 2014 20:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Keith David Bershatsky <esq <at> lawlist.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 03 Jun 2014 20:46:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4.50; Feature Request -- Vertical Lines to the Left of and Through
 Characters
Date: Tue, 03 Jun 2014 13:36:51 -0700
As a feature request, please consider adding the ability to include vertical lines to the left of and also through characters.

CAVEAT:  The vertical line plus the character should be equal to only (1) `point` -- like a vertical cursor bar and a character to the right.

This new feature has many applications, including, but not limited to:

*  A thin fill column indicator line that can span the vertical length of the window / buffer.

*  Thin tab setting indicators in the form of vertical lines for each tab set.  (This is built-in to Sublime Text.)

*  A visual vertical division between different parts of the same buffer.

*  A thin vertical line (from top to bottom of the window) that tracks the cursor position.

See the following stackoverflow thread for a screenshot of how this looks, including the workaround / answer to the question:

http://stackoverflow.com/questions/23744237/emacs-how-to-create-a-vertical-strike-through-effect

My workaround shrinks the character to the right so that the visual sentence length is not altered.  The vertical bar cursor that is built-in to Emacs can sit next to a character without shrinking said character -- so implementation of a vertical line to the left of the character would be similar to how the cursor presently works.

BONUS:  As a related feature request, please consider adding the ability to draw these vertical lines (from top to bottom of the window) virtually instantaneously.  Creating these vertical lines in `elisp` when `visual-line-mode` is active is extremely time consuming to perform all the calculations (up to 0.25 seconds from start to finish) and needs to be done with an `idle-timer` so as not to slow down the normal movement of the cursor or typing text quickly.  The calculation and placement of overlays can be sped up significantly by *not* calculating for `visual-line-mode`, but I am *very* fond of that mode.

Thanks,

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In GNU Emacs 24.4.50.1 (x86_64-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549))
 of 2014-06-01 on MP.local
Repository revision: 117215 lekktu <at> gmail.com-20140601162519-4dacx2w0ak528z2r
Windowing system distributor `Apple', version 10.3.1038
Configured using:
 `configure --with-ns'

Configured features:
ACL LIBXML2 ZLIB

Important settings:
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  lawlist-scroll-bar-mode: t
  lawlist-delete-selection-mode: t
  lawlist-linum-mode: t
  lawlist-visual-line-mode: t
  vr-mode: t
  hr-mode: t
  flyspell-mode: t
  desktop-save-mode: t
  tabbar-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  transient-mark-mode: t

Recent input:
<escape> x h r <return> <escape> x v r <return> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <s-right> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <s-left> <M-right> <M-right> <M-right> <M-right> 
<M-right> <M-right> <M-right> <M-right> <M-right> <M-right> 
<M-right> <M-right> <M-right> <M-right> <M-right> <M-right> 
<s-down> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <s-right> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <M-left> 
<M-left> <M-left> <M-left> s-N r e p o r t s-z s-w 
k <escape> x r e p o r t - e m a <tab> <tab> b u g 
<return>

Recent messages:
Loading mail-mime-setup...done
Updating addresses...done
Type C-c C-x C-z to exit MIME mode, and type C-c C-x ? to get help.
Saving...done
Mark set
Undo...
Undo!
[k]ill or [s]ave draft?
Loading msgdb for +/Users/HOME/.0.data/.0.emacs/.0.mail/msgdb/imap/mail.lawlist.com/lawlist/INBOX.Drafts/spool...done
Making completion list...

Load-path shadows:
/Users/HOME/.0.data/.0.emacs/.0.flim/md4 hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/md4
/Users/HOME/.0.data/.0.emacs/.0.flim/hex-util hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/hex-util
/Users/HOME/.0.data/.0.emacs/.0.flim/sasl hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/net/sasl
/Users/HOME/.0.data/.0.emacs/.0.flim/sasl-ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/net/sasl-ntlm
/Users/HOME/.0.data/.0.emacs/.0.flim/sasl-digest hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/net/sasl-digest
/Users/HOME/.0.data/.0.emacs/.0.flim/sasl-cram hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/net/sasl-cram
/Users/HOME/.0.data/.0.emacs/.0.flim/ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/net/ntlm
/Users/HOME/.0.data/.0.emacs/.0.flim/hmac-md5 hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/net/hmac-md5
/Users/HOME/.0.data/.0.emacs/.0.flim/hmac-def hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/net/hmac-def
/Users/HOME/.0.data/.0.emacs/.0.wl/rfc2368 hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/mail/rfc2368
/Users/HOME/.0.data/.0.emacs/.0.wl/utf7 hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/gnus/utf7
/Users/HOME/.0.data/.0.emacs/.0.simi/smime hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/gnus/smime
/Users/HOME/.emacs.d/elpa/tabulated-list-20120406.1351/tabulated-list hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/emacs-lisp/tabulated-list
/Users/HOME/.0.data/.0.emacs/.0.simi/pgg hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/obsolete/pgg
/Users/HOME/.0.data/.0.emacs/.0.simi/pgg-pgp5 hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/obsolete/pgg-pgp5
/Users/HOME/.0.data/.0.emacs/.0.simi/pgg-pgp hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/obsolete/pgg-pgp
/Users/HOME/.0.data/.0.emacs/.0.simi/pgg-parse hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/obsolete/pgg-parse
/Users/HOME/.0.data/.0.emacs/.0.simi/pgg-gpg hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/obsolete/pgg-gpg
/Users/HOME/.0.data/.0.emacs/.0.simi/pgg-def hides /Users/HOME/.0.data/.0.emacs/Emacs_06_01_2014.app/Contents/Resources/lisp/obsolete/pgg-def

Features:
(shadow emacsbug modb-legacy wl-mime mime-edit pgg-parse pccl pccl-20
signature mime-setup mail-mime-setup semi-setup mime-pgp pgg-def
mime-play filename mime-image modb-standard elmo-imap4 disp-table
bbdb-autoloads lawlist-wl wl-demo wl-draft eword-encode wl-template
sendmail elmo-net elmo-cache elmo-map elmo-dop wl-news wl-address
wl-thread wl-folder wl wl-e21 wl-spam wl-action wl-summary wl-refile
wl-util pp elmo-flag elmo-localdir wl-message elmo-mime mmelmo-buffer
mmelmo-imap mime-view mime-conf calist semi-def mmimap mime-parse
mmbuffer mmgeneric elmo-multi elmo-spam elsp-header elsp-generic elmo
elmo-signal wl-highlight wl-vars wl-version elmo-msgdb modb
modb-generic modb-entity luna mime elmo-util emu invisible inv-23 poem
poem-e20 poem-e20_3 eword-decode std11 elmo-date elmo-vars
elmo-version w3m-load mime-w3m w3m browse-url doc-view jka-compr
image-mode w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl
w3m-favicon w3m-image w3m-proc w3m-util smiley gnus-art mm-uu mml2015
mm-view mml-smime smime savehist lawlist-vr-hr lawlist-whitespace
lawlist-github conf-mode log-edit add-log find-lisp package esh-var
esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg eldoc esh-groups
eshell esh-module esh-mode esh-util dired-x view tramp tramp-compat
tramp-loaddefs trampver server grep epa epg epg-config diff-mode
autorevert filenotify log-view pcvs-util ido time-stamp vc-git vc
vc-dispatcher ediff-merg ediff-wind ediff-diff ediff-mult ediff-help
ediff-init ediff-util ediff rx ert ewoc debug eieio-base
lawlist-calculator ps-print ps-def lpr flyspell ispell bbdb timezone
find-func dired-aux lawlist-yasnippet help-mode multiple-cursors
mc-separate-operations rectangular-region-mode mc-mark-more thingatpt
mc-cycle-cursors mc-edit-lines multiple-cursors-core rect saveplace
lawlist-tex-mode pcase compile shell pcomplete comint ansi-color ring
skeleton compare-w desktop frameset lawlist-tabbar lawlist-org
lawlist-calendar edmacro kmacro derived lawlist-toodledo advice
url-http url-auth url-gw url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util url-parse
auth-source eieio byte-opt bytecomp byte-compile cconv eieio-core
password-cache url-vars mailcap json xml noutline outline easy-mmode
gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source tls utf7 mel path-util mime-def alist mcharset mcs-20
mcs-e20 pcustom pces pces-e20 pces-20 broken poe pym static apel-ver
product netrc nnoo parse-time gnus-spec gnus-int gnus-range message
cl-macs dired format-spec rfc822 mml easymenu mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev gmm-utils mailheader gnus-win gnus gnus-ems nnheader
gnus-util mail-utils mm-util help-fns mail-prsvr wid-edit cl gv
cl-loaddefs cl-lib time-date tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
cocoa ns multi-tty emacs)

Memory information:
((conses 16 735058 70571)
 (symbols 48 55594 0)
 (miscs 40 466 1504)
 (strings 32 116283 16738)
 (string-bytes 1 3865036)
 (vectors 16 42190)
 (vector-slots 8 741311 45040)
 (floats 8 1012 256)
 (intervals 56 691 89)
 (buffers 960 14))


Sincerely,

Keith David Bershatsky, Esq.
Law Office of Keith David Bershatsky
1725 Echo Park Avenue
Los Angeles, CA  90026

Tel. / Fax.:  (213) 975-9447
esq <at> lawlist.com




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Wed, 27 Dec 2017 17:14:01 GMT) Full text and rfc822 format available.

Message #8 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: John Wiegley <jwiegley <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>,
 Marcin Borkowski <mbork <at> mbork.pl>, Richard Stallman <rms <at> gnu.org>
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Wed, 27 Dec 2017 09:13:37 -0800
[Message part 1 (text/plain, inline)]
The attached draft patch.diff applies to the Emacs 26 branch; bearing last commit da94ea92bc3ba6c236b394c00e6bbb725131a149; dated 12/26/2017.

Feature request #17684 (crosshairs) uses the same mechanism as #22873 (multiple fake cursors), and the former was actually what inspired me to work on the latter.  There is still no support to deal with placing fake cursors on text containing fancy overlays, text properties or combined characters.  At this time, multiple fake cursors that persist are redrawn each command loop -- which can someday be optimized.  Crosshairs are on an idle-timer.

In my own setup, I have incorporated #22873 to work with Magnar's multiple cursors library using just a slight modification to a couple of his functions, and can provide that if anyone is interested.  In a nutshell, Emacs can draw multiple fake cursors using #22873 instead of using the rectangle overlay chosen by Magnar.

+-mode is pretty straight forward.  Evaluate or load +-mode.el and type:  M-x +-mode

A simple interactive function demonstrating multiple fake cursors is named mc-test, which is within +-mode.el

I will continue to work on this project as time goes by -- it is still a work in progress ...

Keith

[patch.diff (application/diff, attachment)]
[+-mode.el (application/el, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Wed, 27 Dec 2017 23:56:02 GMT) Full text and rfc822 format available.

Message #11 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: "John Wiegley" <johnw <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 17684 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Marcin Borkowski <mbork <at> mbork.pl>, 22873 <at> debbugs.gnu.org,
 Richard Stallman <rms <at> gnu.org>
Subject: Re: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Wed, 27 Dec 2017 15:55:16 -0800
>>>>> Keith David Bershatsky <esq <at> lawlist.com> writes:

> In my own setup, I have incorporated #22873 to work with Magnar's multiple
> cursors library using just a slight modification to a couple of his
> functions, and can provide that if anyone is interested. In a nutshell,
> Emacs can draw multiple fake cursors using #22873 instead of using the
> rectangle overlay chosen by Magnar.

I'm interested in that patch to multiple-cursors, Keith.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Mon, 09 Jul 2018 05:30:02 GMT) Full text and rfc822 format available.

Message #14 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>, John Wiegley <johnw <at> gnu.org>,
 Marcin Borkowski <mbork <at> mbork.pl>, Richard Stallman <rms <at> gnu.org>
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Sun, 08 Jul 2018 22:28:33 -0700
[Message part 1 (text/plain, inline)]
I am now at proof concept patch version 012.  The patch applies to the master branch as of yesterday (07/07/2018).  Multiple fake cursors and crosshairs now use the same function (mc_move_it) to obtain the relevant X/HPOS coordinates.  This version provides better compatibility with horizontal scrolling.  Crosshairs now works with X11 and Windows.

1.  Download a current version of Emacs master branch.

2.  Reset the repository to 07/07/2018:  git reset --hard 98463bed07ecc9057094928ffdc2321eaaf3ab52

3.  Apply the attached patch from the root repository directory.

4.  Build a GUI version of Emacs:  X11, NS, or Windows.

5.  To try out real fake cursors with Magnar Sveen's library (multiple-fake-cursors), install that package first.

6.  Open crosshairs.el (attached) and evaluate the buffer.

7.  To play with crosshairs, type:  M-x +-mode

8.  To see an example of crosshairs playing nicely with tab stretches, open up something like simple.el and enable +-mode.

9.  To see an example of a variety of cursor styles and widths, type:  M-x mc-test

X11 and NS are much quicker than Windows.  At some point in the future, I will work on more efficient means of calculating X and HPOS and other ways to speed this up.  Before moving on to more complicated aspects, I will continue working on compatibility with horizontal scrolling, tab stretches, and word-wrap/window-wrap/truncate.

Keith

[crosshairs.el (application/el, attachment)]
[patch_012.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Tue, 17 Jul 2018 19:12:02 GMT) Full text and rfc822 format available.

Message #17 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Marcin Borkowski <mbork <at> mbork.pl>,
 Richard Stallman <rms <at> gnu.org>, John Wiegley <johnw <at> gnu.org>
Cc: 17684 <at> debbugs.gnu.org, 22873 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Tue, 17 Jul 2018 12:09:18 -0700
[Message part 1 (text/plain, inline)]
Proof concept patch version 013.  Changes include, but are not limited to:

-  The previous problem with the speed of drawing multiple fake cursors on Emacs for Windows (which occurred with patch version 012) was caused by a plethora of useful debugging messages being sent to STDERR, which caused a tremendous slow down even when launching runemacs.exe (i.e., not the terminal).  [Solution:  turn off STDERR debugging messages when not needed.]

-  Debugging messages to STDERR is now controlled by the variable mc-stderr (non-nil for ON, and nil for OFF).

-  Miscellaneous cleanup of unused variables in various functions.

-  Minor bug fixes.

-  Reorganized/grouped sections within mc_move_it [MULTIPLE_CURSORS, HORIZONTAL_RULER, VERTICAL_RULER] and added more debugging details to STDERR.

INSTALLATION:

1.  Download a current version of Emacs master branch.

2.  Reset the repository to 07/07/2018:  git reset --hard 98463bed07ecc9057094928ffdc2321eaaf3ab52

3.  Apply the attached patch from the root repository directory.

4.  Build a GUI version of Emacs:  X11, NS, or Windows.

5.  To try out built-in fake cursors with Magnar Sveen's library (multiple-cursors), install that package first.

6.  Load or evaluate the contents of crosshairs.el (attached), which includes code modifying a couple of functions used by Magnar Sveen's library.

7.  To try out the crosshairs feature, open a simple buffer (nothing fancy, just code or text) and type:  M-x +-mode

8.  To see an example of crosshairs playing nicely with tab stretches, open up something like simple.el and type:  M-x +-mode.

9.  To see an example of a variety of built-in cursor styles and widths, type:  M-x mc-test

This is still a work in progress ...

[patch_013.diff (application/diff, attachment)]
[crosshairs.el (application/el, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Wed, 29 Aug 2018 06:41:02 GMT) Full text and rfc822 format available.

Message #20 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Marcin Borkowski <mbork <at> mbork.pl>,
 Richard Stallman <rms <at> gnu.org>, John Wiegley <johnw <at> gnu.org>,
 Akio Burns <akioburns <at> icloud.com>
Cc: 17684 <at> debbugs.gnu.org, 22873 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Tue, 28 Aug 2018 23:39:25 -0700
[Message part 1 (text/plain, inline)]
Proof concept patch version 014.  Changes include, but are not limited to:

-  Crosshairs now attempts to deal with variable pitch and nonstandard width characters.  This is accomplished by permitting the vertical ruler to intersect a character anywhere along the X axis (vertically aligned with the left of point).  The horizontal ruler now also plays nicer with nonstandard width characters.

-  Debugging messages to stderr are turned on/off with:  M-x mc-stderr.

-  Bug fixes (elimination of an infinite loop; drawing multiple fake cursors only if they are within the bounds of the visible window; miscellaneous others...).

-  Reduced footprint of revisions to core Emacs code, which is now possible by using a few new window pointers:  w->mc.[red, green, blue, fx, fy, h].

INSTALLATION:

1.  Download a current version of Emacs master branch.

2.  Reset the repository to 07/07/2018:  git reset --hard 98463bed07ecc9057094928ffdc2321eaaf3ab52

3.  Apply the attached patch from the root repository directory.

4.  Build a GUI version of Emacs:  X11, NS, or Windows.

5.  To try out built-in fake cursors with Magnar Sveen's library (multiple-cursors), install that package first.

    (progn
      (require 'package)
      (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
      (package-initialize)
      (package-refresh-contents)
      (package-install 'multiple-cursors))

6.  Load or evaluate the contents of crosshairs.el (attached), which includes code modifying a couple of functions used by Magnar Sveen's library.

7.  To try out the crosshairs feature, open a simple buffer (nothing fancy, just code or text) and type:  M-x +-mode

8.  To see an example of crosshairs playing nicely with tab stretches, open up something like simple.el and type:  M-x +-mode.

9.  To see an example of a variety of built-in cursor styles and widths, type:  M-x mc-test

This is still a work in progress ...

[crosshairs.el (application/el, attachment)]
[patch.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Sun, 11 Nov 2018 03:37:01 GMT) Full text and rfc822 format available.

Message #23 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Marcin Borkowski <mbork <at> mbork.pl>,
 Richard Stallman <rms <at> gnu.org>, John Wiegley <johnw <at> gnu.org>,
 Akio Burns <akioburns <at> icloud.com>, Alan Third <athird <at> googlemail.com>
Cc: 17684 <at> debbugs.gnu.org, 22873 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Sat, 10 Nov 2018 19:36:17 -0800
[Message part 1 (text/plain, inline)]
Proof concept patch version 015.  Changes include, but are not limited to:

-  Coordinates for the fake cursors are now obtained by effectively dumping the glyph matrix and looking for the desired glyph; e.g., based upon a particular character position in the buffer, or a particular window relative X.  [The previous versions relied upon moving IT.]

-  Multiple fake cursors and crosshairs are now supported in the inactive window.

-  The foreground filled color of a hollow cursor is now configurable, including, but not limited to when the region inactive, and active region beginning and/or the active region end.

-  Colors of fake cursors in inactive window can be customized to be different than the active window.

-  New fringe indicators when engaging different forms of horizontal scrolling.

-  New fringe indicators when the idle timer for crosshairs is pending.

-  Other miscellaneous new stuff, but not too significant.

-  Miscellaneous bug fixes.

There are miscellaneous changes to the core of Emacs to facilitate generate tracing/debugging information.  Said modifications will eventually be removed.

Due to the fact that I do not presently have a computer set up with MacOS Mojave, I cannot test a current version of Emacs master branch that includes the Mojave changes to nsterm.m made by Alan Third some time ago.  Based upon the help I received from Alan on the Emacs Devel mailing list, it would appear that simply restoring update_window_cursor to its unmodified state will permit drawing crosshairs and multiple fake cursors on a platform of Emacs for MacOS Mojave.  My recollection is that those restrictions were instituted to prevent redisplaying the crosshairs in certain mouseover situations.

SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 07/07/2018:

git reset --hard 98463bed07ecc9057094928ffdc2321eaaf3ab52

[Going back in time to 07/07/2018 saves @lawlist a couple of hours by not having
to deal with unrelated recent changes to the master branch by the Emacs team.]

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/11_10_2018__18_53_09_703.diff

[There should not be any error messages at this point; i.e, you should be returned to a new command prompt.]

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install

-  To try out built-in fake cursors with Magnar Sveen's library (multiple-cursors), install that package first.  If the multiple-cursors package by Magnar Sveen is not already installed, then there are two easy ways to install that package:

   Type:  M-x mc-install

   OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))

-  To try out the crosshairs feature, open a relatively simple buffer (e.g., just code or text) and type:  M-x +-mode

    The default setting is on an idle timer, so just move around or type something to see how it works.

-  To see an example of a variety of built-in cursor styles and widths, type:  M-x mc-test

[11_10_2018__18_53_09_703.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Sun, 11 Nov 2018 16:52:02 GMT) Full text and rfc822 format available.

Message #26 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Marcin Borkowski <mbork <at> mbork.pl>,
 Richard Stallman <rms <at> gnu.org>, John Wiegley <johnw <at> gnu.org>,
 Akio Burns <akioburns <at> icloud.com>, Alan Third <athird <at> googlemail.com>
Cc: 17684 <at> debbugs.gnu.org, 22873 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Sun, 11 Nov 2018 08:51:54 -0800
[Message part 1 (text/plain, inline)]
Proof concept patch version 015.001.  Changes include, but are not limited to:

-  Fixed mc-test.  [When switching over from the move IT method to the dump glyph matrix method, cursor_type inadvertently got hard-coded as a BAR_CURSOR instead of respecting the user-defined cursor type/width for multiple fake cursors.]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 07/07/2018:

git reset --hard 98463bed07ecc9057094928ffdc2321eaaf3ab52

[Going back in time to 07/07/2018 saves @lawlist a couple of hours by not having
to deal with unrelated recent changes to the master branch by the Emacs team.]

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/11_11_2018__08_30_42_690.diff

[There should not be any error messages at this point; i.e, you should be returned to a new command prompt.]

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install

-  To try out built-in fake cursors with Magnar Sveen's library (multiple-cursors), install that package first.  [If the multiple-cursors package is installed, an eval-after-load "multiple-cursors-core" statement within crosshairs.el will redefine a couple of functions and set up a few keyboard shortcuts.]  If the multiple-cursors package by Magnar Sveen is not already installed, then there are two easy ways to install that package:

   Type:  M-x mc-install

   OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))

-  To try out the crosshairs feature, open a relatively simple buffer (e.g., just code or text) and type:  M-x +-mode

    The default setting is on an idle timer, so just move around or type something to see how it works.

-  To see an example of a variety of built-in cursor styles and widths, type:  M-x mc-test

[11_11_2018__08_30_42_690.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Wed, 21 Nov 2018 04:55:01 GMT) Full text and rfc822 format available.

Message #29 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Marcin Borkowski <mbork <at> mbork.pl>,
 Richard Stallman <rms <at> gnu.org>, John Wiegley <johnw <at> gnu.org>,
 Akio Burns <akioburns <at> icloud.com>, Alan Third <athird <at> googlemail.com>
Cc: 17684 <at> debbugs.gnu.org, 22873 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors);
 and, #17684 (crosshairs / fill-column).
Date: Tue, 20 Nov 2018 20:53:56 -0800
[Message part 1 (text/plain, inline)]
Version 016.000 [11/20/2018]

CHANGELOG:

-  The area of code that prevented crosshairs and other fake cursors from
   working on MacOS Mojave has been fixed.

-  New Feature:  This is the first implementation of a visible fill column
   using fake cursors, which has similar abilities to crosshairs; e.g.,
   draw forthwith whenever the real cursor gets drawn; draw on an idle
   timer; fill column indicator in inactive/active windows have different
   colors; suppress display of fill column indicator in inactive windows
   (if so desired); color of the fill column indicator in active/inactive
   windows is a different color when the cursor is lined up with the fill
   column and crosshairs is active.  Crosshairs incorporates the fill
   column indicator if the variable `+-fill-column' is non-nil; or, there
   is a separate minor-mode called `mc-fill-column-mode' (if so desired).

-  Floating horizontal ruler now increments by glyph->pixel_width instead
   of frame-char-width.  [This avoids visible gaps.]

-  Multiple fake cursors can now be placed at the end of a line when there
   is no `buffer-display-table' entry for a visible EOL glyph.

-  Crosshairs now use the line height instead of the glyph height.  [This
   avoids visible gaps in the vertical ruler of crosshairs.]

-  The border color for images with a fake cursor now match the fake
   cursor color.

-  With the gracious assistance of Eli Z., a test now exists for the situation
   when `draw_glyphs' redraws a tab stretch due to a subsequent character
   with a left overhang.  Additional work needs to be done ... [infra].

-  Only call `update_begin' / `update_end' when the frame was not already
   in the process of being updated.

-  Miscellaneous bug fixes.


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 11/16/2018:

git reset --hard 644a308b4e1513e04be9360e1586e14b32ec0159

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/11_20_2018__18_16_28_577.diff

[There should not be any error messages at this point; i.e, you should be returned to a new command prompt.]

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install

-  To try out built-in fake cursors with Magnar Sveen's library (multiple-cursors), install that package first.  [If the multiple-cursors package is installed, an eval-after-load "multiple-cursors-core" statement within crosshairs.el will redefine a couple of functions and set up a few keyboard shortcuts.]  If the multiple-cursors package by Magnar Sveen is not already installed, then there are two easy ways to install that package:

   Type:  M-x mc-install

   OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))

-  To try out crosshairs and the visible fill column, type:  M-x +-mode

-  To try out only the visible fill column, type:  M-x mc-fill-column-mode

-  To learn how to use the multiple fake cursors feature, examine the
   interactive function `mc-test'.


TODO:

-  Crosshairs in the inactive windows is causing cursors in the active
   windows to be erased (when the active window drew prior thereto).

-  Face of tab stretch gets extended to window edge on NS, but not on X11
   or NT platforms:
   https://lists.gnu.org/archive/html/emacs-devel/2018-11/msg00316.html

-  Continue working on the section of code within `draw_glyphs' that is
   responsible for redrawing a stretch tab (erasing a fake cursor) when the next
   character has a left overhang.  "	A".  A temporary fix has been instituted
   that simply bypasses the section of code at issue; however, the optimal
   solution will be to let `draw_glyphs' do its thing and then redraw the
   fake cursors along the stretch tab subsequent thereto.

-  Multiple Cursors:  If point is in the middle of a composite character, then
   select a fully composed character so that the fake cursor is visible.

-  Fake cursors are being redrawn too often when non-selected visible windows
   have an ongoing process that require frequent redisplay updates (e.g.,
   an eshell buffer.  @lawlist may have already corrected the frequent redisplay
   issue as to mouse-overs, but will need to check this once again to be sure.

[11_20_2018__18_16_28_577.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Fri, 14 Dec 2018 07:12:02 GMT) Full text and rfc822 format available.

Message #32 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Marcin Borkowski <mbork <at> mbork.pl>,
 Richard Stallman <rms <at> gnu.org>, John Wiegley <johnw <at> gnu.org>,
 Akio Burns <akioburns <at> icloud.com>, Alan Third <athird <at> googlemail.com>
Cc: 17684 <at> debbugs.gnu.org, 22873 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors);
 and, #17684 (crosshairs / fill-column).
Date: Thu, 13 Dec 2018 23:11:07 -0800
[Message part 1 (text/plain, inline)]
Version 017.000 [12/13/2018]

CHANGELOG:

-  nsterm.m:  Cursors are now drawn subsequent to the expose_frame/window loop
   of dirty rectangles within drawRect.  `update_window_cursor' within
   `expose_frame' is now disabled when HAVE_NS.

-  FRAMED_BOX_CURSOR is a new cursor type that is a variant of the
   FILLED_BOX_CURSOR, which has support for different colors depending upon
   whether it is in the active/inactive window and at the beginning/ending of
   an active region.

-  Visible fill column now takes into consideration the line number pixel-width
   and horizontal scrolling (if any) when calculating the X coordinate.

-  Disabled visible fill column when X coordinate is beyond text area width, and
   when prior to the line number pixel width (or zero if no line numbers) with
   horizontal scrolling in effect.

-  Restricted trace-redisplay messages to just the most relevant functions.

-  Customized a few of the faces to provide better visibility of crosshairs with
   a white background in an Emacs -Q situation.

-  Eliminated the usage of MC_GLYPH_TAB as there are really only two kinds that
   are used:  MC_GLYPH | MC_GLYPHLESS

-  Eliminated a few abort / immediate return of functions that appear to no
   longer be necessary to avoid crashing Emacs.

-  Fixed one cash in the multiple fake cursors section of code when the real
   cursor is not associated with a glyph; i.e., `get_phys_cursor_glyph' == NULL.

-  As to the real fake cursor of crosshairs (intersection of vertical/horizontal
   rulers), when mc-real-fake-cursor is nil/"no"/'no, the BAR_CURSOR now uses
   MC_GLYPHLESS so as not to create a superimposed glyph on top of the MC_GLYPH
   that was placed when drawing the horizontal ruler.

-  Identified a right overhang situation that causes the fake cursor over a
   STRETCH to be erased.  [Additional work is needed projects to be done below.]

-  `mc_get_phys_cursor_geometry' now uses `row->visible_height' without taking
   into consideration the FRAME_LINE_HEIGHT.

-  Added some tracing messages to a couple of functions.

-  Miscellaneous minor bug fixes.


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 12/13/2018:

git reset --hard 8ffc0f2dd753879b0795714c29c86082aa9fd155

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/attached.diff

[There should not be any error messages at this point; i.e, you should be returned to a new command prompt.]

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install

-  To try out built-in fake cursors with Magnar Sveen's library (multiple-cursors), install that package first.  [If the multiple-cursors package is installed, an eval-after-load "multiple-cursors-core" statement within crosshairs.el will redefine a couple of functions and set up a few keyboard shortcuts.]  If the multiple-cursors package by Magnar Sveen is not already installed, then there are two easy ways to install that package:

   Type:  M-x mc-install

   OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))

-  To try out crosshairs and the visible fill column, type:  M-x +-mode

-  To try out only the visible fill column, type:  M-x mc-fill-column-mode

-  To try out the new cursor-type of a FRAMED_BOX_CURSOR without anything extra,
   evaluate the following snippet -- see the difference between inactive/active
   windows, and also the beginning/ending of an active region selection:

   (setq cursor-type 'framed
         cursor-in-non-selected-windows 'framed)

-  To use the new cursor type of a FRAMED_BOX_CURSOR with crosshairs or multiple
   fake cursors, evaluate the following snippet:

   (setq mc-real-fake-cursor 'framed)

-  To learn how to use the multiple fake cursors feature, examine the
   interactive function `mc-test'.

-  EXAMPLE OF HOW TO USE MULTIPLE FAKE CURSORS:

  ;;; (BUFFER-POSITION CURSOR-TYPE CURSOR-COLOR)
  ;;;
  (setq multiple-cursors-conf '((1 "hbar" "magenta")
                                (2 "bar" "purple")
                                (3 "box" "#00FF00")
                                (4 "hollow" "#0000FF")
                                (5 ("hbar" 3) [1.0 0.0 1.0])
                                (6 ("bar" 3) [0.0 1.0 1.0])))

  ;;; TURN OFF.
  ;;;
  (setq multiple-cursors-conf nil)


TODO:

-  The current test for `auto_hscroll_mode_p' only looks for `current_line` and
   all five related tests are based upon that assumption, which may not be true.

-  Continue working on the sections of code within `draw_glyphs' that are
   responsible for redrawing a stretch tab (erasing a fake cursor) when the
   previous/next character has a left/right overhang.
   left_overwritten:  "	A"
   right_overwritten (GNU Emacs welcome screen without `buffer-display-table')
   and the real fake cursor is to the immediate right of the word "Tour":
   "Emacs Guided Tour	Overview".

-  Multiple Cursors:  If point is in the middle of a composite character, then
   select a fully composed character so that the fake cursor is visible.

-  Fake cursors are being redrawn too often when non-selected visible windows
   have an ongoing process that require frequent redisplay updates (e.g.,
   an eshell buffer.  @lawlist may have already corrected the frequent redisplay
   issue as to mouse-overs, but will need to check this once again to be sure.

-  Set up some tests to see what (if anything) needs to be done so that
   these features play nicely with certain overlays and text properties.

-  Implement functionality similar to Lisp multiple-cursors by Magnar Sveen.

-  Create a comprehensive list of items to test when modifying these features;
   and, add a test file.

-  Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
   one column to the left.)

-  Follow up with the Emacs team re bug#32060; i.e., (Horizontal Scrolling
   (Current Line):  Wrong line gets h-scrolled.)

-  Determine if bug #28936 needs to be fixed and help the Emacs team re same.


HOW DOES IT WORK?

-  Fake cursors are removed in two (2) locations within `redisplay_internal'
(if the cursor cache exists).  If the frame is not being updated, then call
`update_begin' before removing and call `update_end' when removing is complete.

-  Fake cursors are removed in two (2) locations within `redisplay_window'
(if the cursor cache exists).  If the frame is not being updated, then call
`update_begin' before removing and call `update_end' when removing is complete.

-  Whenever `display_and_set_cursor' is called and not immediately returned,
cursors are calculated and drawn; or, if the cursor cache already exist, then
erase and redraw.  If the frame is not being updated, then call `update_begin'
before drawing/removing and call `update_end' when drawing/removing is complete.

-  The calculations for drawing fake cursors are based upon modified versions
of the functions `dump_glyph_matrix' and `dump_glyph_row', which generate the
correct coordinates for placing the fake cursors.

-  Fake cursors come in two types:  (1) cursor with a glyph on top; (2) cursor
with nothing on top [e.g., floating anywhere on the visible window].

-  There are two basic settings:  (1) draw or erase/redraw forthwith (whenever
the real cursor would ordinarily be drawn); or, (2) draw on an idle-timer and,
if the cursor cache exists, then erase/redraw in certain circumstances when the
real cursor would ordinarily be redrawn.  New calculations and cursor cache
update occur on the initial call of either of the aforementioned two scenarios.

-  All three features (multiple fake cursors, crosshairs, and visible fill
column) operate on the same principal.  There are similar functions for each
feature, with the only main difference being that multiple fake cursors look for
a particular buffer position when dumping the glyph matrix and looping through
each row, whereas crosshairs and visible fill column look for a particular
window relative X coordinate.

-  At this time, there is nothing fancy about multiple fake cursors -- i.e.,
Emacs only looks for a buffer position and creates a fake cursor with the
desired cursor type and cursor color.  Magnar's Lisp library is still the only
mechanism I am aware of that does the magic.  Instead of placing a visible
overlay where fake cursors would ordinarily be created using Magnar's library,
there are a few modifications to his Lisp functions that are contained within
crosshairs.el.  From the list of fake cursor overlays created by Magnar's
library, Emacs gathers the list of buffer positions and then draws built-in fake
cursors that are within the confines of the visible windows.

[2018_12_13__21_40_08_511.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Tue, 09 Apr 2019 04:04:02 GMT) Full text and rfc822 format available.

Message #35 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: eliz <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org, johnw <at> gnu.org,
 akioburns <at> icloud.com, athird <at> googlemail.com
Cc: 17684 <at> debbugs.gnu.org, 22873 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Mon, 08 Apr 2019 21:03:20 -0700
[Message part 1 (text/plain, inline)]
This is version 018.000 of a proof concept for multiple fake cursors and crosshairs.

Special thanks to Eli Z. and Alan T. for helping me out on numerous issues over the past few months -- greatly appreciated!!!


VERSION:

- 018.000 [04/08/2019]


CHANGELOG:

- Creation of fake cursors now immediately follows calls to `draw_glyphs'.

- Removal of fake cursors occurs prior to Emacs scrolling the text on the glass
  directly and at the outset of `update_window'.

- The NS port now automatically redraws fake cursors that got erased because they
  were left/right overwritten glyphs, but work still needs to be done on the w32
  and X ports.  The future plan of attack for the w32 and X ports is probably
  similar to the NS port; i.e., left/right overwritten glyphs have their strings
  tagged during `mc_draw_glyphs' and are dealt with on a per port basis when
  FRAME_RIF (f)->mc_scribe_string is called.

- Semi-duplicate functions have been created so as to reduce the number of entry
  points into the core code base of Emacs.  [This approach enables semi- worry
  free tinkering without the risk of breaking something important.]

- Removal of scroll bars no longer erase fake cursors when windows are resized
  or deleted on the NS and w32 ports.  [I didn't see any issues on an X11 build.]

- Numerous bug fixes, some minor and some major.


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out the crosshairs feature, type:  M-x +-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  install that package first.  [If the multiple-cursors package is installed, an
  eval-after-load "multiple-cursors-core" statement within `crosshairs.el` will
  redefine a couple of functions and set up a few keyboard shortcuts.]  If the
  multiple-cursors package by Magnar Sveen is not already installed, then here
  are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))


TODO:

- When using the multiple fake cursors feature, a fake cursor does not show up at
  zv_p.

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- Reduce the removal of fake cursors to the bare minimum when scrolling the text
  on the glass directly, and whenever `update_window' is called.

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  an minimal working example and file a bug report.

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

[2019_04_08__18_56_23_226.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Sun, 21 Apr 2019 05:16:01 GMT) Full text and rfc822 format available.

Message #38 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: athird <at> googlemail.com, mbork <at> mbork.pl, rms <at> gnu.org, johnw <at> gnu.org,
 akioburns <at> icloud.com, eliz <at> gnu.org, agrambot <at> gmail.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Sat, 20 Apr 2019 22:15:47 -0700
[Message part 1 (text/plain, inline)]
VERSION:  019.000 [04/20/2019]


CHANGELOG:

- Fake cursors no longer use Lisp_Object for cache management and to temporarily
  store RGB color data.  Caches and RGB color data are now managed by structs.
  Special thanks to Alex Gramiak and Eli Zaretskii for their generous assistance
  on the Emacs Devel mailing list with those related issues:

  http://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00421.html

  http://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00762.html

- A temporary cache of fake cursors is no longer needed to manage left/right
  overwritten characters.

- As of the last patch (018.000), there has no longer been a need to force a
  frame update when drawing/erasing fake cursors.  As such, the code for forcing
  a frame update has been removed in this new patch (019.000).

- Eliminated a few window pointers previously used to store RGB color data and
  also the screen relative x coordinate of the fill column.  Lisp_Object related
  widow pointers have also been removed in light of new cache management (above).

- The BOX_CURSOR variant known as a framed box cursor is now only available when
  using the multiple fake cursor related features.


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out the crosshairs feature, type:  M-x +-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  install that package first.  [If the multiple-cursors package is installed, an
  eval-after-load "multiple-cursors-core" statement within `crosshairs.el` will
  redefine a couple of functions and set up a few keyboard shortcuts.]  If the
  multiple-cursors package by Magnar Sveen is not already installed, then here
  are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))


TODO:

- Do further testing to make sure that garbage collection is now under control.
  Search for any remaining Lisp_Object that can be eliminated and handled purely
  in C.

- *GNU Emacs* welcome screen:  A portion of the hollow box cursor surrounding the
  Emacs logo image is not always being redrawn when moving the cursor over lines
  underneath the image.  This is happening on at least 2 of the 3 relevant ports.

- When using the multiple fake cursors feature, a fake cursor does not show up at
  zv_p.

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- Reduce the removal of fake cursors to the bare minimum when scrolling the text
  on the glass directly, and whenever `update_window' is called.

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  an minimal working example and file a bug report.

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

[2019_04_20__22_08_31_450.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Mon, 29 Apr 2019 01:22:02 GMT) Full text and rfc822 format available.

Message #41 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Sun, 28 Apr 2019 18:21:05 -0700
[Message part 1 (text/plain, inline)]
VERSION: 019.001 [04/28/2019]

CHANGELOG:

- With the gracious assistance of Paul Eggert on the Emacs Devel mailing list,
  the caches of fake cursors are now properly being reset.  [The error was due
  to a failure to assign the returned value of xnrealloc back to the cache.]

- Bug fix relating to floating fake cursors that were not being erased.  [This
  was caused because the glyph_flavor had erroneously been set by `mc_engine' as
  MC_GLYPH instead of MC_GLYPHLESS, and `mc_erase_cursor' was called instead of
  `mc_draw_erase_hybrid' (which handles MC_GLYPHLESS, among other things).

- Restored the triggering of update_begin/end when fake cursors are being erased.
  `mc_erase_pre_scroll_display' handles erasing and resetting of the caches.

- Added a mechanism to track the matrix containing the row with the real cursor.
  update_window now updates that row before other rows within the desired_matrix
  so that data relating to that row is available when processing all other rows.
  This is useful when determining which right fringe bitmaps to use when the
  crosshairs feature is active; e.g., cursor is either at or beyond the fringe.

- Added new fringe bitmaps and corresponding face that are used when cursor is
  beyond the fringe; e.g., when horizontal scrolling to the right.  One set of
  bitmaps are used when cursor is exactly at the fringe (a rare, but reproducible
  occurrence); and, another set when cursor is beyond the fringe.  Tests for
  each occurrence have been improved.  The new tests permit Emacs to also handle
  a situation where the fake cursors are partially visible when not quite at the
  fringe, which is noticeable when the real fake cursor is greater than 1 pixel
  wide; e.g., a hollow box cursor.

- Fixed a crash when debugging ns_judges_scroll_bars and wrapped the debugging
  code in a condition to limit its usage.

- All remaining function parameters dealing with RGB have been consolidated into
  struct mc_RGB instead of individual parameters for each color.

- Color determination for all three platforms is now streamlined a bit more with
  `mc_xw_color_values'.

  . NS platform needs no conversion after obtaining RGBA values from
  colorUsingDefaultColorSpace, which are stored in a mc_RGB sttruct until needed.

  . W32 platform:  RGB values are obtained from `w32_defined_color' and divided
  by 65535, which are then stored in a mc_RGB struct until needed.  When needed,
  those values are multiplied by 255 (result not to exceed 255).

  . X11 platform:  RGB values are obtained from `x_defined_color' and divided by
  65535, which are then stored in a mc_RGB struct until needed.  When needed,
  those values are multiplied by 65535 (result not to exceed 65535).

- Verified that garbage collection is under control.

- Fixed a bug that prevented the vertical ruler of crosshairs from drawing when
  the fill column was at the fringe (exactly).

- Fixed a bug affecting the drawing of a hollow cursor around images, which was
  due to the wrong cursor type being set before calling `mc_get_cursor_geometry'.

- Fixed a bug that prevented the real cursor from sometimes being erased.


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out the crosshairs feature, type:  M-x +-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  install that package first.  [If the multiple-cursors package is installed, an
  eval-after-load "multiple-cursors-core" statement within `crosshairs.el` will
  redefine a couple of functions and set up a few keyboard shortcuts.]  If the
  multiple-cursors package by Magnar Sveen is not already installed, then here
  are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))


TODO:

- When using the multiple fake cursors feature, a fake cursor does not show up at
  zv_p.

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- Reduce the removal of fake cursors to the bare minimum when scrolling the text
  on the glass directly, and whenever `update_window' is called.

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  an minimal working example and file a bug report.

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

[2019_04_28__14_54_14_311.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Fri, 03 May 2019 00:49:01 GMT) Full text and rfc822 format available.

Message #44 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Thu, 02 May 2019 17:48:18 -0700
[Message part 1 (text/plain, inline)]
VERSION:  019.002 [05/02/2019]


CHANGELOG:

- Eliminated the usage of a Lisp_Object within `mc_update_text_area' in favor of
  an array of structs.  [Every Lisp_Object that is eliminated will reduce the
  need for garbage collection.]

- Eliminated `mc/save-window-scroll' when using the multiple-crosshairs library
  written by Magnar Sveen.  [Said function caused non-selected windows to be
  updated during redisplay, resulting in undue slowdown.]

- Miscellaneous changes regarding when/what stderr messages are to appear when
  running M-x trace-redisplay; and, changed the name of the function responsible
  for erasing fake cursors and resetting the cache:  `mc_pre_scroll_clean'.
  Eliminated the message to run "M-x mc-install" when `crosshairs.el` loads.


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out the crosshairs feature, type:  M-x +-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  install that package first.  [If the multiple-cursors package is installed, an
  eval-after-load "multiple-cursors-core" statement within `crosshairs.el` will
  redefine a couple of functions and set up a few keyboard shortcuts.]  If the
  multiple-cursors package by Magnar Sveen is not already installed, then here
  are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))


TODO:

- Add support for `ch_inactive_windows' and `fc_inactive_windows'.

- When using the multiple fake cursors feature, a fake cursor does not show up at
  zv_p.

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- Reduce the removal of fake cursors to the bare minimum when scrolling the text
  on the glass directly, and whenever `update_window' is called.

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  an minimal working example and file a bug report.

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

[2019_05_02__17_44_54_096.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Mon, 06 May 2019 18:40:01 GMT) Full text and rfc822 format available.

Message #47 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Mon, 06 May 2019 11:39:10 -0700
[Message part 1 (text/plain, inline)]
VERSION:  019.003 [05/06/2019]


CHANGELOG:

- Reduced the number of entry points in dispnew.c to just `update_window'.


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out the crosshairs feature, type:  M-x +-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  install that package first.  [If the multiple-cursors package is installed, an
  eval-after-load "multiple-cursors-core" statement within `crosshairs.el` will
  redefine a couple of functions and set up a few keyboard shortcuts.]  If the
  multiple-cursors package by Magnar Sveen is not already installed, then here
  are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))


TODO:

- Add support for `ch_inactive_windows' and `fc_inactive_windows'.

- When using the multiple fake cursors feature, a fake cursor does not show up at
  zv_p.

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- Reduce the removal of fake cursors to the bare minimum when scrolling the text
  on the glass directly, and whenever `update_window' is called.

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  an minimal working example and file a bug report.

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

[2019_05_06__11_31_31_427.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Tue, 28 May 2019 08:33:02 GMT) Full text and rfc822 format available.

Message #50 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Tue, 28 May 2019 01:31:55 -0700
[Message part 1 (text/plain, inline)]
VERSION:  020.000 [05/27/2019]

CHANGELOG:

- Consolidated all caches of fake cursors into one master window struct/matrix,
  which is uncoincidentally somewhat similar in design to the glyph_matrix.

- Removing and drawing fake cursors is now mostly limited to the ones that have
  changed since the previous redisplay.  A dry-run of what the prospective
  `w->current_matrix` will be at tail end of `update_window' is performed at the
  outset thereof -- without actually writing any glyphs to the glass.  During
  the dry-run, a new cache of fake cursors is created and it is compared to the
  old cache of fake cursors.  Anything that is different gets erased and just
  the new ones get drawn.  As to scrolling the text on the glass directly
  _before_ `update_window' is called -- `try_window_reusing_current_matrix' and
  `try_window_id' -- fake cursors are erased from min (r.current_y, r.desired_y)
  to the top of the mode-line, and any fake cursors above the min (supra) remain.

- The multiple fake cursors feature now includes a current column check for each
  visible cursor and odd/even column colors are assigned if the user has not
  specified a color preference in the `mc_conf' for the particular cursor being
  drawn.

- Miscellaneous bug fixes.


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out the crosshairs feature, type:  M-x +-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  install that package first.  [If the multiple-cursors package is installed, an
  eval-after-load "multiple-cursors-core" statement within `crosshairs.el` will
  redefine a couple of functions and set up a few keyboard shortcuts.]  If the
  multiple-cursors package by Magnar Sveen is not already installed, then here
  are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))


TODO:

- Free memory of w->mc_matrix whenever its associated window ceases to exist.

- Consider adding support for different colors when fake cursors are _at_ ZV
  versus _beyond_ ZV, including, but not limited to the right fringe bitmaps for
  a cursor at fringe and a cursor beyond the fringe.

- `mc_ns_clip_to_rect' is not working as expected.  `ns_draw_window_cursor' calls
  `ns_clip_to_rect', which does _not_ take `row->clip` into consideration when
  drawing cursors with `NSRectFill'.  When it comes time to draw glyphs on top of
  the box/hollow family of cursors, `row->clip` is taken into consideration by
  `get_glyph_string_clip'.  Fake cursors can be drawn even though the glyphs
  cannot, resulting in hollow/box family of cursors without text.  The issue can
  be reproduced by calling M-x mc-test and then moving the cursor left/right --
  a thick hbar-looking rectangle forms underneath the characters in the boxes.
  [Reproduction of the issue assumes `mc_ns_intersect_rectangles' is enabled.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- `mc_ns_draw_overwritten' is not working as expected.  It appears that fake
  cursors are drawn outside of the area clipped, sometimes resulting in cursor
  fragments that are drawn in a different window; e.g., a top/bottom window split
  with the top window having crosshairs active.  Initial attempts at calling
  `mc_ns_clip_to_rect' from within `mc_ns_draw_overwritten' produced flickering
  of lines (presumably in the relevant vicinity).

- Add additional support for `ch_inactive_windows' and `fc_inactive_windows'
  when the variables have a `nil` value.  In such a case, the inactive windows
  should not display the crosshairs and/or visible fill column indicator.

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- NOTE:  As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake cursor)
  may not be updated as a result thereof.  As to lines that are not copied,
  portions may be updated and fake cursors would be removed thereby.

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  an minimal working example and file a bug report.

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.


[2019_05_27__21_42_30_553.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Sun, 02 Jun 2019 07:30:03 GMT) Full text and rfc822 format available.

Message #53 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Sun, 02 Jun 2019 00:29:09 -0700
[Message part 1 (text/plain, inline)]
VERSION:  021.000 [06/01/2019]

CHANGELOG:

-  Added a new feature to visually distinguish with user-defined colors when a
   fake cursor is on a screen line containing _only_ ZV, or subsequent to a
   screen line containing _only_ ZV, or all screen lines prior to a line
   containing _only_ ZV (if such a line exists), which includes a screen line
   that has characters and ends at ZV (i.e., no final new line).

   SCREENSHOT -- DARK BACKGROUND:

   https://lawlist.com/images/22873_17684__2019_06_01_dark_bg.png

   SCREENSHOT -- LIGHT BACKGROUND:

   https://lawlist.com/images/22873_17684__2019_06_01_light_bg.png

-  `free_window_matrices':  Added a call to free the fake cursor cache matrices.

-  Tweaked how colors are assigned for the MC_FRAMED_BOX when at region begin,
   region end, and in between region begin/end.

-  Fixed a crash caused by NULL glyph when attempting to cache coordinates for
   a right fringe bitmap when cursor is exactly at the right fringe.  When
   coordinates for the real cursor do not correlate to an actual glyph, we use
   the last glyph of the current row instead.

-  Fixed a crash caused by using the built-in region begin/end function, which
   failed when Fmarker_position returned a NULL Lisp_Object -- leading to one of
   those hard to debug bugs; i.e., when garbage collection chokes due to a NULL
   Lisp_Object.  `mc_region_limit' is now used instead.

-  Fixed a bug caused by a failure to have a `fill_column_trump_p` test at the
   tail end of `mc_update_text_area' which is used to suppress the vertical
   crosshairs ruler when the fill column indicator trumps at that exact X.

-  NS port:  Fixed a bug relating to `mc_ns_draw_overwritten' drawing fake
   cursors outside of the clipped area when dealing with STRETCH_GLYPH.

-  NS port:  Created a workaround to deal with the `row->clip' inhibiting the
   drawing of glyphs on the box family of fake cursors in certain circumstances.
   [More work needs to be done, but will likely require help from Emacs Devel.]


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out the crosshairs feature, type:  M-x +-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  install that package first.  [If the multiple-cursors package is installed, an
  eval-after-load "multiple-cursors-core" statement within `crosshairs.el` will
  redefine a couple of functions and set up a few keyboard shortcuts.]  If the
  multiple-cursors package by Magnar Sveen is not already installed, then here
  are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))


TODO:

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Add additional support for `ch_inactive_windows' and `fc_inactive_windows'
  when the variables have a `nil` value.  In such a case, the inactive windows
  should not display the crosshairs and/or visible fill column indicator.  At the
  present time, fake cursors are drawn in active/inactive windows alike.

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- NOTE:  As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  an minimal working example and file a bug report.

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

[2019_06_01__22_47_04_513.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Sat, 08 Jun 2019 23:45:01 GMT) Full text and rfc822 format available.

Message #56 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Sat, 08 Jun 2019 16:44:10 -0700
[Message part 1 (text/plain, inline)]
VERSION:  021.001 [06/08/2019]


CHANGELOG:

- Fixed bugs in `mc_xfree_cache_matrix', the most significant of which was the
  failure to reset struct members that were not allocated to memory dynamically.

- Fixed bugs in `mc_save_cache_matrix', the most significant of which was that
  some struct members were not being saved.

- Added `mc_traverse_cache_p' to be used in various `for` loops, which ensures
  that a uniform test is used everywhere [which was not previously the case].

- Fixed a bug in `mc_helper' relating to proper bookkeeping of the `vpos_used`
  member in the `mc_matrix'.

- Added `mc_cache_inspector' to help with debugging.

- `mc_set_essentials' is now called only once per `update_window' (at outset).

- Fixed a bug with respect to determining the `row_position` of the cursor row,
  which is the one exception where we consult the previous row in the desired
  matrix instead of consulting the previous row in the current matrix.

- Reduced overall footprint a little bit by restoring `it` struct to its original
  state -- the member `zv_p` is no longer needed by features 17684 / 22873.  The
  code used to record `it` struct member `zv_p` has been removed.  Reduced the
  additional `glyph` struct members to just `hpos`, `bytepos` and `relative_x`
  (which is not needed, but may be useful if debugging).  The code used to record
  the prior `glyph` struct members `x`, `y`, `vpos` and `zv_p` has been removed.

- Miscellaneous cleaning up of unused variables, shortened certain names, and
  tidied up some of the code.  Changed a couple of colors for even-at-zv ....

- Added screenshot of most of the features on all three GUI ports (X11, W32, NS).


SCREENSHOTS (X11, W32, NS):

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  install that package first.  [If the multiple-cursors package is installed, an
  eval-after-load "multiple-cursors-core" statement within `crosshairs.el` will
  redefine a couple of functions and set up a few keyboard shortcuts.]  If the
  multiple-cursors package by Magnar Sveen is not already installed, then here
  are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))


TODO:

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Add additional support for `ch_inactive_windows' and `fc_inactive_windows'
  when the variables have a `nil` value.  In such a case, the inactive windows
  should not display the crosshairs and/or visible fill column indicator.  At the
  present time, fake cursors are drawn in active/inactive windows alike.

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- NOTE:  As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  an minimal working example and file a bug report.

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

[2019_06_08__16_37_35_624.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Sun, 16 Jun 2019 08:08:01 GMT) Full text and rfc822 format available.

Message #59 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Sun, 16 Jun 2019 01:07:46 -0700
[Message part 1 (text/plain, inline)]
VERSION: 021.002 [06/15/2019]

CHANGELOG:

- `mc_row_position':  Added tests for an empty buffer (not narrowed) and an empty
  buffer (narrowed), both of which will be treated as an AT_ZV situation if VPOS
  is the first text row in the buffer excluding the header-line-format (if any).

- Compacted all of the calls to `mc_redraw_row' so that they are one-liners.

- Miscellaneous tidying up of code; changed a few names of some struct members.


SCREENSHOTS (X11, W32, NS):

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  install that package first.  [If the multiple-cursors package is installed, an
  eval-after-load "multiple-cursors-core" statement within `crosshairs.el` will
  redefine a couple of functions and set up a few keyboard shortcuts.]  If the
  multiple-cursors package by Magnar Sveen is not already installed, then here
  are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors))


TODO:

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Add additional support for `ch_inactive_windows' and `fc_inactive_windows'
  when the variables have a `nil` value.  In such a case, the inactive windows
  should not display the crosshairs and/or visible fill column indicator.  At the
  present time, fake cursors are drawn in active/inactive windows alike.

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- NOTE:  As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  an minimal working example and file a bug report.

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

[2019_06_15__21_52_03_071.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Mon, 24 Jun 2019 02:26:01 GMT) Full text and rfc822 format available.

Message #62 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Sun, 23 Jun 2019 19:25:16 -0700
[Message part 1 (text/plain, inline)]
VERSION:  021.003 [06/23/2019]


CHANGELOG:

- `bottom_vpos' has been removed as a function parameter of `mc_draw_row' and
  `mc_draw_glyphs'.

- Removed the `redisplay_interface' component named `mc_scribe_glyphs'.  Removed
  the function `mc_x_write_glyphs'.  `mc_draw_glyphs' is now called directly from
  `mc_update_text_area'.

- Revised instructions regarding how to use the built-in fake cursors with
  Magnar's library (multiple-cursors).  [Adjusted calls to `mc/built-in-cursors'
  within `crosshairs.el'.]

- Miscellaneous tidying-up of code.


SCREENSHOTS (X11, W32, NS):

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require 'crosshairs) and `crosshairs.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


TODO:

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Add additional support for `ch_inactive_windows' and `fc_inactive_windows'
  when the variables have a `nil` value.  In such a case, the inactive windows
  should not display the crosshairs and/or visible fill column indicator.  At the
  present time, fake cursors are drawn in active/inactive windows alike.

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- NOTE:  As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  an minimal working example and file a bug report.

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

[2019_06_23__17_05_04_651.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Sun, 30 Jun 2019 05:43:02 GMT) Full text and rfc822 format available.

Message #65 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Sat, 29 Jun 2019 22:42:10 -0700
[Message part 1 (text/plain, inline)]
VERSION:  021.004 [06/29/2019]


CHANGELOG:

- Fake cursors can now be suppressed in the inactive windows by setting to `nil'
  the buffer-local variables `mc-inactive-windows', `fc-inactive-windows', and/or
  `ch-inactive-windows'.  The left fringe bitmap indicator that coincides with
  the line containing POINT (if `ch-horizontal-ruler' is non-nil) is drawn in the
  inactive windows regardless of the boolean value of `ch-inactive-windows' --
  this is an intended feature.  The real fake cursor coinciding with the line
  containing POINT for inactive windows is drawn in the inactive windows -- this
  is an intended feature.  [Support for _suppression_ of fake cursors in the
  inactive windows had previously been disabled for an appreciable period of time
  because work needed to be done to ensure fake cursors are drawn correctly when
  `mc/fc/ch-inactive-windows' is non-nil; e.g., different colors for fake cursors
  in the inactive-windows.]

- Miscellaneous tidying-up of some code.


SCREENSHOTS (X11, W32, NS):

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 04/08/2019:

git reset --hard a038df77de7b1aa2d73a6478493b8838b59e4982

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require 'crosshairs) and `crosshairs.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


TODO:

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  a minimal working example and file a bug report.

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

- NOTE:  As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.

[2019_06_29__20_23_09_354.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Tue, 16 Jul 2019 19:29:01 GMT) Full text and rfc822 format available.

Message #68 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Tue, 16 Jul 2019 12:28:02 -0700
[Message part 1 (text/plain, inline)]
VERSION: 022.000 [07/14/2019]


CHANGELOG:

- Fast forward from 04/08/2019 to 07/14/2019; i.e., the attached patch applies to
  a recent version of the master branch as of 07/14/2019.  Each GUI port has
  been lightly tested to verify features 17684/22873 work as expected.

- Added a new member of the `mc_contents` struct to record the `row_position`,
  which is now used (in part) by `mc_update_window_erase' to determine whether
  an AT_ZV / POST_ZV fake cursor is the same as the previous loop -- disregarding
  lack of equality of the `*.bytepos` and `*.charpos` struct members.  An example
  where this is helpful is when a user adds / removes characters from the buffer,
  but does not add / remove a row.

- As to features 17684/22873, removed all calls to CHECK_BUFFER.  None of the
  buffer lisp objects are coming from the user (outside of C), so a `BUFFERP'
  check of `w->contents` is sufficient.

- Added screen recordings of features 17684/22873.

- Miscellaneous tidying-up of code.


VIDEOS:

w32:  https://youtu.be/r3BdJVlsAnQ

ns:  https://youtu.be/bc1h8jtbXmw

x11:  https://youtu.be/aCIFhD2Xz5s


SCREENSHOTS:

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 07/14/2019:

git reset --hard ac57c5093829ee09084c562bbbc1c412179be13d

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require 'crosshairs) and `crosshairs.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


TODO:

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  a minimal working example and file a bug report.

  (progn
    (defun test ()
    (interactive)
      (let ((ov (make-overlay (point) (1+ (point)) nil t t)))
        (overlay-put ov 'face '(:foreground "red"))))
    (global-set-key [f5] 'test)
    (split-window-horizontally)
    (switch-to-buffer (get-buffer-create "foo"))
    (setq bidi-display-reordering nil)
    (setq-local auto-hscroll-mode 'current-line)
    (dotimes (i 80)
      (insert (char-to-string (+ 65 i)))))

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

- NOTE:  As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.

[2019_07_16__12_05_58_696.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Tue, 23 Jul 2019 06:02:02 GMT) Full text and rfc822 format available.

Message #71 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Mon, 22 Jul 2019 23:01:19 -0700
[Message part 1 (text/plain, inline)]
VERSION: 022.001 [07/22/2019]


CHANGELOG:

- `mc_update_window_erase' no longer sets the `same_p` struct member to `false`,
  as this was undoing all of the work that had previously been done to discover
  and set `same_p` to `true` in previous loops through the caches of fake cursors.
  Although this bug may have been somewhat difficult for the naked eye to see,
  the fix will improve the overall performance in some situations by reducing the
  need to erase and redraw certain fake cursors.

- Miscellaneous tidying-up of code.


VIDEOS:

w32:  https://youtu.be/r3BdJVlsAnQ

ns:  https://youtu.be/bc1h8jtbXmw

x11:  https://youtu.be/aCIFhD2Xz5s


SCREENSHOTS:

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 07/14/2019:

git reset --hard ac57c5093829ee09084c562bbbc1c412179be13d

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require 'crosshairs) and `crosshairs.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


TODO:

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  a minimal working example and file a bug report.

  (progn
    (defun test ()
    (interactive)
      (let ((ov (make-overlay (point) (1+ (point)) nil t t)))
        (overlay-put ov 'face '(:foreground "red"))))
    (global-set-key [f5] 'test)
    (split-window-horizontally)
    (switch-to-buffer (get-buffer-create "foo"))
    (setq bidi-display-reordering nil)
    (setq-local auto-hscroll-mode 'current-line)
    (dotimes (i 80)
      (insert (char-to-string (+ 65 i)))))

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

- NOTE:  As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.

[2019_07_22__21_18_46_990.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Wed, 31 Jul 2019 19:40:01 GMT) Full text and rfc822 format available.

Message #74 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Wed, 31 Jul 2019 12:39:46 -0700
[Message part 1 (text/plain, inline)]
VERSION: 022.002 [07/31/2019]


CHANGELOG:

- Replaced optional debugging messages to STDERR with the variable `mc_stderr_p'
  instead of using `trace_redisplay_p'.

- `mc_update_window_erase' no longer excludes left/right fringe bitmaps from the
  `same_p` determination.  `mc_helper' now contains exceptions for the left/right
  fringe bitmap indicators, ensuring they are reset even if they are `same_p`.

- Added a NOTES section to this introductory commentary, including, a summary
  explaining generally the purpose of the dryrun in `update_window'.

- Removed `mc_rotate_matrix' and `mc_reverse_vpos'.

- Miscellaneous tidying-up of code.


VIDEOS:

w32:  https://youtu.be/r3BdJVlsAnQ

ns:  https://youtu.be/bc1h8jtbXmw

x11:  https://youtu.be/aCIFhD2Xz5s


SCREENSHOTS:

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 07/14/2019:

git reset --hard ac57c5093829ee09084c562bbbc1c412179be13d

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed"))))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require 'crosshairs) and `crosshairs.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


TODO:

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  a minimal working example and file a bug report.

  (progn
    (defun test ()
    (interactive)
      (let ((ov (make-overlay (point) (1+ (point)) nil t t)))
        (overlay-put ov 'face '(:foreground "red"))))
    (global-set-key [f5] 'test)
    (split-window-horizontally)
    (switch-to-buffer (get-buffer-create "foo"))
    (setq bidi-display-reordering nil)
    (setq-local auto-hscroll-mode 'current-line)
    (dotimes (i 80)
      (insert (char-to-string (+ 65 i)))))

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]


NOTES:

- Our journey begins at the outset of `update_window' when
  `mc_update_window_dryrun' performs a `!draw_p` simulation to create a new
  cache of fake cursors that are stored in the `w->mc_matrix`.  The cache from
  the previous redisplay is copied to a temporary `mc_matrix` under the name of
  `old_matrix`.  At the tail end of `mc_update_window_dryrun',
  `mc_update_window_erase' compares the new `w->mc_matrix` with the `old_matrix`
  to determine which fake cursors are the same -- setting the `same_p` boolean
  struct member accordingly for each applicable fake cursor within the
  `w->mc_matrix`.  All fake cursors in the `old_matrix` that are `!same_p` get
  erased at this juncture.  [Fn 1.]  After the dryrun is complete,
  `update_window' does the real thing -- `draw_p`.  As to the `from_where`
  situations of SKIPPED, POST_CHANGED, UNCHANGED, and SET_CURSOR_TWO,
  `mc_helper' compares the incoming tentative fake cursor with the
  `w->mc_matrix` to see if it has previously been marked as `same_p` -- if it is
  `!same_p`, then the fake cursor is drawn and we `return`.  Fake cursors that
  have a `cursor_type` of MC_LEFT_FRINGE_BITMAP or MC_RIGHT_FRINGE_BITMAP are
  always reset even if they are `same_p`.  As to the `from_where` situations of
  SCRIBE_ONE, SCRIBE_TWO, SCRIBE_THREE, and NOWHERE, `mc_helper' always causes
  fake cursors to be drawn (because new glyphs were written to the glass, or the
  area to the right of the display line was cleared) and we `return`.
. Fn. 1:  Even though writing new glyphs to the glass (SCRIBE_ONE, SCRIBE_TWO,
  and SCRIBE_THREE) would erase fake cursors within those boundaries, it is
  still necessary to erase `!same_p` fake cursors prior thereto.  This is
  because `scrolling_window' occurs before new glyphs are written and
  `rif->scroll_run_hook' may copy one or more rows to other areas of the glass.
  It is not worth the effort to programmatically track both the _copied_ fake
  cursors and the _original_ fake cursors from the previous redisplay cycle,
  whose glyphs may remain where they are in the current redisplay cycle because
  they satisfy the `GLYPH_EQUAL_P' test.

- As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.
  `mc_rotate_matrix' and `mc_reverse_vpos' were removed with patch v. 022.002.

[2019_07_31__12_36_32_978.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Fri, 23 Aug 2019 05:21:02 GMT) Full text and rfc822 format available.

Message #77 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors); and, #17684 (crosshairs).
Date: Thu, 22 Aug 2019 22:19:54 -0700
[Message part 1 (text/plain, inline)]
VERSION: 022.003 [08/22/2019]


CHANGELOG:

- Fixed a bug preventing the visible fill column indicator from displaying on
  continuation lines when a partially visible glyph is straddling the window
  body width limit (aka text_area_width).

- Fringe bitmap faces are now handled with `lookup_derived_face' instead of
  `lookup_named_face' so that the background color of the fringe will be taken
  into consideration (if it is different than the default background face).

- `mc_draw_erase_hybrid':  No need to call `mc_draw_fringe_bitmap' -- setting the
  rows with the necessary fringe bitmap data ensures `draw_row_fringe_bitmaps'
  will handle everything when needed.

- `mc_update_window_erase':  Fixed a couple of warnings during the build of Emacs
  relating to `fprintf' arguments not matching the expected %d\int format.

- Revisions to the NOTES section of this commentary.

- Miscellaneous tidying-up of code.


VIDEOS:

w32:  https://youtu.be/r3BdJVlsAnQ

ns:  https://youtu.be/bc1h8jtbXmw

x11:  https://youtu.be/aCIFhD2Xz5s


SCREENSHOTS:

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 07/14/2019:

git reset --hard ac57c5093829ee09084c562bbbc1c412179be13d

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed")))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require 'crosshairs) and `crosshairs.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


NOTES:

- Our journey begins at the outset of `update_window' when
  `mc_update_window_dryrun' performs a `!draw_p` simulation to create a new
  cache of fake cursors that are stored in the `w->mc_matrix`.  The cache of
  fake cursors from the previous redisplay is copied to a temporary `mc_matrix`
  under the name of `old_matrix`.  `mc_update_text_area' (used for `!draw_p` /
  `draw_p` situations) calls `mc_draw_glyphs' (writes glyphs to the glass)
  followed by `mc_draw_row' (writes fake cursors to the glass immediately
  thereafter).  At the tail end of `mc_update_window_dryrun',
  `mc_update_window_erase' compares the new `w->mc_matrix` with the `old_matrix`
  to determine which fake cursors are the same -- setting the `same_p` boolean
  struct member accordingly for each applicable fake cursor within the
  `w->mc_matrix`.  All fake cursors in the `old_matrix` that are `!same_p` get
  erased at this juncture.  [Fn 1.]  After the dryrun is complete,
  `update_window' does the real thing -- `draw_p`.  As to the `from_where`
  situations of SKIPPED, POST_CHANGED, UNCHANGED, and SET_CURSOR_TWO,
  `mc_helper' compares the incoming tentative fake cursor with the
  `w->mc_matrix` to see if it has previously been marked as `same_p` -- if it is
  `!same_p`, then the fake cursor is drawn and we `return`.  Fake cursors that
  have a `cursor_type` of MC_LEFT_FRINGE_BITMAP or MC_RIGHT_FRINGE_BITMAP are
  always reset even if they are `same_p`.  As to the `from_where` situations of
  SCRIBE_ONE, SCRIBE_TWO, SCRIBE_THREE, and NOWHERE, `mc_helper' always causes
  fake cursors to be drawn (because new glyphs were written to the glass, or the
  area to the right of the display line was cleared) and we `return`.

. Fn. 1:  Even though writing new glyphs to the glass (SCRIBE_ONE, SCRIBE_TWO,
  and SCRIBE_THREE) would erase fake cursors within those boundaries, it is
  still necessary to erase `!same_p` fake cursors prior thereto.  This is
  because `scrolling_window' occurs before new glyphs are written and
  `rif->scroll_run_hook' may copy one or more rows to other areas of the glass.
  It is not worth the effort to programmatically track both the _copied_ fake
  cursors and the _original_ fake cursors from the previous redisplay cycle,
  whose glyphs may remain where they are in the current redisplay cycle because
  they satisfy the `GLYPH_EQUAL_P' test.

- The rest of our journey takes place wherever `draw_glyphs' would ordinarily be
  called, excluding `update_text_area'.  If features 17684/22873 are active,
  `mc_redraw_row' calls `mc_draw_glyphs' (writes glyphs to the glass) and fake
  cursors are written to the glass immediately thereafter (if the coordinates
  coincide with prerecorded data in the `w->mc_matrix`).  The functions
  containing the aforementioned calls are:
  . `gui_insert_glyphs'
  . `gui_fix_overlapping_area'
  . `draw_row_with_mouse_face'
  . `expose_area'
  . `expose_line'
  . `redraw_overlapped_rows' [which has been incorporated into `update_window']

- As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.
  `mc_rotate_matrix' and `mc_reverse_vpos' were removed with patch v. 022.002.

- NS:  As of 09/28/2018 (7946445962372c4255180af45cb7c857f1b0b5fa), the NS port
  no longer does anything useful during `update_window' except mark dirty
  rectangles.  All drawing is now done when the MacOS calls `drawRect', which in
  turn calls `expose_frame'.


TODO:

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  a minimal working example and file a bug report.

  (progn
    (defun test ()
    (interactive)
      (let ((ov (make-overlay (point) (1+ (point)) nil t t)))
        (overlay-put ov 'face '(:foreground "red"))))
    (global-set-key [f5] 'test)
    (split-window-horizontally)
    (switch-to-buffer (get-buffer-create "foo"))
    (setq bidi-display-reordering nil)
    (setq-local auto-hscroll-mode 'current-line)
    (dotimes (i 80)
      (insert (char-to-string (+ 65 i)))))

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

[2019_08_22__20_16_49_786.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Thu, 17 Oct 2019 21:17:01 GMT) Full text and rfc822 format available.

Message #80 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors);
 and, #17684 (crosshairs / fill-column).
Date: Thu, 17 Oct 2019 14:08:08 -0700
[Message part 1 (text/plain, inline)]
VERSION: 022.004 [10/17/2019]


CHANGELOG:

- HORIZONTAL_RULER:  Fixed a bug in `mc_engine' when a STRETCH_GLYPH is the last
  glyph of the display line and the floating horizontal ruler needs to extend all
  the way to the window edge.  [The `fx` coordinate needed to be advanced.]

- Fixed a bug that occasionally erased the real fake cursor and sometimes the
  characters to the left/right thereof when overlapping exists.  This was due to
  `display_and_set_cursor' being called when one or more of the fake cursor caches
   was still populated, even though the relevant buffer-local variables were nil.
  [A check has been added to ascertain whether any of the caches are populated.]

- Miscellaneous tidying-up of code.


VIDEOS:

w32:  https://youtu.be/r3BdJVlsAnQ

ns:  https://youtu.be/bc1h8jtbXmw

x11:  https://youtu.be/aCIFhD2Xz5s


SCREENSHOTS:

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 07/14/2019:

git reset --hard ac57c5093829ee09084c562bbbc1c412179be13d

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed")))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require 'crosshairs) and `crosshairs.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


NOTES:

- Our journey begins at the outset of `update_window' when
  `mc_update_window_dryrun' performs a `!draw_p` simulation to create a new
  cache of fake cursors that are stored in the `w->mc_matrix`.  The cache of
  fake cursors from the previous redisplay is copied to a temporary `mc_matrix`
  under the name of `old_matrix`.  `mc_update_text_area' (used for `!draw_p` /
  `draw_p` situations) calls `mc_draw_glyphs' (writes glyphs to the glass)
  followed by `mc_draw_row' (writes fake cursors to the glass immediately
  thereafter).  At the tail end of `mc_update_window_dryrun',
  `mc_update_window_erase' compares the new `w->mc_matrix` with the `old_matrix`
  to determine which fake cursors are the same -- setting the `same_p` boolean
  struct member accordingly for each applicable fake cursor within the
  `w->mc_matrix`.  All fake cursors in the `old_matrix` that are `!same_p` get
  erased at this juncture.  [Fn 1.]  After the dryrun is complete,
  `update_window' does the real thing -- `draw_p`.  As to the `from_where`
  situations of SKIPPED, POST_CHANGED, UNCHANGED, and SET_CURSOR_TWO,
  `mc_helper' compares the incoming tentative fake cursor with the
  `w->mc_matrix` to see if it has previously been marked as `same_p` -- if it is
  `!same_p`, then the fake cursor is drawn and we `return`.  Fake cursors that
  have a `cursor_type` of MC_LEFT_FRINGE_BITMAP or MC_RIGHT_FRINGE_BITMAP are
  always reset even if they are `same_p`.  As to the `from_where` situations of
  SCRIBE_ONE, SCRIBE_TWO, SCRIBE_THREE, and NOWHERE, `mc_helper' always causes
  fake cursors to be drawn (because new glyphs were written to the glass, or the
  area to the right of the display line was cleared) and we `return`.

. Fn. 1:  Even though writing new glyphs to the glass (SCRIBE_ONE, SCRIBE_TWO,
  and SCRIBE_THREE) would erase fake cursors within those boundaries, it is
  still necessary to erase `!same_p` fake cursors prior thereto.  This is
  because `scrolling_window' occurs before new glyphs are written and
  `rif->scroll_run_hook' may copy one or more rows to other areas of the glass.
  It is not worth the effort to programmatically track both the _copied_ fake
  cursors and the _original_ fake cursors from the previous redisplay cycle,
  whose glyphs may remain where they are in the current redisplay cycle because
  they satisfy the `GLYPH_EQUAL_P' test.

- The rest of our journey takes place wherever `draw_glyphs' would ordinarily be
  called, excluding `update_text_area'.  If features 17684/22873 are active,
  `mc_redraw_row' calls `mc_draw_glyphs' (writes glyphs to the glass) and fake
  cursors are written to the glass immediately thereafter (if the coordinates
  coincide with prerecorded data in the `w->mc_matrix`).  The functions
  containing the aforementioned calls are:
  . `gui_insert_glyphs'
  . `gui_fix_overlapping_area'
  . `draw_row_with_mouse_face'
  . `expose_area'
  . `expose_line'
  . `redraw_overlapped_rows' [which has been incorporated into `update_window']

- As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.
  `mc_rotate_matrix' and `mc_reverse_vpos' were removed with patch v. 022.002.

- NS:  As of 09/28/2018 (7946445962372c4255180af45cb7c857f1b0b5fa), the NS port
  no longer does anything useful during `update_window' except mark dirty
  rectangles.  All drawing is now done when the MacOS calls `drawRect', which in
  turn calls `expose_frame'.


TODO:

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  a minimal working example and file a bug report.

  (progn
    (defun test ()
    (interactive)
      (let ((ov (make-overlay (point) (1+ (point)) nil t t)))
        (overlay-put ov 'face '(:foreground "red"))))
    (global-set-key [f5] 'test)
    (split-window-horizontally)
    (switch-to-buffer (get-buffer-create "foo"))
    (setq bidi-display-reordering nil)
    (setq-local auto-hscroll-mode 'current-line)
    (dotimes (i 80)
      (insert (char-to-string (+ 65 i)))))

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

[2019_10_17__13_42_27_237.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Fri, 18 Oct 2019 01:13:03 GMT) Full text and rfc822 format available.

Message #83 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Subject: #22873 (multiple fake cursors);
 and, #17684 (crosshairs / fill-column).
Date: Thu, 17 Oct 2019 18:12:35 -0700
[Message part 1 (text/plain, inline)]
VERSION: 022.004 [10/17/2019]

See previous post:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22873#170

The attached patch supersedes the patch attached to the previous post.  This new patch contains the modification to display_and_set_cursor, which is described in the CHANGELOG section.


[2019_10_17__18_06_25_414.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Mon, 18 Nov 2019 06:59:01 GMT) Full text and rfc822 format available.

Message #86 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors);
 and, #17684 (crosshairs / fill-column).
Date: Sun, 17 Nov 2019 22:58:13 -0800
[Message part 1 (text/plain, inline)]
VERSION: 022.005 [11/17/2019]


CHANGELOG:

- Fixed a bug affecting the NS port relating to redrawing fake cursors on left/
  right overwritten glyphs.  When `mc_update_window_erase' calls `mc_erase_cursor',
  the window cache of fake cursors has already been updated even though the
  window contents have not.  As such, it is necessary to use the `old_cache'
  (saved fake cursor cache from the previous command loop) to determine which
  fake cursors must be redrawn.  [Prior to this bug fix, the updated cache of
  fake cursors (i.e., `w->mc_matrix`) was used when determining which fake
  cursors to redraw on the left/right overwritten glyphs.]  As to the W32 port
  and the X11 port, support for redrawing fake cursors on left/right overwritten
  glyphs is still on the "todo list".  However, `mc_w32_draw_glyph_string' and
  `mc_x_draw_glyph_string' have now been updated to include an extra argument
  for the `mc_matrix`.

- Miscellaneous tidying-up of code.


VIDEOS:

w32:  https://youtu.be/r3BdJVlsAnQ

ns:  https://youtu.be/bc1h8jtbXmw

x11:  https://youtu.be/aCIFhD2Xz5s


SCREENSHOTS:

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 07/14/2019:

git reset --hard ac57c5093829ee09084c562bbbc1c412179be13d

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed")))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require 'crosshairs) and `crosshairs.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


NOTES:

- Our journey begins at the outset of `update_window' when
  `mc_update_window_dryrun' performs a `!draw_p` simulation to create a new
  cache of fake cursors that are stored in the `w->mc_matrix`.  The cache of
  fake cursors from the previous redisplay is copied to a temporary `mc_matrix`
  under the name of `old_matrix`.  `mc_update_text_area' (used for `!draw_p` /
  `draw_p` situations) calls `mc_draw_glyphs' (writes glyphs to the glass)
  followed by `mc_draw_row' (writes fake cursors to the glass immediately
  thereafter).  At the tail end of `mc_update_window_dryrun',
  `mc_update_window_erase' compares the new `w->mc_matrix` with the `old_matrix`
  to determine which fake cursors are the same -- setting the `same_p` boolean
  struct member accordingly for each applicable fake cursor within the
  `w->mc_matrix`.  All fake cursors in the `old_matrix` that are `!same_p` get
  erased at this juncture.  [Fn 1.]  After the dryrun is complete,
  `update_window' does the real thing -- `draw_p`.  As to the `from_where`
  situations of SKIPPED, POST_CHANGED, UNCHANGED, and SET_CURSOR_TWO,
  `mc_helper' compares the incoming tentative fake cursor with the
  `w->mc_matrix` to see if it has previously been marked as `same_p` -- if it is
  `!same_p`, then the fake cursor is drawn and we `return`.  Fake cursors that
  have a `cursor_type` of MC_LEFT_FRINGE_BITMAP or MC_RIGHT_FRINGE_BITMAP are
  always reset even if they are `same_p`.  As to the `from_where` situations of
  SCRIBE_ONE, SCRIBE_TWO, SCRIBE_THREE, and NOWHERE, `mc_helper' always causes
  fake cursors to be drawn (because new glyphs were written to the glass, or the
  area to the right of the display line was cleared) and we `return`.

. Fn. 1:  Even though writing new glyphs to the glass (SCRIBE_ONE, SCRIBE_TWO,
  and SCRIBE_THREE) would erase fake cursors within those boundaries, it is
  still necessary to erase `!same_p` fake cursors prior thereto.  This is
  because `scrolling_window' occurs before new glyphs are written and
  `rif->scroll_run_hook' may copy one or more rows to other areas of the glass.
  It is not worth the effort to programmatically track both the _copied_ fake
  cursors and the _original_ fake cursors from the previous redisplay cycle,
  whose glyphs may remain where they are in the current redisplay cycle because
  they satisfy the `GLYPH_EQUAL_P' test.

- The rest of our journey takes place wherever `draw_glyphs' would ordinarily be
  called, excluding `update_text_area'.  If features 17684/22873 are active,
  `mc_redraw_row' calls `mc_draw_glyphs' (writes glyphs to the glass) and fake
  cursors are written to the glass immediately thereafter (if the coordinates
  coincide with prerecorded data in the `w->mc_matrix`).  The functions
  containing the aforementioned calls are:
  . `gui_insert_glyphs'
  . `gui_fix_overlapping_area'
  . `draw_row_with_mouse_face'
  . `expose_area'
  . `expose_line'
  . `redraw_overlapped_rows' [which has been incorporated into `update_window']

- As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.
  `mc_rotate_matrix' and `mc_reverse_vpos' were removed with patch v. 022.002.

- NS:  As of 09/28/2018 (7946445962372c4255180af45cb7c857f1b0b5fa), the NS port
  no longer does anything useful during `update_window' except mark dirty
  rectangles.  All drawing is now done when the MacOS calls `drawRect', which in
  turn calls `expose_frame'.


TODO:

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  a minimal working example and file a bug report.

  (progn
    (defun test ()
    (interactive)
      (let ((ov (make-overlay (point) (1+ (point)) nil t t)))
        (overlay-put ov 'face '(:foreground "red"))))
    (global-set-key [f5] 'test)
    (split-window-horizontally)
    (switch-to-buffer (get-buffer-create "foo"))
    (setq bidi-display-reordering nil)
    (setq-local auto-hscroll-mode 'current-line)
    (dotimes (i 80)
      (insert (char-to-string (+ 65 i)))))

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- There is a bug affecting the recorded `w->mc.lnum_pixel_width` that is
  observable when not running under gdb, but disappears when running under gdb.
  While viewing a folded org-mode buffer, the non-gdb instance had a visible
  line number pixel-width of 44, but Emacs treated it as fluctuating between
  44 and 55 as the cursor was moved to the end of line.  In the gdb instance,
  the visible line number pixel width was 55 with no fluctuation under the same
  conditions as the non-gdb instance.  This appears to be a different bug than
  bug#32177 (current line number shifts one column to the left) because the line
  number of the current line does not shift left, and changing the bidi settings
  did not correct the issue.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

[2019_11_17__20_26_22_702.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Mon, 27 Jan 2020 07:40:02 GMT) Full text and rfc822 format available.

Message #89 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 akioburns <at> icloud.com
Subject: #22873 (multiple fake cursors);
 and, #17684 (crosshairs / fill-column).
Date: Sun, 26 Jan 2020 23:39:21 -0800
[Message part 1 (text/plain, inline)]
VERSION: 022.006 [01/26/2020]


CHANGELOG:

- Fixed a bug in `mc_engine' that erroneously permitted an attempt to draw a
  floating fake cursors (horizontal ruler) when the WD (width) had a negative
  value.  It is now properly suppressed when the preceding character is MC_GLYPH.

- crosshairs.el:  The variable `+-fill-column' is now buffer-local.  Renamed the
  variable `+-parens-p' to `+-parens-highlight'.

- The setting of `w->mc.lnum_pixel_width` within `maybe_produce_line_number' is
  now conditioned upon (it->area == TEXT_AREA && IT_CHARPOS (*it) == wstart.charpos):

  https://lists.gnu.org/archive/html/emacs-devel/2019-12/msg00232.html

- Miscellaneous tidying-up of code.


VIDEOS:

w32:  https://youtu.be/r3BdJVlsAnQ

ns:  https://youtu.be/bc1h8jtbXmw

x11:  https://youtu.be/aCIFhD2Xz5s


SCREENSHOTS:

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 07/14/2019:

git reset --hard ac57c5093829ee09084c562bbbc1c412179be13d

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed")))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require 'crosshairs) and `crosshairs.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


NOTES:

- Our journey begins at the outset of `update_window' when
  `mc_update_window_dryrun' performs a `!draw_p` simulation to create a new
  cache of fake cursors that are stored in the `w->mc_matrix`.  The cache of
  fake cursors from the previous redisplay is copied to a temporary `mc_matrix`
  under the name of `old_matrix`.  `mc_update_text_area' (used for `!draw_p` /
  `draw_p` situations) calls `mc_draw_glyphs' (writes glyphs to the glass)
  followed by `mc_draw_row' (writes fake cursors to the glass immediately
  thereafter).  At the tail end of `mc_update_window_dryrun',
  `mc_update_window_erase' compares the new `w->mc_matrix` with the `old_matrix`
  to determine which fake cursors are the same -- setting the `same_p` boolean
  struct member accordingly for each applicable fake cursor within the
  `w->mc_matrix`.  All fake cursors in the `old_matrix` that are `!same_p` get
  erased at this juncture.  [Fn 1.]  After the dryrun is complete,
  `update_window' does the real thing -- `draw_p`.  As to the `from_where`
  situations of SKIPPED, POST_CHANGED, UNCHANGED, and SET_CURSOR_TWO,
  `mc_helper' compares the incoming tentative fake cursor with the
  `w->mc_matrix` to see if it has previously been marked as `same_p` -- if it is
  `!same_p`, then the fake cursor is drawn and we `return`.  Fake cursors that
  have a `cursor_type` of MC_LEFT_FRINGE_BITMAP or MC_RIGHT_FRINGE_BITMAP are
  always reset even if they are `same_p`.  As to the `from_where` situations of
  SCRIBE_ONE, SCRIBE_TWO, SCRIBE_THREE, and NOWHERE, `mc_helper' always causes
  fake cursors to be drawn (because new glyphs were written to the glass, or the
  area to the right of the display line was cleared) and we `return`.

. Fn. 1:  Even though writing new glyphs to the glass (SCRIBE_ONE, SCRIBE_TWO,
  and SCRIBE_THREE) would erase fake cursors within those boundaries, it is
  still necessary to erase `!same_p` fake cursors prior thereto.  This is
  because `scrolling_window' occurs before new glyphs are written and
  `rif->scroll_run_hook' may copy one or more rows to other areas of the glass.
  It is not worth the effort to programmatically track both the _copied_ fake
  cursors and the _original_ fake cursors from the previous redisplay cycle,
  whose glyphs may remain where they are in the current redisplay cycle because
  they satisfy the `GLYPH_EQUAL_P' test.

- The rest of our journey takes place wherever `draw_glyphs' would ordinarily be
  called, excluding `update_text_area'.  If features 17684/22873 are active,
  `mc_redraw_row' calls `mc_draw_glyphs' (writes glyphs to the glass) and fake
  cursors are written to the glass immediately thereafter (if the coordinates
  coincide with prerecorded data in the `w->mc_matrix`).  The functions
  containing the aforementioned calls are:
  . `gui_insert_glyphs'
  . `gui_fix_overlapping_area'
  . `draw_row_with_mouse_face'
  . `expose_area'
  . `expose_line'
  . `redraw_overlapped_rows' [which has been incorporated into `update_window']

- As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.
  `mc_rotate_matrix' and `mc_reverse_vpos' were removed with patch v. 022.002.

- NS:  As of 09/28/2018 (7946445962372c4255180af45cb7c857f1b0b5fa), the NS port
  no longer does anything useful during `update_window' except mark dirty
  rectangles.  All drawing is now done when the MacOS calls `drawRect', which in
  turn calls `expose_frame'.


TODO:

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  a minimal working example and file a bug report.

  (progn
    (defun test ()
    (interactive)
      (let ((ov (make-overlay (point) (1+ (point)) nil t t)))
        (overlay-put ov 'face '(:foreground "red"))))
    (global-set-key [f5] 'test)
    (split-window-horizontally)
    (switch-to-buffer (get-buffer-create "foo"))
    (setq bidi-display-reordering nil)
    (setq-local auto-hscroll-mode 'current-line)
    (dotimes (i 80)
      (insert (char-to-string (+ 65 i)))))

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

[2020_01_26__21_06_44_685.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Wed, 04 Mar 2020 09:04:02 GMT) Full text and rfc822 format available.

Message #92 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: mbork <at> mbork.pl, rms <at> gnu.org, johnw <at> gnu.org, akioburns <at> icloud.com,
 eliz <at> gnu.org, drew.adams <at> oracle.com
Subject: #22873 (multiple fake cursors);
 and, #17684 (crosshairs / fill-column).
Date: Wed, 04 Mar 2020 01:03:10 -0800
[Message part 1 (text/plain, inline)]
VERSION:  022.007 [03/03/2020]


CHANGELOG:

- nsterm.m:  Bug fix in `mc_ns_draw_window_cursor' relating to a situation where
  the `cursor_glyph` is NULL and the face_id is invalid.  In such a situation,
  we now use the DEFAULT_FACE_ID.

- Pursuant to the written request of Drew Adams on 01-27-2020 to change the name
  of the "crosshairs.el" Lisp file to something else, said file has been changed
  to the file name of "+-mode.el".

- Miscellaneous tidying-up of code.


VIDEOS:

w32:  https://youtu.be/r3BdJVlsAnQ

ns:  https://youtu.be/bc1h8jtbXmw

x11:  https://youtu.be/aCIFhD2Xz5s


SCREENSHOTS:

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  In the new emacs folder, go back to an Emacs version from 07/14/2019:

git reset --hard ac57c5093829ee09084c562bbbc1c412179be13d

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed")))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require '+-mode) and `+-mode.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


NOTES:

- Our journey begins at the outset of `update_window' when
  `mc_update_window_dryrun' performs a `!draw_p` simulation to create a new
  cache of fake cursors that are stored in the `w->mc_matrix`.  The cache of
  fake cursors from the previous redisplay is copied to a temporary `mc_matrix`
  under the name of `old_matrix`.  `mc_update_text_area' (used for `!draw_p` /
  `draw_p` situations) calls `mc_draw_glyphs' (writes glyphs to the glass)
  followed by `mc_draw_row' (writes fake cursors to the glass immediately
  thereafter).  At the tail end of `mc_update_window_dryrun',
  `mc_update_window_erase' compares the new `w->mc_matrix` with the `old_matrix`
  to determine which fake cursors are the same -- setting the `same_p` boolean
  struct member accordingly for each applicable fake cursor within the
  `w->mc_matrix`.  All fake cursors in the `old_matrix` that are `!same_p` get
  erased at this juncture.  [Fn 1.]  After the dryrun is complete,
  `update_window' does the real thing -- `draw_p`.  As to the `from_where`
  situations of SKIPPED, POST_CHANGED, UNCHANGED, and SET_CURSOR_TWO,
  `mc_helper' compares the incoming tentative fake cursor with the
  `w->mc_matrix` to see if it has previously been marked as `same_p` -- if it is
  `!same_p`, then the fake cursor is drawn and we `return`.  Fake cursors that
  have a `cursor_type` of MC_LEFT_FRINGE_BITMAP or MC_RIGHT_FRINGE_BITMAP are
  always reset even if they are `same_p`.  As to the `from_where` situations of
  SCRIBE_ONE, SCRIBE_TWO, SCRIBE_THREE, and NOWHERE, `mc_helper' always causes
  fake cursors to be drawn (because new glyphs were written to the glass, or the
  area to the right of the display line was cleared) and we `return`.

. Fn. 1:  Even though writing new glyphs to the glass (SCRIBE_ONE, SCRIBE_TWO,
  and SCRIBE_THREE) would erase fake cursors within those boundaries, it is
  still necessary to erase `!same_p` fake cursors prior thereto.  This is
  because `scrolling_window' occurs before new glyphs are written and
  `rif->scroll_run_hook' may copy one or more rows to other areas of the glass.
  It is not worth the effort to programmatically track both the _copied_ fake
  cursors and the _original_ fake cursors from the previous redisplay cycle,
  whose glyphs may remain where they are in the current redisplay cycle because
  they satisfy the `GLYPH_EQUAL_P' test.

- The rest of our journey takes place wherever `draw_glyphs' would ordinarily be
  called, excluding `update_text_area'.  If features 17684/22873 are active,
  `mc_redraw_row' calls `mc_draw_glyphs' (writes glyphs to the glass) and fake
  cursors are written to the glass immediately thereafter (if the coordinates
  coincide with prerecorded data in the `w->mc_matrix`).  The functions
  containing the aforementioned calls are:
  . `gui_insert_glyphs'
  . `gui_fix_overlapping_area'
  . `draw_row_with_mouse_face'
  . `expose_area'
  . `expose_line'
  . `redraw_overlapped_rows' [which has been incorporated into `update_window']

- As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.
  `mc_rotate_matrix' and `mc_reverse_vpos' were removed with patch v. 022.002.

- NS:  As of 09/28/2018 (7946445962372c4255180af45cb7c857f1b0b5fa), the NS port
  no longer does anything useful during `update_window' except mark dirty
  rectangles.  All drawing is now done when the MacOS calls `drawRect', which in
  turn calls `expose_frame'.  This was done to add support for MacOS Mojave ....


TODO:

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  a minimal working example and file a bug report.

  (progn
    (defun test ()
    (interactive)
      (let ((ov (make-overlay (point) (1+ (point)) nil t t)))
        (overlay-put ov 'face '(:foreground "red"))))
    (global-set-key [f5] 'test)
    (split-window-horizontally)
    (switch-to-buffer (get-buffer-create "foo"))
    (setq bidi-display-reordering nil)
    (setq-local auto-hscroll-mode 'current-line)
    (dotimes (i 80)
      (insert (char-to-string (+ 65 i)))))

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

[2020_03_03__22_21_51_685.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Sat, 02 May 2020 20:51:01 GMT) Full text and rfc822 format available.

Message #95 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: 22873 <at> debbugs.gnu.org,17684 <at> debbugs.gnu.org
Cc: mbork <at> mbork.pl, rms <at> gnu.org, johnw <at> gnu.org, akioburns <at> icloud.com,
 eliz <at> gnu.org, drew.adams <at> oracle.com
Subject: #22873 (multiple fake cursors);
 and, #17684 (crosshairs / fill-column).
Date: Sat, 02 May 2020 13:50:18 -0700
[Message part 1 (text/plain, inline)]
VERSION:  022.008 [05/02/2020]


CHANGELOG:

- Calculate and set it->lnum when both NILP (Vdisplay_line_numbers) and features
  22873 / 17684 are active.  Line numbers are now recorded in the struct of each
  glyph:  glyph->lnum = it->lnum.  The cache of multiple fake cursors has been
  revised to also record the lnum of each fake cursor.  The recorded lnum is used
  to test for a `same_p` fake cursor situation; i.e., whether fake cursors should
  be erased and/or redrawn.

. The lnum is needed for an apparently uncommon, but nevertheless reproducible
  situation wherein a screen line is added/deleted and there are two or more
  subsequent consecutive lines having the same content; and, the character(s)
  added/deleted is/are the same size/shape of the subsequent consecutive screen
  lines.  `mc_update_window_erase' will erase a fake cursor on one of those
  subsequent consecutive lines depending upon whether the a screen line above is
  added/deleted.  With the unique exception of the recorded lnum, all other data
  in the cache of fake cursors will be identical as to one of those subsequent
  consecutive screen lines.

. EXAMPLE (word-wrap is non-nil) -- modification of the first paragraph by adding/
  deleting the word "boy" causes the screen line containing only the word group
  "fudge." to be added/deleted.  The fake cursor for the first _or_ second line
  containing "~//" will be erased, but the fake cursor for said line will not be
  redrawn by `mc_helper' unless the lnum data was previously used by
  `mc_update_window_erase' to make a the `same_p` determination.  In other words,
  the fake cursor at isue would be `same_p` _without_ using the lnum data, but
  is `!same_p` when we use the lnum data.

  Every good boy | deserves fudge.  Every good boy deserves fudge.  Every good ↩
  boy deserves fudge.| Every good boy deserves fudge.  Every good boy deserves ↩
  fudge.         |
                 |
  ~//            |   <=== This fake cursor IF adding the whole word "boy" with redo;
  ~//            |   <=== or, this fake cursor IF deleting the whole word "boy".

. The performance hit is zero when built-in line numbers are active, but perhaps
  mildly detectable when built-in line numbers are turned off.  Although line
  numbers are not being generated on the glass in the latter situation, Emacs will
  nevertheless be calling `display_count_lines_visually/logically' at the same
  locations as if the built-in line numbers were turned on.

. When `mc_update_text_area' processes the line containing the fake cursor that
  needs to be redrawn, the line is deemed to be UNCHANGED.  `clear_end_of_line'
  is not triggered and no floating fake cursors are redrawn based thereon.  This
  analysis was helpful in narrowing down the issue to the need for the lnum data
  as described hereinabove.


VIDEOS:

w32:  https://youtu.be/r3BdJVlsAnQ

ns:  https://youtu.be/bc1h8jtbXmw

x11:  https://youtu.be/aCIFhD2Xz5s


SCREENSHOTS:

https://www.lawlist.com/images/22873_17684_light_dark_backgrounds.png


SETUP:

Step 1:  git clone -b master git://git.sv.gnu.org/emacs.git

Step 2:  Due to lack of free time available to dedicate to the development of
         features 22873 / 17684, applicability of the patch to the master branch
         is frozen at 07/14/2019:  ac57c5093829ee09084c562bbbc1c412179be13d

         In the new emacs repository folder, execute a hard reset to 07/14/2019:

         git reset --hard ac57c5093829ee09084c562bbbc1c412179be13d

Step 3:  From within the new emacs folder created in Step 1, apply the patch:

         git apply /path/to/the/patch.diff

Step 4:  ./autogen.sh

Step 5:  ./configure ... [your custom options]

Step 6:  make

Step 7:  make install


USAGE:

- For a minimal working example of built-in fake cursors, type:  M-x mc-test

  ;;; TURN ON FAKE CURSORS (buffer position, cursor-type, cursor color):

  (setq mc-conf '((1 "hbar" "magenta")
                  (2 "bar" "purple")
                  (3 "box" "#00FF00")
                  (4 "hollow" "#0000FF")
                  (5 ("hbar" 3) [1.0 0.0 1.0])
                  (6 ("bar" 3) [0.0 1.0 1.0])
                  (7 "framed" "OrangeRed")))

  ;;; TURN OFF FAKE CURSORS:

  (setq mc-conf nil)

- To try out both the crosshairs feature and the visible fill column indicator
  feature, type:  M-x +-mode

- To try out just the visible fill column indicator feature, type:  M-x fc-mode

- To try out built-in fake cursors with Magnar Sveen's multiple-cursors package,
  that package must be installed.  If the multiple-cursors package is already
  installed, then just (require '+-mode) and `+-mode.el` will redefine a
  few of the multiple-cursors functions and set up a few keyboard shortcuts.
  If the multiple-cursors package by Magnar Sveen is not already installed, then
  here are two easy ways to install that package:

  Type:  M-x mc-install

  OR, evaluate the following snippet:

  (progn
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'multiple-cursors)
    (mc/built-in-cursors))


NOTES:

- Our journey begins at the outset of `update_window' when
  `mc_update_window_dryrun' performs a `!draw_p` simulation to create a new
  cache of fake cursors that are stored in the `w->mc_matrix`.  The cache of
  fake cursors from the previous redisplay is copied to a temporary `mc_matrix`
  under the name of `old_matrix`.  `mc_update_text_area' (used for `!draw_p` /
  `draw_p` situations) calls `mc_draw_glyphs' (writes glyphs to the glass)
  followed by `mc_draw_row' (writes fake cursors to the glass immediately
  thereafter).  At the tail end of `mc_update_window_dryrun',
  `mc_update_window_erase' compares the new `w->mc_matrix` with the `old_matrix`
  to determine which fake cursors are the same -- setting the `same_p` boolean
  struct member accordingly for each applicable fake cursor within the
  `w->mc_matrix`.  All fake cursors in the `old_matrix` that are `!same_p` get
  erased at this juncture.  [Fn 1.]  After the dryrun is complete,
  `update_window' does the real thing -- `draw_p`.  As to the `from_where`
  situations of SKIPPED, POST_CHANGED, UNCHANGED, and SET_CURSOR_TWO,
  `mc_helper' compares the incoming tentative fake cursor with the
  `w->mc_matrix` to see if it has previously been marked as `same_p` -- if it is
  `!same_p`, then the fake cursor is drawn and we `return`.  Fake cursors that
  have a `cursor_type` of MC_LEFT_FRINGE_BITMAP or MC_RIGHT_FRINGE_BITMAP are
  always reset even if they are `same_p`.  As to the `from_where` situations of
  SCRIBE_ONE, SCRIBE_TWO, SCRIBE_THREE, and NOWHERE, `mc_helper' always causes
  fake cursors to be drawn (because new glyphs were written to the glass, or the
  area to the right of the display line was cleared) and we `return`.

. Fn. 1:  Even though writing new glyphs to the glass (SCRIBE_ONE, SCRIBE_TWO,
  and SCRIBE_THREE) would erase fake cursors within those boundaries, it is
  still necessary to erase `!same_p` fake cursors prior thereto.  This is
  because `scrolling_window' occurs before new glyphs are written and
  `rif->scroll_run_hook' may copy one or more rows to other areas of the glass.
  It is not worth the effort to programmatically track both the _copied_ fake
  cursors and the _original_ fake cursors from the previous redisplay cycle,
  whose glyphs may remain where they are in the current redisplay cycle because
  they satisfy the `GLYPH_EQUAL_P' test.

- The rest of our journey takes place wherever `draw_glyphs' would ordinarily be
  called, excluding `update_text_area'.  If features 17684/22873 are active,
  `mc_redraw_row' calls `mc_draw_glyphs' (writes glyphs to the glass) and fake
  cursors are written to the glass immediately thereafter (if the coordinates
  coincide with prerecorded data in the `w->mc_matrix`).  The functions
  containing the aforementioned calls are:
  . `gui_insert_glyphs'
  . `gui_fix_overlapping_area'
  . `draw_row_with_mouse_face'
  . `expose_area'
  . `expose_line'
  . `redraw_overlapped_rows' [which has been incorporated into `update_window']

- As to `mc_scrolling_window', it would appear that there is no tangible
  benefit to rotating the current/prospective cache of fake cursors to compare
  the data before removing the fake cursors.  When scrolling the display, only
  _some_ lines are copied to new locations.  Areas that are not overwritten may
  have fake cursors and those may not necessarily be removed if desired/current
  matrix glyphs are equal.  The test for `GLYPH_EQUAL_P' does not take into
  consideration the existence of a fake cursor, and the glyph (with a fake
  cursor) may not be updated as a result thereof.  As to lines that are not
  copied, portions may be updated and fake cursors would be removed thereby.
  `mc_rotate_matrix' and `mc_reverse_vpos' were removed with patch v. 022.002.

- NS:  As of 09/28/2018 (7946445962372c4255180af45cb7c857f1b0b5fa), the NS port
  no longer does anything useful during `update_window' except mark dirty
  rectangles.  All drawing is now done when the MacOS calls `drawRect', which in
  turn calls `expose_frame'.  This was done to add support for MacOS Mojave ....


TODO:

- When an idle-timer fires and point is at the end of a horizontally scrolled
  line in a narrow window, the temporary horizontal scroll is canceled.  Create
  a minimal working example and file a bug report.

  (progn
    (defun test ()
    (interactive)
      (let ((ov (make-overlay (point) (1+ (point)) nil t t)))
        (overlay-put ov 'face '(:foreground "red"))))
    (global-set-key [f5] 'test)
    (split-window-horizontally)
    (switch-to-buffer (get-buffer-create "foo"))
    (setq bidi-display-reordering nil)
    (setq-local auto-hscroll-mode 'current-line)
    (dotimes (i 80)
      (insert (char-to-string (+ 65 i)))))

- `ns_draw_window_cursor' calls `ns_clip_to_rect', which does _not_ take
  `row->clip` into consideration when drawing cursors with `NSRectFill'.  When
  it comes time to draw glyphs on top of the box/hollow family of cursors,
  `row->clip` is taken into consideration by `get_glyph_string_clip'.  Fake
  cursors can be drawn even though the glyphs cannot, resulting in hollow/box
  family of cursors without text.  The issue can be reproduced with M-x mc-test.
  [A temporary workaround is to disable `row->clip` while drawing the glyphs.]
  https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00009.html

- Deal with left/right overwritten glyphs in the w32 and X ports of Emacs.

- The current test for `auto_hscroll_mode_p' only looks for `current_line` and
  all five related tests are based upon that assumption, which may not be true.

- Multiple Cursors:  If point is in the middle of a composite character, then
  select a fully composed character so that the fake cursor is visible.

- Implement functionality similar to the Lisp multiple-cursors by Magnar Sveen.

- Follow up with the Emacs team re bug#32177; i.e., (Current line number shifts
  one column to the left.)

- Follow up with the Emacs team re bug#32060; i.e., Horizontal Scrolling
  (Current Line):  Wrong line gets h-scrolled.

- Determine if bug #28936 needs to be fixed and help the Emacs team re same.

- Is there any additional meaningful optimization that can be added to the
  three calls of `mc_pre_scroll_clean'?

- There is a bug affecting an older version of Emacs for the NS port that causes
  partial line flickering when the same characters are grouped together (;;;;;;)
  and MC_GLYPHLESS cursors are above or below -- having the same background color
  as the frame; e.g., black on black (used to erase a glyphless cursor).  The
  partial flickering is only noticeable with rapid fire; e.g., holding down the
  right/left arrow key.  When changing the color of the glyphless cursor, the
  issue is not present.  [@lawlist has verified that the X and HPOS coordinates
  are accurate.]

[2020_05_02__13_04_51_850.diff (application/diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Thu, 01 Oct 2020 03:01:01 GMT) Full text and rfc822 format available.

Message #98 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: mbork <at> mbork.pl, 22873 <at> debbugs.gnu.org, johnw <at> gnu.org, akioburns <at> icloud.com,
 17684 <at> debbugs.gnu.org, eliz <at> gnu.org, drew.adams <at> oracle.com, rms <at> gnu.org
Subject: Re: bug#22873: #22873 (multiple fake cursors); and, #17684
 (crosshairs / fill-column).
Date: Thu, 01 Oct 2020 05:00:02 +0200
Keith David Bershatsky <esq <at> lawlist.com> writes:

> VERSION:  022.008 [05/02/2020]
>
> CHANGELOG:
>
> +(defgroup +-mode nil
> +  "Faces for the vertical ruler."
> +  :group 'convenience)

This is a huge patch set, and I have not tried it.  It seems like the
general consensus is that, yes, we would like to have multiple cursors,
but I'm not sure what this has to do with crosshairs?  I've just lightly
skimmed this thread, though...

Anyway, I'm not sure what the status is here.  The naming standard
doesn't seem to follow Emacs convention -- there's a mode called
`+-mode', for instance, which would have to be renamed...

Keith, is this still a work in progress, or is it something you think is
ready to go, and would like a code review on?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Thu, 01 Oct 2020 03:55:01 GMT) Full text and rfc822 format available.

Message #101 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: mbork <at> mbork.pl, 22873 <at> debbugs.gnu.org, johnw <at> gnu.org, akioburns <at> icloud.com,
 17684 <at> debbugs.gnu.org, eliz <at> gnu.org, drew.adams <at> oracle.com, rms <at> gnu.org
Subject: Re: bug#22873: #22873 (multiple fake cursors);
 and, #17684 (crosshairs / fill-column).
Date: Wed, 30 Sep 2020 20:54:14 -0700
Thank you, Lars, for having a look at feature requests 22873 and 17684.  The crosshairs feature to track the cursor position (17684) was the motivation for implementing the framework to create multiple fake cursors (22873); i.e., the crosshairs, and visible fill-column indicator that can intersect through characters at any pixel X coordinate are, are all drawn with fake cursors.  The draft proof concept works for GUI versions of Emacs on X11, Windows and OSX.  I haven't done anything much since 07/14/2019 except fix some bugs, some important, some minor.  Drew Adams contacted me several months ago and requested that I change `crosshairs.el` to anything else since he has a crosshairs library on wiki, and he didn't want any potential confusion.  There is nothing better I could think of as a name for the 17684 Lisp library and since crosshairs goes against the wishes of Drew, I just went ahead and changed the name to +-mode.el, because the plus sign looks like a crosshairs, and I use the plus sign as the mode-line minor-mode lighter.

22873 (multiple cursors) is presently just a framework to generate fake cursors anywhere on the window-body.  Nothing has been written yet to perform any type of user command/function action at each location of fake cursors.  I have been using 22873 to replace the visual overlays used by Magnar Sveen in his Lisp implementation of multiple-cursors; i.e., instead of visible overlays, Emacs generates a fake cursor at each location (which can change cursor colors and cursor shapes, if so desired, such as yellow for an even column and red for an odd column).

Emacs was set up by the forefathers with some window pointers to temporarily save values, such as the coordinates of the real cursor.  I felt this was somewhat confusing and it seemed to me like an "afterthought" (an after the fact implementation) to avoid the need to add new arguments to existing functions in order to pass the values needed.  Without modifying the existing system as to the real cursor, I did away with all that as it applies to fake cursors by creating additional arguments in the relevant new functions to pass the values where needed.

The matrix of multiple fake cursors is somewhat complex, at least for me, and was implemented with the generous help of Alex Gramiak on the Emacs Devel mailing list; including, but not limited to dynamic memory management for the caches of fake cursors.  This did away with all of the problems I had previously encountered with a slow-down due to constant garbage collection for having too many Lisp Objects.  Based upon the help provided by Alex G., features 17684/22873 are now really pretty darn fast in my opinion.

Eli Z. has been very kind and generous with his time over the years to help me through most of the hard issues that I encountered, and with his help, the Emacs Devel team even fixed a few bugs in the master along the way (which I helped discover while working on 17684/22873).

In the comments at the outset of the most recent post to 17684/22873, there is a "todo list" and also some notes regarding how these features work.

In order to reduce as much as possible any modifications to existing functions in the core of Emacs, I copied a lot of those functions functions, changed their names, added additional arguments as needed (supra), and modified some of the body as needed.

Others on the Emacs Devel team may undoubtedly have an entirely different viewpoint / approach regarding the implementation of multiple fake cursors, but it was something that I felt I could not live without, so I went ahead and created something that I have been using on a daily basis for the past couple of years (perhaps a little longer).  I also use Magnar's multiple-cursors library several times a day, and feature 22873 replaces his visible overlays with fake cursors.

I do not know what would be needed to bring 17684 / 22873 current from 07/14/2019 (master branch) to the present date.  The last time I brought 17684/22873 forward to the then current date of 07/14/2019, I encountered one or more bugs in the master branch and it took a few weeks to resolve -- which fix(es) would have been impossible without the help of Eli Z. and a few others in the Emacs Devel.  If, by chance, I encounter undiscovered bugs in the master branch that pose significant obstacles to moving forward to the current commit date, then it could take several weeks; it just depends ...  This stuff is pretty complex for me, and I would even have to study what I previously did to refresh my memory again regarding how everything works as it relates to 17684/22873.

Recently, things at my day job have picked back up again and I haven't had a whole lot of free time lately.

There are links to some screenshots of 17684/22873 and a few videos of those features running on the different OS platforms if anyone would like to take a look -- the links are in the most recent post to 17684/22873.

Thanks,

Keith

On Sep 30, 2020, at 8:00 PM, Lars Ingebrigtsen wrote:

> Keith David Bershatsky <esq <at> lawlist.com> writes:
> 
>> VERSION:  022.008 [05/02/2020]
>> 
>> CHANGELOG:
>> 
>> +(defgroup +-mode nil
>> +  "Faces for the vertical ruler."
>> +  :group 'convenience)
> 
> This is a huge patch set, and I have not tried it.  It seems like the
> general consensus is that, yes, we would like to have multiple cursors,
> but I'm not sure what this has to do with crosshairs?  I've just lightly
> skimmed this thread, though...
> 
> Anyway, I'm not sure what the status is here.  The naming standard
> doesn't seem to follow Emacs convention -- there's a mode called
> `+-mode', for instance, which would have to be renamed...
> 
> Keith, is this still a work in progress, or is it something you think is
> ready to go, and would like a code review on?
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Thu, 01 Oct 2020 16:22:02 GMT) Full text and rfc822 format available.

Message #104 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: mbork <at> mbork.pl, 22873 <at> debbugs.gnu.org, johnw <at> gnu.org, akioburns <at> icloud.com,
 17684 <at> debbugs.gnu.org, eliz <at> gnu.org, drew.adams <at> oracle.com, rms <at> gnu.org
Subject: Re: bug#22873: #22873 (multiple fake cursors); and, #17684
 (crosshairs / fill-column).
Date: Thu, 01 Oct 2020 18:21:14 +0200
Thanks for the explanation.  Some comments:

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

> Drew Adams contacted me several months ago and requested that I change
> `crosshairs.el` to anything else since he has a crosshairs library on
> wiki, and he didn't want any potential confusion.  There is nothing
> better I could think of as a name for the 17684 Lisp library and since
> crosshairs goes against the wishes of Drew, I just went ahead and
> changed the name to +-mode.el, because the plus sign looks like a
> crosshairs, and I use the plus sign as the mode-line minor-mode
> lighter.

Well, +-mode is not acceptable as an Emacs library name, unfortunately.
The concept is usually "cross hairs", so cross-hairs.el would be fine.

> 22873 (multiple cursors) is presently just a framework to generate
> fake cursors anywhere on the window-body.  Nothing has been written
> yet to perform any type of user command/function action at each
> location of fake cursors.

Ah, I see.

> In order to reduce as much as possible any modifications to existing
> functions in the core of Emacs, I copied a lot of those functions
> functions, changed their names, added additional arguments as needed
> (supra), and modified some of the body as needed.

If this is to be included in Emacs, that duplication has to be resolved,
though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17684; Package emacs. (Thu, 01 Oct 2020 17:02:02 GMT) Full text and rfc822 format available.

Message #107 received at 17684 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Keith David Bershatsky
 <esq <at> lawlist.com>
Cc: mbork <at> mbork.pl, 22873 <at> debbugs.gnu.org, johnw <at> gnu.org, akioburns <at> icloud.com,
 17684 <at> debbugs.gnu.org, eliz <at> gnu.org, rms <at> gnu.org
Subject: RE: bug#22873: #22873 (multiple fake cursors); and, #17684
 (crosshairs / fill-column).
Date: Thu, 1 Oct 2020 10:00:53 -0700 (PDT)
> > Drew Adams contacted me several months ago and requested that I change
> > `crosshairs.el` to anything else since he has a crosshairs library on
> > wiki, and he didn't want any potential confusion.  There is nothing
> > better I could think of as a name for the 17684 Lisp library and since
> > crosshairs goes against the wishes of Drew, I just went ahead and
> > changed the name to +-mode.el, because the plus sign looks like a
> > crosshairs, and I use the plus sign as the mode-line minor-mode
> > lighter.
> 
> Well, +-mode is not acceptable as an Emacs library name, unfortunately.
> The concept is usually "cross hairs", so cross-hairs.el would be fine.

I object to cross-hairs.el, as well.  Just as confusing
as using the same name, crosshairs.el.  (Sometimes less
confusing, sometimes more confusing - it introduces
another way to confuse the two).

And "the concept is usually 'cross hairs'" is wrong.
What concept?  Application of the term "cross hairs" to
this context is something I did, but the indication of
row and column by two orthogonal lines through the cell
is not typically called "cross hairs".

X and Y axes in analytic geometry aren't called "cross
hairs".

I take it as a compliment that "cross hairs" fits this
Emacs use case, but using that term for this doesn't
spring to mind spontaneously, I think.

I have no objection to referring to the feature/behavior
as showing cross hairs.  My objection is only about the
library name.  If you want to stay with the notion of
cross hairs, yaybe use a synonym for the library name,
such as "reticule".  Or maybe use an abbreviation -
crshairs.el or some such.

The aim should be to find a name that won't cause users
to confuse the two libraries.  That's all.




This bug report was last modified 4 years and 254 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.