[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors e17851e 359/434: Fix click-toggling and m
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors e17851e 359/434: Fix click-toggling and make it robust (address all PR #239 comments) |
Date: |
Sat, 7 Aug 2021 09:20:59 -0400 (EDT) |
branch: elpa/multiple-cursors
commit e17851efd3d9fc1117e3910d61372006cc173ab7
Author: Ingo Lohmar <i.lohmar@gmail.com>
Commit: Ingo Lohmar <i.lohmar@gmail.com>
Fix click-toggling and make it robust (address all PR #239 comments)
- use marker-position for cursor overlay's point
- new helper function finds fake cursor with its actual *point* where we
want it
- this also eliminates any need for additional require statements
---
mc-mark-more.el | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/mc-mark-more.el b/mc-mark-more.el
index f63887d..02a67f4 100644
--- a/mc-mark-more.el
+++ b/mc-mark-more.el
@@ -72,6 +72,18 @@
(setq furthest cursor)))
furthest))
+(defun mc/fake-cursor-at-point (&optional point)
+ "Return the fake cursor with its point right at POINT (defaults
+to (point)), or nil."
+ (setq point (or point (point)))
+ (let ((cursors (mc/all-fake-cursors))
+ (c nil))
+ (catch 'found
+ (while (setq c (pop cursors))
+ (when (eq (marker-position (overlay-get c 'point))
+ point)
+ (throw 'found c))))))
+
(defun mc/region-strings ()
(let ((strings (list (buffer-substring-no-properties (point) (mark)))))
(mc/for-each-fake-cursor
@@ -587,14 +599,15 @@ already there."
(if (not (windowp (posn-window position)))
(error "Position not in text area of window"))
(select-window (posn-window position))
- (if (numberp (posn-point position))
- (save-excursion
- (goto-char (posn-point position))
- (let ((existing (mc/last-fake-cursor-before (point))))
- (if (and existing
- (eq (overlay-get existing 'point) (point)))
+ (let ((pt (posn-point position)))
+ (if (numberp pt)
+ ;; is there a fake cursor with the actual *point* right where we are?
+ (let ((existing (mc/fake-cursor-at-point pt)))
+ (if existing
(mc/remove-fake-cursor existing)
- (mc/create-fake-cursor-at-point)))))
+ (save-excursion
+ (goto-char pt)
+ (mc/create-fake-cursor-at-point))))))
(mc/maybe-multiple-cursors-mode)))
;;;###autoload
- [nongnu] elpa/multiple-cursors 0ee76bf 214/434: Add mc/add-cursor-on-click, (continued)
- [nongnu] elpa/multiple-cursors 0ee76bf 214/434: Add mc/add-cursor-on-click, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 16589a5 224/434: Update README.md, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 5c60757 216/434: export ECUKES_EMACS in run-travis-ci.sh, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6467fe2 277/434: Add mc/mark-all-dwim to autoloads, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors c69be0e 282/434: Travis CI: Update location of cask install, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 4da58ea 302/434: Merge pull request #146 from bling/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors f0dcd06 323/434: Merge pull request #175 from lexa/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 2d6ffce 330/434: Support unmarking with no region. Change mc/mark-lines to preserve point., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 36b7025 348/434: Add alternative to mc/mark-next-like-this, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a393384 353/434: Merge pull request #227 from jtamagnan/insert_letters, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e17851e 359/434: Fix click-toggling and make it robust (address all PR #239 comments),
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors 8ac4ad3 361/434: Update README.md, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 9f4cdd0 368/434: Modified mc/mark-lines to allow skipping, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors fb0e71a 371/434: Remove mention of marmalade, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors be4fbc7 373/434: Mention MELPA Stable, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors dfaf621 392/434: Fix #254; remove mc/mark-next-like-this-extended, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 67d6579 388/434: Updated tests, README., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 277aef4 393/434: Make mc/list-file into defcustom, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6327681 394/434: Merge pull request #267 from Fuco1/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors f6bac94 402/434: Add note about M-x, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 3f382d2 416/434: Move variables before first use, ELPA Syncer, 2021/08/07