mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 13:03:03 +00:00
Refactored setup of unsupported commands.
This commit is contained in:
parent
4c91260e71
commit
9a5c9cd79b
@ -77,6 +77,18 @@
|
||||
(overlay-put overlay 'kill-ring kill-ring)
|
||||
(overlay-put overlay 'priority 100)))
|
||||
|
||||
(setq mc--unsupported-cmds '())
|
||||
|
||||
(defmacro unsupported-cmd (cmd)
|
||||
`(progn
|
||||
(push (quote ,cmd) mc--unsupported-cmds)
|
||||
(defadvice ,cmd (around unsupported-advice activate)
|
||||
"command isn't supported with multiple cursors"
|
||||
(unless multiple-cursors-mode
|
||||
ad-do-it))))
|
||||
|
||||
(unsupported-cmd yank-pop)
|
||||
|
||||
(setq mc--cmds '(self-insert-command
|
||||
previous-line
|
||||
next-line
|
||||
@ -92,17 +104,10 @@
|
||||
backward-delete-char-untabify
|
||||
delete-char
|
||||
delete-backward-char
|
||||
zap-to-char
|
||||
move-end-of-line-or-next-line
|
||||
move-start-of-line-or-prev-line))
|
||||
|
||||
(setq mc--unsupported-cmds '(yank-pop))
|
||||
|
||||
;; todo: macro-ify and iterate over mc--unsupported-cmds
|
||||
(defadvice yank-pop (around yank-pop-unsupported-advice activate)
|
||||
"yank-pop isn't supported with multiple cursors"
|
||||
(unless multiple-cursors-mode
|
||||
ad-do-it))
|
||||
|
||||
(defun mc/execute-command-for-all-cursors (cmd)
|
||||
(let ((current-kill-ring kill-ring))
|
||||
(save-excursion
|
||||
|
Loading…
x
Reference in New Issue
Block a user