emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/multiple-cursors 80fdb6f 007/434: Hook multiple-cursors in


From: ELPA Syncer
Subject: [nongnu] elpa/multiple-cursors 80fdb6f 007/434: Hook multiple-cursors into mark-multiple, first step:
Date: Sat, 7 Aug 2021 09:19:44 -0400 (EDT)

branch: elpa/multiple-cursors
commit 80fdb6f68de4cd3ee62eabde2c1f3f690fd47f58
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>

    Hook multiple-cursors into mark-multiple, first step:
     - C-g in mark-multiple takes you to multiple-cursors
       Note: C-g again to remove extra cursors
---
 multiple-cursors.el | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/multiple-cursors.el b/multiple-cursors.el
index dcf8d28..2329afa 100644
--- a/multiple-cursors.el
+++ b/multiple-cursors.el
@@ -97,7 +97,7 @@ from being executed if in multiple-cursors-mode."
        (unless multiple-cursors-mode
          ad-do-it))))
 
-;; Commands that makes a giant mess of multiple cursors
+;; Commands that make a giant mess of multiple cursors
 (unsupported-cmd yank-pop)
 
 ;; Commands that should be mirrored by all cursors
@@ -114,8 +114,8 @@ from being executed if in multiple-cursors-mode."
                  kill-region-or-backward-word
                  backward-kill-word
                  backward-delete-char-untabify
-                 delete-char
-                 delete-backward-char
+                 delete-char c-electric-delete-forward
+                 delete-backward-char c-electric-backspace
                  zap-to-char
                  move-end-of-line-or-next-line
                  move-start-of-line-or-prev-line))
@@ -216,6 +216,20 @@ mark-multiple if point and mark is on different columns."
   (mc/execute-command-for-all-cursors 'beginning-of-line)
   (beginning-of-line))
 
+(defun mc/switch-to-cursors-from-mark-multiple ()
+  "Removes mark-multiple and switches to multiple cursors instead"
+  (interactive)
+  (let ((offset (- (point) (overlay-start mm/master))))
+    (save-excursion
+      (dolist (mirror mm/mirrors)
+        (goto-char (+ offset (overlay-start mirror)))
+        (mc/add-cursor-at-point)))
+    (mm/clear-all)
+    (deactivate-mark)
+    (multiple-cursors-mode)))
+
+(define-key mm/keymap (kbd "C-g") 'mc/switch-to-cursors-from-mark-multiple)
+
 (provide 'multiple-cursors)
 
 ;;; multiple-cursors.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]