mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 05:03:03 +00:00
Merge pull request #355 from flatwhatson/lazy-list-file
Load mc/list-file as late as possible
This commit is contained in:
commit
fc6a6a7462
@ -435,6 +435,10 @@ the original cursor, to inform about the lack of support."
|
||||
(message "%S is not supported with multiple cursors%s"
|
||||
original-command
|
||||
(get original-command 'mc--unsupported))
|
||||
|
||||
;; lazy-load the user's list file
|
||||
(mc/load-lists)
|
||||
|
||||
(when (and original-command
|
||||
(not (memq original-command mc--default-cmds-to-run-once))
|
||||
(not (memq original-command mc/cmds-to-run-once))
|
||||
@ -613,6 +617,15 @@ for running commands with multiple cursors."
|
||||
:type 'file
|
||||
:group 'multiple-cursors)
|
||||
|
||||
(defvar mc--list-file-loaded nil
|
||||
"Whether the list file has already been loaded.")
|
||||
|
||||
(defun mc/load-lists ()
|
||||
"Loads preferences for running commands with multiple cursors from `mc/list-file'"
|
||||
(unless mc--list-file-loaded
|
||||
(load mc/list-file 'noerror 'nomessage)
|
||||
(setq mc--list-file-loaded t)))
|
||||
|
||||
(defun mc/dump-list (list-symbol)
|
||||
"Insert (setq 'LIST-SYMBOL LIST-VALUE) to current buffer."
|
||||
(cl-symbol-macrolet ((value (symbol-value list-symbol)))
|
||||
@ -817,10 +830,6 @@ for running commands with multiple cursors."
|
||||
(defvar mc/cmds-to-run-for-all nil
|
||||
"Commands to run for all cursors in multiple-cursors-mode")
|
||||
|
||||
;; load, but no errors if it does not exist yet please, and no message
|
||||
;; while loading
|
||||
(load mc/list-file 'noerror 'nomessage)
|
||||
|
||||
(provide 'multiple-cursors-core)
|
||||
|
||||
;; Local Variables:
|
||||
|
Loading…
x
Reference in New Issue
Block a user