diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el index 12f3f48..c24a9f5 100644 --- a/multiple-cursors-core.el +++ b/multiple-cursors-core.el @@ -274,31 +274,37 @@ it will prompt for the proper action and then save that preference. Some commands are so unsupported that they are even prevented for the original cursor, to inform about the lack of support." - (if (eq 1 (mc/num-cursors)) ;; no fake cursors? disable mc-mode - (multiple-cursors-mode 0) + (unless mc--executing-command-for-fake-cursor - (when this-original-command - (let ((original-command (or mc--this-command - (command-remapping this-original-command) - this-original-command))) + (if (eq 1 (mc/num-cursors)) ;; no fake cursors? disable mc-mode + (multiple-cursors-mode 0) - ;; 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) + (when this-original-command + (let ((original-command (or mc--this-command + (command-remapping this-original-command) + this-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)) - (when (and original-command - (not (memq original-command mc--default-cmds-to-run-once)) - (not (memq original-command mc/cmds-to-run-once)) - (or (memq original-command mc--default-cmds-to-run-for-all) - (memq original-command mc/cmds-to-run-for-all) - (mc/prompt-for-inclusion-in-whitelist original-command))) - (mc/execute-command-for-all-fake-cursors original-command)))))))) + ;; skip keyboard macros, since they will generate actual commands that are + ;; also run in the command loop - we'll handle those later instead. + (when (functionp 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)) + (when (and original-command + (not (memq original-command mc--default-cmds-to-run-once)) + (not (memq original-command mc/cmds-to-run-once)) + (or (memq original-command mc--default-cmds-to-run-for-all) + (memq original-command mc/cmds-to-run-for-all) + (mc/prompt-for-inclusion-in-whitelist original-command))) + (mc/execute-command-for-all-fake-cursors original-command)))))))))) (defun mc/remove-fake-cursors () "Remove all fake cursors.