Use setq for default lists to be able to re-evaluate.

This commit is contained in:
Magnar Sveen 2012-07-21 08:08:45 +02:00
parent 84ef509350
commit d69ae15fef

View File

@ -292,24 +292,59 @@ from being executed if in multiple-cursors-mode."
(overlay-put cursor 'kill-ring kill-ring) (overlay-put cursor 'kill-ring kill-ring)
(overlay-put cursor 'kill-ring-yank-pointer kill-ring-yank-pointer))))))) (overlay-put cursor 'kill-ring-yank-pointer kill-ring-yank-pointer)))))))
(defvar mc--default-cmds-to-run-once '(mc/switch-from-mark-multiple-to-cursors (defun mc/save-lists ()
(with-temp-file mc/list-file
(emacs-lisp-mode)
(insert ";; This file is automatically generated by the multiple-cursors extension.")
(newline)
(insert ";; It keeps track of your preferences for running commands with multiple cursors.")
(newline)
(newline)
(insert "(setq mc/cmds-to-run-for-all '(")
(mapc #'(lambda (cmd) (insert (format "%S" cmd)) (newline-and-indent)) mc/cmds-to-run-for-all)
(when mc/cmds-to-run-for-all
(next-line -1)
(end-of-line))
(insert "))")
(newline)
(newline)
(insert "(setq mc/cmds-to-run-once '(")
(mapc #'(lambda (cmd) (insert (format "%S" cmd)) (newline-and-indent)) mc/cmds-to-run-once)
(when mc/cmds-to-run-once
(next-line -1)
(end-of-line))
(insert "))")
(newline)))
(defvar mc/cmds-to-run-once nil
"Commands to run only once in multiple-cursors-mode.")
(defvar mc--default-cmds-to-run-once nil
"Default set of commands to run only once in multiple-cursors-mode.")
(setq mc--default-cmds-to-run-once '(mc/switch-from-mark-multiple-to-cursors
mc/edit-lines mc/edit-lines
mc/edit-ends-of-lines mc/edit-ends-of-lines
mc/edit-beginnings-of-lines mc/edit-beginnings-of-lines
mc/mark-next-like-this mc/mark-next-like-this
mc/cycle-forward
rrm/switch-to-multiple-cursors
save-buffer save-buffer
ido-exit-minibuffer ido-exit-minibuffer
undo undo-tree-undo undo undo-tree-undo
redo undo-tree-redo redo undo-tree-redo
universal-argument universal-argument
universal-argument-other-key universal-argument-other-key
top-level) top-level))
"Default set of commands to run only once in multiple-cursors-mode.")
(defvar mc/cmds-to-run-once nil (defvar mc/list-file "~/.emacs.d/.mc-lists.el"
"Commands to run only once in multiple-cursors-mode.") "The position of the file that keeps track of your preferences
for running commands with multiple cursors.")
(defvar mc--default-cmds-to-run-for-all '(mc/keyboard-quit (defvar mc--default-cmds-to-run-for-all nil
"Default set of commands that should be mirrored by all cursors")
(setq mc--default-cmds-to-run-for-all '(mc/keyboard-quit
self-insert-command self-insert-command
previous-line previous-line
next-line next-line
@ -363,36 +398,7 @@ from being executed if in multiple-cursors-mode."
smart-forward smart-forward
smart-backward smart-backward
smart-up smart-up
smart-down) smart-down))
"Default set of commands that should be mirrored by all cursors")
(defvar mc/list-file "~/.emacs.d/.mc-lists.el"
"The position of the file that keeps track of your preferences
for running commands with multiple cursors.")
(defun mc/save-lists ()
(with-temp-file mc/list-file
(emacs-lisp-mode)
(insert ";; This file is automatically generated by the multiple-cursors extension.")
(newline)
(insert ";; It keeps track of your preferences for running commands with multiple cursors.")
(newline)
(newline)
(insert "(setq mc/cmds-to-run-for-all '(")
(mapc #'(lambda (cmd) (insert (format "%S" cmd)) (newline-and-indent)) mc/cmds-to-run-for-all)
(when mc/cmds-to-run-for-all
(next-line -1)
(end-of-line))
(insert "))")
(newline)
(newline)
(insert "(setq mc/cmds-to-run-once '(")
(mapc #'(lambda (cmd) (insert (format "%S" cmd)) (newline-and-indent)) mc/cmds-to-run-once)
(when mc/cmds-to-run-once
(next-line -1)
(end-of-line))
(insert "))")
(newline)))
(defvar mc/cmds-to-run-for-all nil (defvar mc/cmds-to-run-for-all nil
"Commands to run for all cursors in multiple-cursors-mode") "Commands to run for all cursors in multiple-cursors-mode")