]> git.eshelyaron.com Git - emacs.git/commitdiff
More correctly setup rust-mode-related autoloads
authorJoão Távora <joaotavora@gmail.com>
Thu, 10 May 2018 11:07:11 +0000 (12:07 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 10 May 2018 11:07:11 +0000 (12:07 +0100)
By autoloading the add-hook form and the eglot--setup-rls-idiosyncrasies
definition, a user can start rust-mode without loading eglot.el along
with it.

* eglot.el (rust-mode-hook)
(eglot--setup-rls-idiosyncrasies): Wrap in autoloaded progn.

lisp/progmodes/eglot.el

index eba0e84f267c2dc7380ea3b4a3553570151ff89e..fbddf16c3f233c0a952fabd8532a95808b1e1d29 100644 (file)
@@ -1471,12 +1471,11 @@ Proceed? "
         (and (equal "Indexing" what) done))))
 
 ;;;###autoload
-(add-hook 'rust-mode-hook 'eglot--setup-rls-idiosyncrasies)
-
-;;;###autoload
-(defun eglot--setup-rls-idiosyncrasies ()
-  "RLS needs special treatment..."
-  (add-hook 'eglot--ready-predicates 'eglot--rls-probably-ready-for-p t t))
+(progn
+  (add-hook 'rust-mode-hook 'eglot--setup-rls-idiosyncrasies)
+  (defun eglot--setup-rls-idiosyncrasies ()
+    "Prepare `eglot' to deal with RLS's special treatment."
+    (add-hook 'eglot--ready-predicates 'eglot--rls-probably-ready-for-p t t)))
 
 (cl-defun eglot--server-window/progress
     (process &key id done title message &allow-other-keys)