unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls
@ 2023-12-30  9:05 Vyacheslav Akhmechet
  2023-12-30 13:45 ` Felician Nemeth
  0 siblings, 1 reply; 9+ messages in thread
From: Vyacheslav Akhmechet @ 2023-12-30  9:05 UTC (permalink / raw)
  To: 68145

[-- Attachment #1: Type: text/plain, Size: 1632 bytes --]

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''


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-doc-misc-eglot.texi-Fix-broken-function-calls.patch --]
[-- Type: text/patch, Size: 2218 bytes --]

From a2734a0c643e89afae5bc1b1e88776ff61cddb8e Mon Sep 17 00:00:00 2001
From: Slava Akhmechet <coffeemug@gmail.com>
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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls
  2023-12-30  9:05 bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls Vyacheslav Akhmechet
@ 2023-12-30 13:45 ` Felician Nemeth
  2023-12-30 14:46   ` João Távora
  0 siblings, 1 reply; 9+ messages in thread
From: Felician Nemeth @ 2023-12-30 13:45 UTC (permalink / raw)
  To: Vyacheslav Akhmechet; +Cc: 68145, joaotavora

Vyacheslav Akhmechet <coffeemug@gmail.com> writes:

> -  (if-let* ((path (expand-file-name (eglot-uri-to-path
> +  (if-let* ((path (expand-file-name (eglot--uri-to-path

The latest Eglot has this:

(define-obsolete-function-alias 'eglot--uri-to-path 'eglot-uri-to-path "1.16")

The confusion might come from the fact that ELPA had v1.16 for a brief
period, but now (for some strange reason) only v1.15 is available.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls
  2023-12-30 13:45 ` Felician Nemeth
@ 2023-12-30 14:46   ` João Távora
  2023-12-30 18:16     ` Stefan Kangas
  2023-12-30 20:32     ` Slava Akhmechet
  0 siblings, 2 replies; 9+ messages in thread
From: João Távora @ 2023-12-30 14:46 UTC (permalink / raw)
  To: Felician Nemeth, Stefan Kangas; +Cc: 68145, Vyacheslav Akhmechet

On Sat, Dec 30, 2023 at 1:45 PM Felician Nemeth
<felician.nemeth@gmail.com> wrote:
>
> Vyacheslav Akhmechet <coffeemug@gmail.com> writes:
>
> > -  (if-let* ((path (expand-file-name (eglot-uri-to-path
> > +  (if-let* ((path (expand-file-name (eglot--uri-to-path
>
> The latest Eglot has this:
>
> (define-obsolete-function-alias 'eglot--uri-to-path 'eglot-uri-to-path "1.16")
>
> The confusion might come from the fact that ELPA had v1.16 for a brief
> period, but now (for some strange reason) only v1.15 is available.

Strange indeed.  No idea what happened, but the 1.16 tarball is also
available:

https://elpa.gnu.org/packages/eglot-1.16.tar.lz

Stefan, can you see about this.

Vyacheslav, Felicián is correct.  Don't suggest '--' version of
functions in the manuals.  The remaining simplification is
welcome.  Don't use the symbol name 'inactive--code' though,
the '--' means "private".  That symbol can be "inactive-code"
or 'my-inactive-code' or even 'my-extension--inactive-code'.
Here though, "inactive-code" is preferable for demonstration
purposes.

João





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls
  2023-12-30 14:46   ` João Távora
@ 2023-12-30 18:16     ` Stefan Kangas
  2024-01-01 18:17       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-12-30 20:32     ` Slava Akhmechet
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Kangas @ 2023-12-30 18:16 UTC (permalink / raw)
  To: João Távora, Felician Nemeth
  Cc: 68145, Vyacheslav Akhmechet, Stefan Monnier

João Távora <joaotavora@gmail.com> writes:

