mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-12-04 12:45:42 +00:00
Use symbol properties on commands instead of maintaining a list of unsupported commands.
This commit is contained in:
parent
6f9911fa98
commit
fca06858e9
@ -132,10 +132,10 @@ is executed normally for point, but skipped for the fake
|
|||||||
cursors."
|
cursors."
|
||||||
(let ((original-command (or (command-remapping this-original-command)
|
(let ((original-command (or (command-remapping this-original-command)
|
||||||
this-original-command)))
|
this-original-command)))
|
||||||
(if (memq original-command mc--unsupported-cmds)
|
(if (get original-command 'mc--unsupported)
|
||||||
(message "%S is not supported with multiple cursors%s"
|
(message "%S is not supported with multiple cursors%s"
|
||||||
original-command
|
original-command
|
||||||
(get original-command 'mc--unsupported-msg))
|
(get original-command 'mc--unsupported))
|
||||||
(if (not (memq original-command mc--cmds))
|
(if (not (memq original-command mc--cmds))
|
||||||
(when (not (memq original-command mc--cmds-run-once))
|
(when (not (memq original-command mc--cmds-run-once))
|
||||||
(message "Skipping %S" original-command))
|
(message "Skipping %S" original-command))
|
||||||
@ -173,16 +173,11 @@ multiple cursors editing.")
|
|||||||
(remove-hook 'post-command-hook 'mc/execute-this-command-for-all-cursors t)
|
(remove-hook 'post-command-hook 'mc/execute-this-command-for-all-cursors t)
|
||||||
(mc/remove-fake-cursors)))
|
(mc/remove-fake-cursors)))
|
||||||
|
|
||||||
(defvar mc--unsupported-cmds '()
|
|
||||||
"List of commands that does not work well with multiple cursors.
|
|
||||||
Set up with the unsupported-cmd macro.")
|
|
||||||
|
|
||||||
(defmacro unsupported-cmd (cmd msg)
|
(defmacro unsupported-cmd (cmd msg)
|
||||||
"Adds command to list of unsupported commands and prevents it
|
"Adds command to list of unsupported commands and prevents it
|
||||||
from being executed if in multiple-cursors-mode."
|
from being executed if in multiple-cursors-mode."
|
||||||
`(progn
|
`(progn
|
||||||
(push (quote ,cmd) mc--unsupported-cmds)
|
(put (quote ,cmd) 'mc--unsupported ,msg)
|
||||||
(put (quote ,cmd) 'mc--unsupported-msg ,msg)
|
|
||||||
(defadvice ,cmd (around unsupported-advice activate)
|
(defadvice ,cmd (around unsupported-advice activate)
|
||||||
"command isn't supported with multiple cursors"
|
"command isn't supported with multiple cursors"
|
||||||
(unless (and multiple-cursors-mode (called-interactively-p 'any))
|
(unless (and multiple-cursors-mode (called-interactively-p 'any))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user