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

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

[nongnu] elpa/multiple-cursors de0519e 057/434: Add support for running


From: ELPA Syncer
Subject: [nongnu] elpa/multiple-cursors de0519e 057/434: Add support for running lambdas for each cursor.
Date: Sat, 7 Aug 2021 09:19:54 -0400 (EDT)

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

    Add support for running lambdas for each cursor.
    
     - can't know if it's safe, so we assume it is.
---
 multiple-cursors-core.el | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index 1e675e9..910dfdc 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -132,14 +132,21 @@ is executed normally for point, but skipped for the fake
 cursors."
   (let ((original-command (or (command-remapping this-original-command)
                               this-original-command)))
-    (if (get original-command 'mc--unsupported)
-        (message "%S is not supported with multiple cursors%s"
-                 original-command
-                 (get original-command 'mc--unsupported))
-      (if (not (memq original-command mc--cmds))
-          (when (not (memq original-command mc--cmds-run-once))
-            (message "Skipping %S" original-command))
-        (mc/execute-command-for-all-fake-cursors original-command)))))
+
+    ;; if it's a lambda, we can't know if it's supported or not
+    ;; - so go ahead and assume it's ok, because we're just optimistic like 
that
+    (if (not (symbolp original-command))
+        (mc/execute-command-for-all-fake-cursors original-command)
+
+      ;; otherwise it's a symbol, and we can be more thorough
+      (if (get original-command 'mc--unsupported)
+          (message "%S is not supported with multiple cursors%s"
+                   original-command
+                   (get original-command 'mc--unsupported))
+        (if (not (memq original-command mc--cmds))
+            (when (not (memq original-command mc--cmds-run-once))
+              (message "Skipping %S" original-command))
+          (mc/execute-command-for-all-fake-cursors original-command))))))
 
 (defun mc/remove-fake-cursors ()
   "Remove all fake cursors.



reply via email to

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