> On Sat, Dec 30, 2023 at 1:45 PM Felician Nemeth
> <felician.nemeth@gmail.com> wrote:
>>
>> Vyacheslav Akhmechet <coffeemug@gmail.com> writes:
>>
>> > -  (if-let* ((path (expand-file-name (eglot-uri-to-path
>> > +  (if-let* ((path (expand-file-name (eglot--uri-to-path
>>
>> The latest Eglot has this:
>>
>> (define-obsolete-function-alias 'eglot--uri-to-path 'eglot-uri-to-path "1.16")
>>
>> The confusion might come from the fact that ELPA had v1.16 for a brief
>> period, but now (for some strange reason) only v1.15 is available.
>
> Strange indeed.  No idea what happened, but the 1.16 tarball is also
> available:
>
> https://elpa.gnu.org/packages/eglot-1.16.tar.lz
>
> Stefan, can you see about this.

I'm assuming the scripts bugged out.  I'm copying in the other Stefan,
since he has access to the server where this all runs.

The simplest solution in this case is probably to just bump the version
to 1.17, but that won't stop this from happening again in the future.

> Vyacheslav, Felicián is correct.  Don't suggest '--' version of
> functions in the manuals.  The remaining simplification is
> welcome.  Don't use the symbol name 'inactive--code' though,
> the '--' means "private".  That symbol can be "inactive-code"
> or 'my-inactive-code' or even 'my-extension--inactive-code'.
> Here though, "inactive-code" is preferable for demonstration
> purposes.
>
> João





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls
  2023-12-30 14:46   ` João Távora
  2023-12-30 18:16     ` Stefan Kangas
@ 2023-12-30 20:32     ` Slava Akhmechet
  2024-01-11 20:58       ` Stefan Kangas
  1 sibling, 1 reply; 9+ messages in thread
From: Slava Akhmechet @ 2023-12-30 20:32 UTC (permalink / raw)
  To: João Távora; +Cc: 68145, Felician Nemeth, Stefan Kangas


[-- Attachment #1.1: Type: text/plain, Size: 195 bytes --]

On Sat, Dec 30, 2023 at 6:46 AM João Távora <joaotavora@gmail.com> wrote:
> The remaining simplification is welcome.

Ack. Attached is a small patch that just cleans up overlay handling.

[-- Attachment #1.2: Type: text/html, Size: 291 bytes --]

[-- Attachment #2: 0001-doc-misc-eglot.texi-Simplify-overlay-handling.patch --]
[-- Type: application/octet-stream, Size: 1528 bytes --]

From c3e961d99639b3d85b733257135d74958ef1b845 Mon Sep 17 00:00:00 2001
From: Slava Akhmechet <coffeemug@gmail.com>
Date: Sat, 30 Dec 2023 12:27:51 -0800
Subject: [PATCH] doc/misc/eglot.texi: Simplify overlay handling

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

diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi
index a338677e844..6895cd671f5 100644
--- a/doc/misc/eglot.texi
+++ b/doc/misc/eglot.texi
@@ -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
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls
  2023-12-30 18:16     ` Stefan Kangas
@ 2024-01-01 18:17       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-01-01 18:17 UTC (permalink / raw)
  To: Stefan Kangas
  Cc: 68145, Felician Nemeth, João Távora,
	Vyacheslav Akhmechet

>> Strange indeed.  No idea what happened, but the 1.16 tarball is also
>> available:

I think the previous run of "update packages" was killed (timeout? OOM?)
and left the Git tree in an incorrect state (more specifically in
a detached state pointing at some old commit where Eglot happened to
still be at 1.15).
I've seen such problem sin the past and have tried to make the scripts
more robust in the face of such weird states, but it's hard to know
how/where to handle it.  I fixed it by hand this time, and added
yet-another sanity check elsewhere to help me catch or fix it, so
hopefully in won't re-occur.


        Stefan






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls
  2023-12-30 20:32     ` Slava Akhmechet
@ 2024-01-11 20:58       ` Stefan Kangas
  2024-01-11 21:52         ` João Távora
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Kangas @ 2024-01-11 20:58 UTC (permalink / raw)
  To: Slava Akhmechet; +Cc: 68145, Felician Nemeth, João Távora

Slava Akhmechet <coffeemug@gmail.com> writes:

> On Sat, Dec 30, 2023 at 6:46 AM João Távora <joaotavora@gmail.com> wrote:
>> The remaining simplification is welcome.
>
> Ack. Attached is a small patch that just cleans up overlay handling.

João, could you install this patch if you think it looks good?

Thanks in advance.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls
  2024-01-11 20:58       ` Stefan Kangas
@ 2024-01-11 21:52         ` João Távora
  2024-01-13 10:56           ` Stefan Kangas
  0 siblings, 1 reply; 9+ messages in thread
From: João Távora @ 2024-01-11 21:52 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 68145, Felician Nemeth, Slava Akhmechet

close 68145
thanks

On Thu, Jan 11, 2024 at 8:58 PM Stefan Kangas <stefankangas@gmail.com> wrote:
>
> Slava Akhmechet <coffeemug@gmail.com> writes:
>
> > On Sat, Dec 30, 2023 at 6:46 AM João Távora <joaotavora@gmail.com> wrote:
> >> The remaining simplification is welcome.
> >
> > Ack. Attached is a small patch that just cleans up overlay handling.
>
> João, could you install this patch if you think it looks good?
>
> Thanks in advance.

Done in bfb486d8026424ec0859036b3686df9cab1383df

João





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls
  2024-01-11 21:52         ` João Távora
@ 2024-01-13 10:56           ` Stefan Kangas
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Kangas @ 2024-01-13 10:56 UTC (permalink / raw)
  To: João Távora; +Cc: 68145, Felician Nemeth, Slava Akhmechet

close 68145
thanks

João Távora <joaotavora@gmail.com> writes:

> close 68145
> thanks

That only works if you Bcc control@debbugs.gnu.org.  I did that here.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-01-13 10:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-30  9:05 bug#68145: [PATCH] * doc/misc/eglot.texi: Fix broken function calls Vyacheslav Akhmechet
2023-12-30 13:45 ` Felician Nemeth
2023-12-30 14:46   ` João Távora
2023-12-30 18:16     ` Stefan Kangas
2024-01-01 18:17       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-30 20:32     ` Slava Akhmechet
2024-01-11 20:58       ` Stefan Kangas
2024-01-11 21:52         ` João Távora
2024-01-13 10:56           ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).