unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69605: [PATCH] Query Eglot version via package.el
@ 2024-03-07  9:23 Philip Kaludercic
  2024-05-03  7:38 ` Philip Kaludercic
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2024-03-07  9:23 UTC (permalink / raw)
  To: 69605

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

It seems to me that 'package-get-version' should already implement the
logic which is currently being reproduced when defining the constant
'eglot--version', so I suggest the following simplification:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Query Eglot version via package.el --]
[-- Type: text/x-patch, Size: 1725 bytes --]

From 7566857ae869eb4cf01bde527eaedb8a3353f035 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Thu, 7 Mar 2024 10:21:45 +0100
Subject: [PATCH] Query Eglot version via package.el

* lisp/progmodes/eglot.el (eglot--version): Remove constant.
(eglot--connect): Use 'package-get-version'.
---
 lisp/progmodes/eglot.el | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index f341428cac3..1ec186e75f8 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -545,13 +545,6 @@ eglot-withhold-process-id
 \f
 ;;; Constants
 ;;;
-(defconst eglot--version
-  (eval-when-compile
-    (when byte-compile-current-file
-      (require 'lisp-mnt)
-      (lm-version byte-compile-current-file)))
-  "The version as a string of this version of Eglot.
-It is nil if Eglot is not byte-complied.")
 
 (defconst eglot--symbol-kind-names
   `((1 . "File") (2 . "Module")
@@ -1585,8 +1578,10 @@ eglot--connect
                                             'network))
                               (emacs-pid))
                             :clientInfo
-                            `(:name "Eglot" ,@(when eglot--version
-                                                `(:version ,eglot--version)))
+                            (append
+                             '(:name "Eglot")
+                             (let ((v (package-get-version)))
+                               (and v (list :version v))))
                             ;; Maybe turn trampy `/ssh:foo@bar:/path/to/baz.py'
                             ;; into `/path/to/baz.py', so LSP groks it.
                             :rootPath (file-local-name
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 37 bytes --]


-- 
	Philip Kaludercic on peregrine

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

* bug#69605: [PATCH] Query Eglot version via package.el
  2024-03-07  9:23 bug#69605: [PATCH] Query Eglot version via package.el Philip Kaludercic
@ 2024-05-03  7:38 ` Philip Kaludercic
  2024-05-03 11:54   ` João Távora
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2024-05-03  7:38 UTC (permalink / raw)
  To: 69605; +Cc: João Távora

Ping?

Philip Kaludercic <philipk@posteo.net> writes:

