[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors a682c15 027/434: Disable regions first wi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors a682c15 027/434: Disable regions first with C-g, then multiple-cursors. |
Date: |
Sat, 7 Aug 2021 09:19:48 -0400 (EDT) |
branch: elpa/multiple-cursors
commit a682c154a184c9504c287640b78c46306a71010b
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Disable regions first with C-g, then multiple-cursors.
---
multiple-cursors.el | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/multiple-cursors.el b/multiple-cursors.el
index d3aafc4..7148f6b 100644
--- a/multiple-cursors.el
+++ b/multiple-cursors.el
@@ -183,6 +183,12 @@ you should disable multiple-cursors-mode."
(delete-overlay o)))
(overlays-in (point-min) (point-max))))
+(defun mc/keyboard-quit ()
+ (interactive)
+ (if (not (use-region-p))
+ (multiple-cursors-mode 0)
+ (deactivate-mark)))
+
(defvar mc/keymap nil
"Keymap while multiple cursors are active.
Main goal of the keymap is to rebind C-g and <return> to conclude
@@ -190,7 +196,7 @@ multiple cursors editing.")
(if mc/keymap
nil
(setq mc/keymap (make-sparse-keymap))
- (define-key mc/keymap (kbd "C-g") 'multiple-cursors-mode)
+ (define-key mc/keymap (kbd "C-g") 'mc/keyboard-quit)
(define-key mc/keymap (kbd "<return>") 'multiple-cursors-mode))
(define-minor-mode multiple-cursors-mode
@@ -217,10 +223,10 @@ mark-multiple if point and mark is on different columns."
(num-cursors (abs (- point-line mark-line)))
(navigation-func (if (< point-line mark-line) 'previous-line
'next-line)))
(exchange-point-and-mark)
+ (deactivate-mark)
(while (not (eq (line-number-at-pos) point-line))
(mc/add-cursor-at-point)
(funcall navigation-func))
- (deactivate-mark)
(multiple-cursors-mode)))
(defun mc/edit-ends-of-lines ()
@@ -269,7 +275,8 @@ from being executed if in multiple-cursors-mode."
(unsupported-cmd yank-pop)
;; Commands that should be mirrored by all cursors
-(setq mc--cmds '(self-insert-command
+(setq mc--cmds '(mc/keyboard-quit
+ self-insert-command
js2-insert-and-indent
wrap-region-trigger
sgml-slash
- [nongnu] branch elpa/multiple-cursors created (now 616fbdd), ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 224f919 008/434: Explicitly depend on mark-multiple., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e44f45f 019/434: More white-listing in multiple-cursors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors b28e8f9 023/434: Update test to fix missing step definition., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a682c15 027/434: Disable regions first with C-g, then multiple-cursors.,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors 13668a9 001/434: initial commit, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors c18aa84 002/434: Separate kill-ring for each cursor., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0d40ea1 003/434: Updated readme., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 18f7f1a 010/434: More white-listed commands for multiple cursors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors cf82088 014/434: Add backward-list to white-list., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 26d0e52 015/434: Add more commands to white-list., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 5e64246 025/434: Move todo to own file., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e0ffd9c 026/434: Disable marker when done with it, for performance reasons., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 9938aca 028/434: Save er/history for each cursor, to be able to contract., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors dfe8a2d 029/434: Slight optimisation, ELPA Syncer, 2021/08/07