]> git.eshelyaron.com Git - emacs.git/commitdiff
Locally tweak imenu-create-index-function
authorJoão Távora <joaotavora@gmail.com>
Wed, 20 Nov 2019 22:51:42 +0000 (22:51 +0000)
committerJoão Távora <joaotavora@gmail.com>
Wed, 20 Nov 2019 22:51:42 +0000 (22:51 +0000)
* eglot.el (eglot--managed-mode): locally tweak
imenu-create-index-function.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/351

lisp/progmodes/eglot.el

index c25b7b7f082569826f000ac8fc2ae2a74864d005..a327655a0ea579549910f0e32fa647e29a9d9ed8 100644 (file)
@@ -1247,7 +1247,8 @@ For example, to keep your Company customization use
     (eglot--setq-saving company-backends '(company-capf))
     (eglot--setq-saving company-tooltip-align-annotations t)
     (unless (eglot--stay-out-of-p 'imenu)
-      (add-function :before-until imenu-create-index-function #'eglot-imenu))
+      (add-function :before-until (local 'imenu-create-index-function)
+                    #'eglot-imenu))
     (flymake-mode 1)
     (eldoc-mode 1)
     (cl-pushnew (current-buffer) (eglot--managed-buffers eglot--cached-current-server)))
@@ -1267,6 +1268,7 @@ For example, to keep your Company customization use
     (remove-hook 'pre-command-hook 'eglot--pre-command-hook t)
     (cl-loop for (var . saved-binding) in eglot--saved-bindings
              do (set (make-local-variable var) saved-binding))
+    (remove-function (local 'imenu-create-index-function) #'eglot-imenu)
     (setq eglot--current-flymake-report-fn nil)
     (let ((server eglot--cached-current-server))
       (setq eglot--cached-current-server nil)