Subject: bug#73472: closed (Re: bug#73472: [PATCH] Substitute quotation marks in Eglot messages)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 06 Jan 2025 10:54:02 +0000

Your bug report

#73472: [PATCH] Substitute quotation marks in Eglot messages

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
73472: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73472
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#73472: [PATCH] Substitute quotation marks in Eglot messages
From: João Távora <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 06 Jan 2025 10:53:47 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Eli Zaretskii <[email-masked]> writes:

>> From: João Távora <[email-masked]>
>> Date: Thu, 12 Dec 2024 10:57:48 +0000
>> Cc: Thomas Voss <[email-masked]>, [email-masked]
>> 
>> On Thu, Dec 12, 2024 at 10:50 AM Eli Zaretskii <[email-masked]> wrote:
>> >
>> > > Date: Mon, 09 Dec 2024 19:01:28 +0100
>> > > From: "Thomas Voss" <[email-masked]>
>> > >
>> > > Apologies for the long delay; I have been super busy recently.
>> > >
>> > > > Ping!
>> > > >
>> > > > > Thanks.  João, any comments?
>> > > > >
>> > > > > My only comment is that the log message says "format-prompt", but the
>> > > > > code actually uses substitute-quotes.
>> > >
>> > > Uh… are we looking at the same patch?  The log message in the patch I
>> > > last sent does say ‘substitute-quotes’ for all the places where I used
>> > > that function, and only says ‘format-prompt’ for the place where I used
>> > > that function (‘eglot-rename’).
>> > >
>> > > Just in case, I attached the patch again to this email.
>> >
>> > Thanks.
>> >
>> > João, are you okay with me installing this?
>> 
>> Just had a look. The patch won't break anything, but it has some problems
>> around the part where substitute quotes isn't around a literal, but wraps
>> a bigger block.  I'll try to fix it.  It would also be great to have some file
>> local symbol-shortening mechanism to avoid that long name, but I'm
>> not going to worry about that.
>
> Ping!  Did you have time to look into this?

Alright.  I finally looked into Thomas' patch properly, and fixed the
problems it had.

I can produce that patch if anyone's interested.  But looking at it,
it's just way too verbose: the long 'substitute-quotes' sprinkled
everywhere is hideos, shame we can't use shorthands or have a reader
macro for that.

So I opted to bring `substitute-quotes` into a new `eglot--format`
helper and use it in eglot--error, eglot--warn, etc.  Which is ugly in
itself (I don't like my helpers to do this kind of stuff), but given the
situation and my want to kill this bug, it'll do.  Closing the bug.

João

Subject: [PATCH] Substitute quotation marks in Eglot messages
From: "Thomas Voss" <[email-masked]>
To: <[email-masked]>
Date: Wed, 25 Sep 2024 16:03:32 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi all,

Another quick patch from myself.  This patch makes it so that the
diagnostics and interactive prompts from Eglot (such as the prompt you
iteract with when renaming a symbol) properly respect
‘text-quoting-style’.

-- 
— Thomas
From 2038b983a751a2e26c2e8a0b8d55ade29fb394fd Mon Sep 17 00:00:00 2001
From: Thomas Voss <[email-masked]>
Date: Wed, 25 Sep 2024 15:51:36 +0200
Subject: [PATCH] Substitute quotation marks in Eglot messages

* lisp/progmodes/eglot.el (eglot--error) (eglot--message): Wrap the
message in `substitute-quotes'.
* lisp/progmodes/eglot.el (eglot-rename): Format the prompt using
`format-prompt' as opposed to `format'.

Copyright-paperwork-exempt: yes
---
 lisp/progmodes/eglot.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index a358b82..ee52767 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1698,11 +1698,11 @@ eglot--connect
 ;;;
 (defun eglot--error (format &rest args)
   "Error out with FORMAT with ARGS."
-  (error "[eglot] %s" (apply #'format format args)))
+  (error "[eglot] %s" (substitute-quotes (apply #'format format args))))
 
 (defun eglot--message (format &rest args)
   "Message out with FORMAT with ARGS."
-  (message "[eglot] %s" (apply #'format format args)))
+  (message "[eglot] %s" (substitute-quotes (apply #'format format args))))
 
 (defun eglot--warn (format &rest args)
   "Warning message with FORMAT and ARGS."
@@ -3704,8 +3704,8 @@ eglot-rename
   "Rename the current symbol to NEWNAME."
   (interactive
    (list (read-from-minibuffer
-          (format "Rename `%s' to: " (or (thing-at-point 'symbol t)
-                                         "unknown symbol"))
+          (format-prompt "Rename `%s' to" nil (or (thing-at-point 'symbol t)
+                                                  "unknown symbol"))
           nil nil nil nil
           (symbol-name (symbol-at-point)))))
   (eglot-server-capable-or-lose :renameProvider)
-- 
2.46.2