> It seems to me that 'package-get-version' should already implement the
> logic which is currently being reproduced when defining the constant
> 'eglot--version', so I suggest the following simplification:
>
>>From 7566857ae869eb4cf01bde527eaedb8a3353f035 Mon Sep 17 00:00:00 2001
> From: Philip Kaludercic <philipk@posteo.net>
> Date: Thu, 7 Mar 2024 10:21:45 +0100
> Subject: [PATCH] Query Eglot version via package.el
>
> * lisp/progmodes/eglot.el (eglot--version): Remove constant.
> (eglot--connect): Use 'package-get-version'.
> ---
>  lisp/progmodes/eglot.el | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index f341428cac3..1ec186e75f8 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -545,13 +545,6 @@ eglot-withhold-process-id
>  \f
>  ;;; Constants
>  ;;;
> -(defconst eglot--version
> -  (eval-when-compile
> -    (when byte-compile-current-file
> -      (require 'lisp-mnt)
> -      (lm-version byte-compile-current-file)))
> -  "The version as a string of this version of Eglot.
> -It is nil if Eglot is not byte-complied.")
>  
>  (defconst eglot--symbol-kind-names
>    `((1 . "File") (2 . "Module")
> @@ -1585,8 +1578,10 @@ eglot--connect
>                                              'network))
>                                (emacs-pid))
>                              :clientInfo
> -                            `(:name "Eglot" ,@(when eglot--version
> -                                                `(:version ,eglot--version)))
> +                            (append
> +                             '(:name "Eglot")
> +                             (let ((v (package-get-version)))
> +                               (and v (list :version v))))
>                              ;; Maybe turn trampy `/ssh:foo@bar:/path/to/baz.py'
>                              ;; into `/path/to/baz.py', so LSP groks it.
>                              :rootPath (file-local-name
> -- 
> 2.44.0

-- 
	Philip Kaludercic on peregrine





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

* bug#69605: [PATCH] Query Eglot version via package.el
  2024-05-03  7:38 ` Philip Kaludercic
@ 2024-05-03 11:54   ` João Távora
  2024-05-03 18:13     ` Philip Kaludercic
  0 siblings, 1 reply; 6+ messages in thread
From: João Távora @ 2024-05-03 11:54 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 69605

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

On Fri, May 3, 2024 at 8:38 AM Philip Kaludercic <philipk@posteo.net> wrote:

> Ping?
>

Patch looks good to me, I'm generally in favour of things that replace
Eglot-rolled facilities with standard ones.

But I haven't tested it.  What will `package-get-version` say of a master
build of Emacs where lisp/progmodes/eglot.el has changes that haven't
been published to GNU Elpa yet?  Does it even matter?

Anyway, I think the change is safe to install, just please make sure it
doesn't trip the GitHub CI (it shouldn't).

João

[-- Attachment #2: Type: text/html, Size: 1183 bytes --]

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

* bug#69605: [PATCH] Query Eglot version via package.el
  2024-05-03 11:54   ` João Távora
@ 2024-05-03 18:13     ` Philip Kaludercic
  2024-05-18 22:27       ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2024-05-03 18:13 UTC (permalink / raw)
  To: João Távora; +Cc: 69605

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

> On Fri, May 3, 2024 at 8:38 AM Philip Kaludercic <philipk@posteo.net> wrote:
>
>> Ping?
>>
>
> Patch looks good to me, I'm generally in favour of things that replace
> Eglot-rolled facilities with standard ones.
>
> But I haven't tested it.  What will `package-get-version` say of a master
> build of Emacs where lisp/progmodes/eglot.el has changes that haven't
> been published to GNU Elpa yet?  Does it even matter?

It will just extract the value of the version header of the compiled
file.

> Anyway, I think the change is safe to install, just please make sure it
> doesn't trip the GitHub CI (it shouldn't).

The three tested versions on GitHub all appear to pass the test.  I'll
push the changes to emacs.git for now.

> João

-- 
	Philip Kaludercic on peregrine





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

* bug#69605: [PATCH] Query Eglot version via package.el
  2024-05-03 18:13     ` Philip Kaludercic
@ 2024-05-18 22:27       ` Stefan Kangas
  2024-05-18 22:30         ` Philip Kaludercic
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2024-05-18 22:27 UTC (permalink / raw)
  To: Philip Kaludercic, João Távora; +Cc: 69605

Philip Kaludercic <philipk@posteo.net> writes:

> The three tested versions on GitHub all appear to pass the test.  I'll
> push the changes to emacs.git for now.

Is there more to do here, or should this bug closed?





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

* bug#69605: [PATCH] Query Eglot version via package.el
  2024-05-18 22:27       ` Stefan Kangas
@ 2024-05-18 22:30         ` Philip Kaludercic
  0 siblings, 0 replies; 6+ messages in thread
From: Philip Kaludercic @ 2024-05-18 22:30 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: João Távora, 69605-done

Stefan Kangas <stefankangas@gmail.com> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> The three tested versions on GitHub all appear to pass the test.  I'll
>> push the changes to emacs.git for now.
>
> Is there more to do here, or should this bug closed?

No, the change have been part of emacs.git since
3d4918c2f1d10df4051ca7dc1d17decf157adb3f.  I'll close the report.


-- 
	Philip Kaludercic on peregrine





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

end of thread, other threads:[~2024-05-18 22:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-07  9:23 bug#69605: [PATCH] Query Eglot version via package.el Philip Kaludercic
2024-05-03  7:38 ` Philip Kaludercic
2024-05-03 11:54   ` João Távora
2024-05-03 18:13     ` Philip Kaludercic
2024-05-18 22:27       ` Stefan Kangas
2024-05-18 22:30         ` Philip Kaludercic

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).