[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22873: 25.1.50; Feature Request -- Multiple Cursors (built-in suppor
From: |
Keith David Bershatsky |
Subject: |
bug#22873: 25.1.50; Feature Request -- Multiple Cursors (built-in support) |
Date: |
Tue, 01 Mar 2016 10:44:58 -0800 |
As a feature request, it would be appreciated if the Emacs development team
could please consider adding built-in support for multiple cursors similar to
the Lisp library that Magnar Sveen has written: https://github.com/magnars
[Out of the box, Emacs does not presently support a left vertical bar fake
cursor overlay.]
The multiple cursors API should please be made available to the user so that
fake cursors of any style can be drawn anywhere on the visible window.
[Available styles include those defined in the variable `cursor-type'.]
The API available to the user should support standard points for positions,
instead of x/y/vpos/hpos. In other words, the API should make it easy for the
user to specifying a list of points -- e.g., '(5 6 7 8 9 10). In that
scenario, fake cursors would be drawn at positions 5, 6, 7, 8, 9 and 10.
Perhaps a cons cell with the `cursor-type' for each specified point would be
appropriate -- that way a user would not be limited to the buffer-local or
default cursor style for all fake cursors.
This feature request has the added benefit that the user can create a vertical
line the entire length of the screen by using multiple fake bar cursors in
addition to a stretch space glyph and an XPM image that is thin (e.g., one
pixel wide) with a pixel height equal to the line height at any location where
no character exists -- e.g., overlays using the 'after-string property. An
example would be the fill-column-indicator library written by Alp Aker:
https://github.com/alpaker/Fill-Column-Indicator In the context of the
fill-column-indicator example, a user can draw a vertical line that extends
through the left side of each character to form a solid line the entire length
of the window from top to bottom.
In my own personal setup, I would be drawing a solid vertical line that tracks
the cursor position -- the line would run through the left side of any
character along that resides on vertical column.
The following draft proof concept patch contains a variety of things including
a sample of this particular feature request for multiple cursors. The example
has been tested on Emacs master branch for OSX and Windows operating systems.
On OSX the fake cursors draw immediately, but on Windows it is necessary to
press any key after calling `multiple-cursors-test' for the fake cursors to
appear. The fake cursors are designed to disappear during the next command
loop. The internal function `move_it_to' provides for a conveniently quick
method to convert PT to the necessary x/y/vpos/hpos.
NOTE: `posn-at-point` is painfully slow to obtain x/y/vpos/hpos -- so we
certainly want to avoid using that function when converting the list of PT for
fake cursors each command loop.
The following test function called `multiple-cursors-test` works with the proof
concept draft patch attached below, which admittedly needs a lot more work. I
tested using the bar `cursor-type'.
(defun multiple-cursors-test (&optional list)
"Draw fake cursors at all POS defined in the `multiple-cursor-list'.
The list contains integers representing the various positions.
The default list is for positions 5, 6, 7, 8, 9 and 10."
(interactive)
(setq cursor-type 'bar)
(setq multiple-cursors-list (if list list (list 5 6 7 8 9 10))))
(global-set-key [f1] 'multiple-cursors-test)
multiple_cursors.diff
Description: application/diff
- bug#22873: 25.1.50; Feature Request -- Multiple Cursors (built-in support),
Keith David Bershatsky <=
bug#22873: Can we support multiple Cursors?, Keith David Bershatsky, 2016/03/04
bug#22873: Can we support multiple Cursors?, Keith David Bershatsky, 2016/03/09
bug#22873: Can we support multiple Cursors?, Keith David Bershatsky, 2016/03/09