]> git.eshelyaron.com Git - emacs.git/commitdiff
Eglot: Simplify overlay handling in manual example
authorSlava Akhmechet <coffeemug@gmail.com>
Thu, 11 Jan 2024 21:50:08 +0000 (15:50 -0600)
committerEshel Yaron <me@eshelyaron.com>
Fri, 12 Jan 2024 16:56:37 +0000 (17:56 +0100)
* doc/misc/eglot.texi (Extending Eglot): Simplify.

Copyright-paperwork-exempt: yes
(cherry picked from commit bfb486d8026424ec0859036b3686df9cab1383df)

doc/misc/eglot.texi

index 304311c1ed2bd73b68811ddf29cbb7dfffb8a0dd..673bd1dbd22c5e5d40258d52b298454ccf461543 100644 (file)
@@ -1405,8 +1405,6 @@ The remainder of the implementation consists of standard Elisp
 techniques to loop over arrays, manage buffers and overlays.
 
 @lisp
-(defvar-local eglot-clangd-inactive-region-overlays '())
-
 (cl-defmethod eglot-handle-notification
   (_server (_method (eql textDocument/inactiveRegions))
            &key regions textDocument &allow-other-keys)
@@ -1414,14 +1412,14 @@ techniques to loop over arrays, manage buffers and overlays.
                                      (cl-getf textDocument :uri))))
             (buffer (find-buffer-visiting path)))
       (with-current-buffer buffer
-        (mapc #'delete-overlay eglot-clangd-inactive-region-overlays)
+        (remove-overlays nil nil 'inactive-code t)
         (cl-loop
          for r across regions
          for (beg . end) = (eglot-range-region r)
          for ov = (make-overlay beg end)
          do
          (overlay-put ov 'face 'shadow)
-         (push ov eglot-clangd-inactive-region-overlays)))))
+         (overlay-put ov 'inactive-code t)))))
 @end lisp
 
 @end itemize