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

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

[nongnu] elpa/multiple-cursors 224f919 008/434: Explicitly depend on mar


From: ELPA Syncer
Subject: [nongnu] elpa/multiple-cursors 224f919 008/434: Explicitly depend on mark-multiple.
Date: Sat, 7 Aug 2021 09:19:44 -0400 (EDT)

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

    Explicitly depend on mark-multiple.
---
 README.md           |  8 ++++++++
 multiple-cursors.el | 17 +++++++++++------
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index 5fcd122..44d8534 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,10 @@ An experiment in multiple cursors for emacs. Still very much 
in beta.
 
 The basic concept works, but there are definitely some kinks to work out.
 
+This extension is dependent on the mark-multiple library.
+
+    https://github.com/magnars/mark-multiple.el
+
 ## Usage
 
 I've set up my key-bindings like so:
@@ -15,6 +19,10 @@ I've set up my key-bindings like so:
 
 To get out of multiple-cursors-mode, press `C-g`.
 
+You can also switch to multiple-cursors-mode by pressing C-g when in
+mark-multiple-mode. This is symmetrical to how pressing C-g with an active
+region deactivates it. Press C-g again to remove extra cursors.
+
 ## Contribute
 
 There's plenty wrong with this implementation still. I'm actively trying things
diff --git a/multiple-cursors.el b/multiple-cursors.el
index 2329afa..1a619de 100644
--- a/multiple-cursors.el
+++ b/multiple-cursors.el
@@ -24,6 +24,9 @@
 ;;
 ;; The basic concept works, but there are definitely some kinks to work out.
 
+;; This extension is dependent on the mark-multiple library.
+;;     https://github.com/magnars/mark-multiple.el
+
 ;; ** Usage
 
 ;; I've set up my key-bindings like so:
@@ -51,6 +54,8 @@
 
 ;;; Code:
 
+(require 'mark-multiple)
+
 (defface mc/cursor-face
   '((t (:inverse-video t)))
   "The face used for additional cursors"
@@ -120,7 +125,7 @@ from being executed if in multiple-cursors-mode."
                  move-end-of-line-or-next-line
                  move-start-of-line-or-prev-line))
 
-(defun mc/execute-command-for-all-cursors (cmd)
+(defun mc/execute-command-for-all-fake-cursors (cmd)
   "Calls CMD interactively for each cursor.
 It works by moving point to the fake cursor, setting
 up the proper kill-ring, and then removing the cursor.
@@ -152,7 +157,7 @@ cursors."
       (message "%S is not supported with multiple cursors" 
this-original-command)
     (if (not (memq this-original-command mc--cmds))
         (message "Skipping %S" this-original-command)
-      (mc/execute-command-for-all-cursors this-original-command))))
+      (mc/execute-command-for-all-fake-cursors this-original-command))))
 
 (defun mc/remove-additional-cursors ()
   "Remove all fake cursors.
@@ -206,17 +211,17 @@ mark-multiple if point and mark is on different columns."
   "Add one cursor to the end of each line in the active region."
   (interactive)
   (mc/add-multiple-cursors-to-region-lines)
-  (mc/execute-command-for-all-cursors 'end-of-line)
+  (mc/execute-command-for-all-fake-cursors 'end-of-line)
   (end-of-line))
 
 (defun mc/edit-beginnings-of-lines ()
   "Add one cursor to the beginning of each line in the active region."
   (interactive)
   (mc/add-multiple-cursors-to-region-lines)
-  (mc/execute-command-for-all-cursors 'beginning-of-line)
+  (mc/execute-command-for-all-fake-cursors 'beginning-of-line)
   (beginning-of-line))
 
-(defun mc/switch-to-cursors-from-mark-multiple ()
+(defun mc/switch-from-mark-multiple-to-cursors ()
   "Removes mark-multiple and switches to multiple cursors instead"
   (interactive)
   (let ((offset (- (point) (overlay-start mm/master))))
@@ -228,7 +233,7 @@ mark-multiple if point and mark is on different columns."
     (deactivate-mark)
     (multiple-cursors-mode)))
 
-(define-key mm/keymap (kbd "C-g") 'mc/switch-to-cursors-from-mark-multiple)
+(define-key mm/keymap (kbd "C-g") 'mc/switch-from-mark-multiple-to-cursors)
 
 (provide 'multiple-cursors)
 



reply via email to

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