[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors 3f1611c 345/434: Factor out a superfluous
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors 3f1611c 345/434: Factor out a superfluous variable |
Date: |
Sat, 7 Aug 2021 09:20:56 -0400 (EDT) |
branch: elpa/multiple-cursors
commit 3f1611c7cbd4daa52f15cb3a5f3bbcc11d4eb949
Author: Sean Allred <code@seanallred.com>
Commit: Sean Allred <code@seanallred.com>
Factor out a superfluous variable
`mc--active-cursor-count' was effectively duplicating the purpose of
`mc/num-cursors'. While the latter is necessarily slower (being a
function), it is well-tested and stable.
---
multiple-cursors-core.el | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index cba6da6..6602703 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -157,8 +157,7 @@ highlights the entire width of the window."
(set-marker (overlay-get o 'point) nil)
(set-marker (overlay-get o 'mark) nil)
(mc/delete-region-overlay o)
- (delete-overlay o)
- (decf mc--active-cursor-count))
+ (delete-overlay o))
(defun mc/pop-state-from-overlay (o)
"Restore the state stored in given overlay and then remove the overlay."
@@ -177,11 +176,6 @@ highlights the entire width of the window."
"Returns a unique cursor id"
(incf mc--current-cursor-id))
-(defvar mc--active-cursor-count 1
- "Number of active cursors.
-This number is incremented by `mc/create-fake-cursor-at-point'
-and decremented by `mc/remove-fake-cursor'.")
-
(defvar mc--max-cursors-original nil
"This variable maintains the original maximum number of cursors.
When `mc/create-fake-cursor-at-point' is called and
@@ -208,12 +202,11 @@ Saves the current state in the overlay to be restored
later."
(unless mc--max-cursors-original
(setq mc--max-cursors-original mc/max-cursors))
(when mc/max-cursors
- (unless (< mc--active-cursor-count mc/max-cursors)
- (if (yes-or-no-p (format "%d active cursors. Continue? "
mc--active-cursor-count))
+ (unless (< (mc/num-cursors) mc/max-cursors)
+ (if (yes-or-no-p (format "%d active cursors. Continue? "
(mc/num-cursors)))
(setq mc/max-cursors (read-number "Enter a new, temporary maximum:
"))
(mc/remove-fake-cursors)
(error "Aborted: too many cursors"))))
- (incf mc--active-cursor-count)
(let ((overlay (mc/make-cursor-overlay-at-point)))
(overlay-put overlay 'mc-id (or id (mc/create-cursor-id)))
(overlay-put overlay 'type 'fake-cursor)
- [nongnu] elpa/multiple-cursors 4748386 238/434: Make mc/mark-pop only run once per invocation, (continued)
- [nongnu] elpa/multiple-cursors 4748386 238/434: Make mc/mark-pop only run once per invocation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors be7905d 258/434: Update README to note that there is a mode allowing search in multiple-cursors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a86daa7 270/434: Guard with 'if' rather than defun*/return-from, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 18d858f 272/434: Fall straight through in 'mc/mark-all-dwim' if multiple cursors are already active, as that means we can't sensibly edit lines or mark all in region, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 2b536cb 283/434: Added mc/edit-lines-empty-lines, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 75ece68 288/434: Merge pull request #118 from aspiers/fix-compile-warnings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 9f4502b 304/434: Change file load timing, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e94567c 303/434: Add installation instructions, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 98f2346 305/434: Merge pull request #152 from ShingoFukuyama/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 653d523 308/434: Added mc-hide-unmatched-lines mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 3f1611c 345/434: Factor out a superfluous variable,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors 68961b4 355/434: Avoid requiring cl at runtime, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 4c52fb1 358/434: Merge pull request #239 from ilohmar/dwim-mouse-select, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e31b1eb 360/434: Merge pull request #240 from ilohmar/toggle-click-improvements, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6a62e60 367/434: Fix issue #131 (#247), ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 2329611 380/434: Merge remote-tracking branch 'upstream/master', ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 60b9ef8 385/434: Updated readme according to `mc/always-run-for-all, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ad95d28 386/434: Update docstring of `mc/cursor-is-bar`, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 21e4825 387/434: mc/mark-previous-like-this-word/symbol., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 95f2e41 391/434: Add @AndreaOrru to list of contributors, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e14fdb7 401/434: Merge pull request #298 from Quasilyte/update_readme, ELPA Syncer, 2021/08/07