branch: elpa/multiple-cursors
commit fc6a6a74626b8458f2a36d802165a7f74114fafd
Merge: 5ff2071 d27870d
Author: Magnar Sveen <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #355 from flatwhatson/lazy-list-file
Load mc/list-file as late as possible
---
multiple-cursors-core.el | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index 935f6df..12e9e75 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -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: