[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors 2d6ffce 330/434: Support unmarking with n
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors 2d6ffce 330/434: Support unmarking with no region. Change mc/mark-lines to preserve point. |
Date: |
Sat, 7 Aug 2021 09:20:53 -0400 (EDT) |
branch: elpa/multiple-cursors
commit 2d6ffce4c94cdbec1ea8ec086ea346423bafcdf1
Author: Justin Dove <dove@mit.edu>
Commit: Justin Dove <dove@mit.edu>
Support unmarking with no region. Change mc/mark-lines to preserve point.
---
mc-mark-more.el | 48 ++++++++++++++++++++++++++----------------------
1 file changed, 26 insertions(+), 22 deletions(-)
diff --git a/mc-mark-more.el b/mc-mark-more.el
index 45a87fc..eed0035 100644
--- a/mc-mark-more.el
+++ b/mc-mark-more.el
@@ -127,14 +127,14 @@ Use like case-fold-search, don't recommend setting it
globally.")
With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next."
(interactive "p")
- (if (region-active-p)
- (if (< arg 0)
- (let ((cursor (mc/furthest-cursor-after-point)))
- (if cursor
- (mc/remove-fake-cursor cursor)
- (error "No cursors to be unmarked")))
- (mc/mark-more-like-this (= arg 0) 'forwards))
- (mc/mark-lines arg 'forwards))
+ (if (< arg 0)
+ (let ((cursor (mc/furthest-cursor-after-point)))
+ (if cursor
+ (mc/remove-fake-cursor cursor)
+ (error "No cursors to be unmarked")))
+ (if (region-active-p)
+ (mc/mark-more-like-this (= arg 0) 'forwards)
+ (mc/mark-lines arg 'forwards)))
(mc/maybe-multiple-cursors-mode))
;;;###autoload
@@ -155,14 +155,14 @@ With zero ARG, skip the last one and mark next."
With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next."
(interactive "p")
- (if (region-active-p)
- (if (< arg 0)
- (let ((cursor (mc/furthest-cursor-before-point)))
- (if cursor
- (mc/remove-fake-cursor cursor)
- (error "No cursors to be unmarked")))
- (mc/mark-more-like-this (= arg 0) 'backwards))
- (mc/mark-lines arg 'backwards))
+ (if (< arg 0)
+ (let ((cursor (mc/furthest-cursor-before-point)))
+ (if cursor
+ (mc/remove-fake-cursor cursor)
+ (error "No cursors to be unmarked")))
+ (if (region-active-p)
+ (mc/mark-more-like-this (= arg 0) 'backwards)
+ (mc/mark-lines arg 'backwards)))
(mc/maybe-multiple-cursors-mode))
;;;###autoload
@@ -179,12 +179,16 @@ With zero ARG, skip the last one and mark next."
(defun mc/mark-lines (num-lines direction)
(dotimes (i num-lines)
- (mc/create-fake-cursor-at-point)
- (ecase direction
- (forwards (loop do (next-logical-line 1 nil)
- while (mc/all-fake-cursors (point) (1+ (point)))))
- (backwards (loop do (previous-logical-line 1 nil)
- while (mc/all-fake-cursors (point) (1+ (point))))))))
+ (mc/save-excursion
+ (let ((furthest-cursor (ecase direction
+ (forwards (mc/furthest-cursor-after-point))
+ (backwards (mc/furthest-cursor-before-point)))))
+ (if (overlayp furthest-cursor)
+ (goto-char (overlay-get furthest-cursor 'point))))
+ (ecase direction
+ (forwards (next-logical-line 1 nil))
+ (backwards (previous-logical-line 1 nil)))
+ (mc/create-fake-cursor-at-point))))
;;;###autoload
(defun mc/mark-next-lines (arg)
- [nongnu] elpa/multiple-cursors a37e02b 177/434: Add new mc-commands to default run-once list., (continued)
- [nongnu] elpa/multiple-cursors a37e02b 177/434: Add new mc-commands to default run-once list., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6339657 192/434: Fix byte-compilation warnings, and avoid unnecessary use of "eval", ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 641eb68 212/434: Can use mc/reverse-regions w/o region or cursors, ELPA Syncer, 2021/08/07
- [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 <=
- [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, 2021/08/07
- [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