mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 13:03:03 +00:00
Add mc/dump-list to make mc/save-lists diff-friendly
This commit is contained in:
parent
7a6eb0df90
commit
00f905549e
@ -479,6 +479,17 @@ from being executed if in multiple-cursors-mode."
|
|||||||
"The position of the file that keeps track of your preferences
|
"The position of the file that keeps track of your preferences
|
||||||
for running commands with multiple cursors.")
|
for running commands with multiple cursors.")
|
||||||
|
|
||||||
|
(defun mc/dump-list (list-symbol)
|
||||||
|
"Insert (setq 'LIST-SYMBOL LIST-VALUE) to current buffer."
|
||||||
|
(let ((value (symbol-value list-symbol)))
|
||||||
|
(insert "(setq " (symbol-name list-symbol) "\n"
|
||||||
|
" '(")
|
||||||
|
(newline-and-indent)
|
||||||
|
(mapc #'(lambda (cmd) (insert (format "%S" cmd)) (newline-and-indent))
|
||||||
|
value)
|
||||||
|
(insert "))")
|
||||||
|
(newline)))
|
||||||
|
|
||||||
(defun mc/save-lists ()
|
(defun mc/save-lists ()
|
||||||
"Saves preferences for running commands with multiple cursors to `mc/list-file'"
|
"Saves preferences for running commands with multiple cursors to `mc/list-file'"
|
||||||
(with-temp-file mc/list-file
|
(with-temp-file mc/list-file
|
||||||
@ -488,21 +499,9 @@ for running commands with multiple cursors.")
|
|||||||
(insert ";; It keeps track of your preferences for running commands with multiple cursors.")
|
(insert ";; It keeps track of your preferences for running commands with multiple cursors.")
|
||||||
(newline)
|
(newline)
|
||||||
(newline)
|
(newline)
|
||||||
(insert "(setq mc/cmds-to-run-for-all '(")
|
(mc/dump-list '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
|
|
||||||
(forward-line -1)
|
|
||||||
(end-of-line))
|
|
||||||
(insert "))")
|
|
||||||
(newline)
|
(newline)
|
||||||
(newline)
|
(mc/dump-list 'mc/cmds-to-run-once)))
|
||||||
(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
|
|
||||||
(forward-line -1)
|
|
||||||
(end-of-line))
|
|
||||||
(insert "))")
|
|
||||||
(newline)))
|
|
||||||
|
|
||||||
(defvar mc/cmds-to-run-once nil
|
(defvar mc/cmds-to-run-once nil
|
||||||
"Commands to run only once in multiple-cursors-mode.")
|
"Commands to run only once in multiple-cursors-mode.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user