Subject: [PATCH] * doc/misc/eglot.texi: Fix broken function calls

From: Vyacheslav Akhmechet <[email-masked]>
Date: Sat, 30 Dec 2023 01:05:13 -0800

Tags: patch

Tags: patch

This patch fixes a broken example in the eglot manual. It makes two
changes:

* Fixes broken function calls
* Slightly simplifies overlay handling

Submitting this upon João Távora's suggestion.

In GNU Emacs 29.1 (build 2, aarch64-apple-darwin23.2.0, NS
 appkit-2487.30 Version 14.2.1 (Build 23C71)) of 2023-12-24 built on
 Vyacheslavs-MacBook-Pro.local
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.2.1

Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
 --infodir=/opt/homebrew/Cellar/emacs-plus@29/29.1/share/info/emacs
 --prefix=/opt/homebrew/Cellar/emacs-plus@29/29.1 --with-xml2
 --with-gnutls --with-native-compilation --without-compress-install
 --without-dbus --without-imagemagick --with-modules --with-rsvg
 --with-ns --disable-ns-self-contained 'CFLAGS=-Os -w -pipe
 -mmacosx-version-min=14
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
 -DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT'
 'CPPFLAGS=-I/opt/homebrew/opt/zlib/include
 -I/opt/homebrew/opt/jpeg/include -I/opt/homebrew/opt/icu4c/include
 -isystem/opt/homebrew/include -F/opt/homebrew/Frameworks
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk'
 'LDFLAGS=-L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/jpeg/lib
 -L/opt/homebrew/opt/icu4c/lib -L/opt/homebrew/lib
 -F/opt/homebrew/Frameworks -Wl,-headerpad_max_install_names
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
 -L/opt/homebrew/opt/libgccjit/lib''

>From a2734a0c643e89afae5bc1b1e88776ff61cddb8e Mon Sep 17 00:00:00 2001
From: Slava Akhmechet <[email-masked]>
Date: Sat, 30 Dec 2023 00:31:43 -0800
Subject: [PATCH] * doc/misc/eglot.texi: Fix broken function calls

---
 doc/misc/eglot.texi | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi
index a338677e844..0ff69130eb9 100644
--- a/doc/misc/eglot.texi
+++ b/doc/misc/eglot.texi
@@ -1397,31 +1397,29 @@ Elisp plists (@pxref{JSONRPC objects in Elisp}).
 The Eglot generic function machinery will automatically destructure
 the incoming message, so these two properties can simply be added to
 the new method's lambda list as @code{&key} arguments.  Also, the
-@code{eglot-uri-to-path} and @code{eglot-range-region} may be used to
-easily parse the LSP @code{:uri} and @code{:start ... :end ...}
+@code{eglot--uri-to-path} and @code{eglot--range-region} may be used
+to easily parse the LSP @code{:uri} and @code{:start ... :end ...}
 objects to obtain Emacs objects for file names and positions.
 
 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)
-  (if-let* ((path (expand-file-name (eglot-uri-to-path
+  (if-let* ((path (expand-file-name (eglot--uri-to-path
                                      (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 (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
-- 
2.43.0