GNU logs - #65736, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#65736: 30.0.50; Extending the use of format-prompt
Resent-From: Stephen Berman <stephen.berman@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 04 Sep 2023 16:32:01 +0000
Resent-Message-ID: <handler.65736.B.169384510228469 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 65736
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 65736 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.169384510228469
          (code B ref -1); Mon, 04 Sep 2023 16:32:01 +0000
Received: (at submit) by debbugs.gnu.org; 4 Sep 2023 16:31:42 +0000
Received: from localhost ([127.0.0.1]:52417 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qdCUH-0007P6-E6
	for submit <at> debbugs.gnu.org; Mon, 04 Sep 2023 12:31:42 -0400
Received: from lists.gnu.org ([2001:470:142::17]:44372)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stephen.berman@HIDDEN>) id 1qdCUB-0007Op-CZ
 for submit <at> debbugs.gnu.org; Mon, 04 Sep 2023 12:31:39 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <stephen.berman@HIDDEN>)
 id 1qdCU6-0007pP-0T
 for bug-gnu-emacs@HIDDEN; Mon, 04 Sep 2023 12:31:30 -0400
Received: from mout.gmx.net ([212.227.17.20])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <stephen.berman@HIDDEN>)
 id 1qdCU2-00037Z-Vv
 for bug-gnu-emacs@HIDDEN; Mon, 04 Sep 2023 12:31:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=s31663417; t=1693845084; x=1694449884; i=stephen.berman@HIDDEN;
 bh=RRfq8xAqfOJVDXDL0/eypltsZFtOho9IPmI7VDW/Akw=;
 h=X-UI-Sender-Class:From:To:Subject:Date;
 b=oh9o1Nnu7Sxuenb1jjgNYO8QsO2XFO6ONNJ1+N2zhhQQgH7XOAYSu129WFecZplBwUTPk5D
 88vVjcqKQd6OAUQwXnaUg/1JzvTLsEjT/lAi1cPRXYJrhi+MmFSFiIddY3vUCRGS7x9S//ckf
 WWb+3KaOlgHzYIBmYH/Nd5NfFz5uTFuLZkf8GFMvHVJf7r8f8lR76qFA5Gep0hvdCKUFponMc
 Ixc5mF1ArmviivIxnTjke5F6sgu0aUS4SyRRXf7+ZmBJcp70Tcn7+EDUxJUXTzAw17OweZhuy
 NrVnFOc4Iqtv6tRd2Z6T22rif9FL5rqgIqNV9T5vLWzfoTfLyJAg==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from strobelfssd ([94.134.196.62]) by mail.gmx.net (mrgmx104
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mn2aN-1ptzmF0SsZ-00k4Ua for
 <bug-gnu-emacs@HIDDEN>; Mon, 04 Sep 2023 18:31:24 +0200
From: Stephen Berman <stephen.berman@HIDDEN>
Date: Mon, 04 Sep 2023 18:31:23 +0200
Message-ID: <87jzt599yc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:up5I1hfnKR4uF2j1XayZdwvB6JhfyfRgIVuTPRJQniacMmMHyan
 /gz9pFfXlivQzdtXdZz199mETokNw06PARMxsOl6IqYihIhjX0YMmxm/6hL2iPCH1RdXc23
 NtxFSNwxUcWKUIssO21/Uxyy/763VMM91Clx/9m6sqKS0yOe/dFEUuNavtYST3dxjrSDSRM
 eix/mbrxzKugU9i1F9vsg==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:+T76QsfvqQQ=;bu7WDe4JITVI3Sv3S38+96Sz3vm
 dGinps+8VghIS6oDHU3XxTvHXaDmWSBIDsBv6kwsKMQhxEdsd6Pt1d+rabS9XWWPQi30qn9b9
 4S81CcbrswwlmDzRFeWi+vrFkPdsa4nlOzt3qPdEoutQ90UwX16nND3gCi3f+P7a8dNQlmWIr
 VXmI+oHPEQ2I4UvunQFdLZrbjNdjq9zhZldirLXdH4+/GrRrU0h839NHU3HN1wDLB19Oo7/BB
 gWSy2mSmISF1QMC6v7AJ6W4jN3snEprUUb+FbOJT6nxPsmZNOSOWBdPztEx3+eOLjFXM5pnWs
 CeTfd2tXBGjL0c5K8BPWvLSvX1O5Sum0jHn4TNVxgeeM9TMVIN3z5qab0/7ekmBkTJT8tT9o3
 xLAOOfp5ZngriBGDpcAZ2WCUEGku5uubx6FPbema72tmeUZPxexb+fqw2FUS3jIlWIyqEW4QO
 N9gTa9SOo9hh5dY2e+STH41dbVvwXn0AJJu9EQn7XNwFv2aK9BFN3rvgdhCF8lcdOfE07a5QH
 qQ/w3z1nDrD/niYJUBkZSPODZUIBCb5GO7XW6ivns7yRVDnjq1wnK5BcRwsE8/6IUmd5GmKwP
 iJOWFBf2ctZJPFXhFdTswiLlyUmfeJjQH21GDzQBayOhsnKYGF9l7YQuf3+9A32QHePLZgmLL
 CoE1gc2SRK2g/bCrxO08ljYo5GgOtpUCyLxKsZEJjESvrPracA+RZHeX03UXuuefZZ6diStfj
 zwYEnCIg+U5Np7HL+qnTk9QoxmshFafONEbkkEkJPZfsLvQyVsVvXi35HVhm0nn/Ec+3J9CtC
 rScIQmY4HElrVo8oHeyjOVt5i4oz1FzUWfsj+aGzu5fNFiDs3X52cVlWutz23YigkJi6EBEgV
 woweOSlXNKijmY4xGtcinuIhKzVXF7S3P0wa5IFmB51AsdnQplBbbFTTGC/RnTmkVCU0ntZsq
 JtKzYnfZ+OF+qQ1eldyZC8KZn7I=
Received-SPF: pass client-ip=212.227.17.20;
 envelope-from=stephen.berman@HIDDEN; helo=mout.gmx.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

0. emacs -Q
1. Invoke read-buffer with a prompt containg grave-style quoting and
   with no default buffer argument, e.g.:
   M-: (read-buffer "Enter `buffer': ")
=3D> This displays the prompt in the minibuffer with grave-style quoting,
   i.e. as it appears in the invocation.
2. Repeat step 1 but add a default buffer argument, e.g.:
   M-: (read-buffer "Enter `buffer': " "*scratch*")
=3D> This displays the prompt in the minibuffer with curve-style quoting:
   Enter =E2=80=98buffer=E2=80=99 (default *scratch*):=20=20

The different appearances of the prompt with and without the presence of
a default argument is due to commit 50512e36c7, which passes the prompt
string to format-prompt when read-buffer has a non-nil default argument
DEF, but not when DEF is nil.  (The purpose of that commit was to
replace occurrences of prompts containing the string "(default %s)" by
invocations of the then recently introduced function format-prompt; the
fact that this function also calls substitute-command-keys was not a
concern for that commit and its effect was presumably for that reason
overlooked.)

I think the simplest fix is to pass PROMPT to format-prompt regardless
of the presence of a default argument of read-buffer, as in the first
attached patch.

But having substitute-command-keys always apply to the prompt string of
read-buffer raises the question whether it should apply more generally
to prompt strings.  In fact, commit 50512e36c7 did change numerous
mostly mode-specific prompts in several Lisp libraries to pass the
prompt to format-prompt, but in almost all cases those prompts are fixed
strings where applying substitute-command-keys makes no difference.  But
with read-buffer the prompt string is provided by the caller, so its
appearance could be affected by substitute-command-keys.

By default, read-buffer calls (in C) completing-read, which by default
calls read-from-minibuffer, and indeed most, if not all, other functions
that prompt for minibuffer input end up calling read-from-minibuffer.
So passing the prompt string to format-prompt in read-from-minibuffer,
as in the second attached patch (which should be applied instead of the
first patch), would achieve a higher degree of consistency and
simplicity in Emacs in the handling of prompts for minibuffer input, at
least by default.  (With functions that accept a user-defined function,
like read-buffer-function with read-buffer, it would be up to the user
to decide whether or not to use format-prompt, if the function does not
invoke read-from-minibuffer.)

If this change (the second patch) is accepted, it will probably require
adjustments in the Emacs code base, e.g. to avoid double invocations of
format-prompt.  This would partly undo the changes made in 50512e36c7.
I'd be willing to make the needed adjustments in Emacs.

Steve Berman


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment
Content-Description: read-buffer patch
Content-Transfer-Encoding: quoted-printable

diff --git a/src/minibuf.c b/src/minibuf.c
index 58adde1bf66..a1cbf4747f5 100644
=2D-- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1502,34 +1502,30 @@ DEFUN ("read-buffer", Fread_buffer, Sread_buffer, =
1, 4, 0,
   specbind (Qcompletion_ignore_case,
 	    read_buffer_completion_ignore_case ? Qt : Qnil);

-  if (NILP (Vread_buffer_function))
-    {
-      if (!NILP (def))
-	{
-	  /* A default value was provided: we must change PROMPT,
-	     editing the default value in before the colon.  To achieve
-	     this, we replace PROMPT with a substring that doesn't
-	     contain the terminal space and colon (if present).  They
-	     are then added back using Fformat.  */
+  /* For backward compatibility we accept prompt strings ending with a
+     colon and a space, but we have to delete them, if present, before
+     passing PROMPT to `format-prompt', which automatically appends
+     these characters to PROMPT.  */

-	  if (STRINGP (prompt))
-	    {
-	      s =3D SSDATA (prompt);
-	      len =3D SBYTES (prompt);
-	      if (len >=3D 2 && s[len - 2] =3D=3D ':' && s[len - 1] =3D=3D ' ')
-		len =3D len - 2;
-	      else if (len >=3D 1 && (s[len - 1] =3D=3D ':' || s[len - 1] =3D=3D=
 ' '))
-		len--;
-
-	      prompt =3D make_specified_string (s, -1, len,
-					      STRING_MULTIBYTE (prompt));
-	    }
+  if (STRINGP (prompt))
+    {
+      s =3D SSDATA (prompt);
+      len =3D SBYTES (prompt);
+      if (len >=3D 2 && s[len - 2] =3D=3D ':' && s[len - 1] =3D=3D ' ')
+	len =3D len - 2;
+      else if (len >=3D 1 && (s[len - 1] =3D=3D ':' || s[len - 1] =3D=3D =
' '))
+	len--;
+
+      prompt =3D make_specified_string (s, -1, len,
+				      STRING_MULTIBYTE (prompt));
+    }

-	  prompt =3D CALLN (Ffuncall, intern("format-prompt"),
-			  prompt,
-			  CONSP (def) ? XCAR (def) : def);
-	}
+  prompt =3D CALLN (Ffuncall, intern("format-prompt"),
+		  prompt,
+		  CONSP (def) ? XCAR (def) : def);

+  if (NILP (Vread_buffer_function))
+    {
       result =3D Fcompleting_read (prompt, intern ("internal-complete-buf=
fer"),
 				 predicate, require_match, Qnil,
 				 Qbuffer_name_history, def, Qnil);

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment
Content-Description: read-from-minibuffer patch
Content-Transfer-Encoding: quoted-printable

diff --git a/src/minibuf.c b/src/minibuf.c
index 58adde1bf66..4318cab04cb 100644
=2D-- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1343,10 +1343,34 @@ DEFUN ("read-from-minibuffer", Fread_from_minibuff=
er,
   (Lisp_Object prompt, Lisp_Object initial_contents, Lisp_Object keymap, =
Lisp_Object read, Lisp_Object hist, Lisp_Object default_value, Lisp_Object=
 inherit_input_method)
 {
   Lisp_Object histvar, histpos, val;
+  char *s;
+  ptrdiff_t len;

   barf_if_interaction_inhibited ();

   CHECK_STRING (prompt);
+
+  /* For backward compatibility we accept prompt strings ending with a
+     colon and a space, but we have to delete them, if present, before
+     passing PROMPT to `format-prompt', which automatically appends
+     these characters to PROMPT.  */
+
+  if (STRINGP (prompt))
+    {
+      s =3D SSDATA (prompt);
+      len =3D SBYTES (prompt);
+      if (len >=3D 2 && s[len - 2] =3D=3D ':' && s[len - 1] =3D=3D ' ')
+	len =3D len - 2;
+      else if (len >=3D 1 && (s[len - 1] =3D=3D ':' || s[len - 1] =3D=3D =
' '))
+	len--;
+
+      prompt =3D make_specified_string (s, -1, len,
+				      STRING_MULTIBYTE (prompt));
+    }
+
+  prompt =3D CALLN (Ffuncall, intern("format-prompt"), prompt,
+		  CONSP (default_value) ? XCAR (default_value) : default_value);
+
   if (NILP (keymap))
     keymap =3D Vminibuffer_local_map;
   else
@@ -1473,8 +1497,7 @@ DEFUN ("read-variable", Fread_variable, Sread_variab=
le, 1, 2, 0,

 DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 4, 0,
        doc: /* Read the name of a buffer and return it as a string.
-Prompt with PROMPT, which should be a string ending with a colon and a sp=
ace.
-Provides completion on buffer names the user types.
+Prompt with string PROMPT.  Provides completion on buffer names the user =
types.
 Optional second arg DEF is value to return if user enters an empty line,
  instead of that empty string.
  If DEF is a list of default values, return its first element.
@@ -1492,8 +1515,6 @@ DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1,=
 4, 0,
    Lisp_Object predicate)
 {
   Lisp_Object result;
-  char *s;
-  ptrdiff_t len;
   specpdl_ref count =3D SPECPDL_INDEX ();

   if (BUFFERP (def))
@@ -1503,37 +1524,9 @@ DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1=
, 4, 0,
 	    read_buffer_completion_ignore_case ? Qt : Qnil);

   if (NILP (Vread_buffer_function))
-    {
-      if (!NILP (def))
-	{
-	  /* A default value was provided: we must change PROMPT,
-	     editing the default value in before the colon.  To achieve
-	     this, we replace PROMPT with a substring that doesn't
-	     contain the terminal space and colon (if present).  They
-	     are then added back using Fformat.  */
-
-	  if (STRINGP (prompt))
-	    {
-	      s =3D SSDATA (prompt);
-	      len =3D SBYTES (prompt);
-	      if (len >=3D 2 && s[len - 2] =3D=3D ':' && s[len - 1] =3D=3D ' ')
-		len =3D len - 2;
-	      else if (len >=3D 1 && (s[len - 1] =3D=3D ':' || s[len - 1] =3D=3D=
 ' '))
-		len--;
-
-	      prompt =3D make_specified_string (s, -1, len,
-					      STRING_MULTIBYTE (prompt));
-	    }
-
-	  prompt =3D CALLN (Ffuncall, intern("format-prompt"),
-			  prompt,
-			  CONSP (def) ? XCAR (def) : def);
-	}
-
-      result =3D Fcompleting_read (prompt, intern ("internal-complete-buf=
fer"),
-				 predicate, require_match, Qnil,
-				 Qbuffer_name_history, def, Qnil);
-    }
+    result =3D Fcompleting_read (prompt, intern ("internal-complete-buffe=
r"),
+			       predicate, require_match, Qnil,
+			       Qbuffer_name_history, def, Qnil);
   else
     result =3D (NILP (predicate)
 	      /* Partial backward compatibility for older read_buffer_functions
@@ -1978,7 +1971,7 @@ DEFUN ("all-completions", Fall_completions, Sall_com=
pletions, 2, 4, 0,
 =0C
 DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0,
        doc: /* Read a string in the minibuffer, with completion.
-PROMPT is a string to prompt with; normally it ends in a colon and a spac=
e.
+PROMPT is a string to prompt with.
 COLLECTION can be a list of strings, an alist, an obarray or a hash table=
.
 COLLECTION can also be a function to do the completion itself.
 PREDICATE limits completion to a subset of COLLECTION.

--=-=-=--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Stephen Berman <stephen.berman@HIDDEN>
Subject: bug#65736: Acknowledgement (30.0.50; Extending the use of
 format-prompt)
Message-ID: <handler.65736.B.169384510228469.ack <at> debbugs.gnu.org>
References: <87jzt599yc.fsf@HIDDEN>
X-Gnu-PR-Message: ack 65736
X-Gnu-PR-Package: emacs
Reply-To: 65736 <at> debbugs.gnu.org
Date: Mon, 04 Sep 2023 16:32:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 65736 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
65736: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D65736
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 10 Sep 2023 07:47:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 10 03:47:31 2023
Received: from localhost ([127.0.0.1]:48955 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qfFAJ-00074B-Gi
	for submit <at> debbugs.gnu.org; Sun, 10 Sep 2023 03:47:31 -0400
Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:47241)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1qfFAH-00073u-KZ
 for control <at> debbugs.gnu.org; Sun, 10 Sep 2023 03:47:30 -0400
Received: by mail-lf1-x129.google.com with SMTP id
 2adb3069b0e04-502b0d23f28so839673e87.2
 for <control <at> debbugs.gnu.org>; Sun, 10 Sep 2023 00:47:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1694332040; x=1694936840; darn=debbugs.gnu.org;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=PYSPNginWFFJ2z2ylkYImsUe4uYTnHpK+llmSpCh0PM=;
 b=I434zidf7ehC3XudDfRvfeVT9++AzUPQU2ny9ukbn7UFTtpMbIfXzn62ps+LpDyG5v
 JKN9jg+X2IRTfmh6gzeLcVsWi4mj6yvlH22JCa/ETcW/MfSJ9XEx3qQ9KGrBINfxUAyD
 c/iM72udG9PJvS11agw5w5/wuX9+aai1wMLBv9QtETckfk8sFFrzTbf+iDbq/6rY473Z
 F31Cq5y9YD4Ra9T2Jvx8PuXW8MQy/1gBxzKW+moZzdlwx+hdFyZ3JS05a1omjkoAIQva
 Lqhrqo4ulpGI1JEYnQmtUSsUBOt9bPOu7M9ckkkKmt9b4hw2ZPkGv/aiMcNaLl1TUYhg
 tVIQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1694332040; x=1694936840;
 h=to:subject:message-id:date:mime-version:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=PYSPNginWFFJ2z2ylkYImsUe4uYTnHpK+llmSpCh0PM=;
 b=DBcJLT9wDgMU+8xJN1VhZWB3N7VHL1W0zRXKGR7i7T5wQXYbfSlccxoBSkDbAC8/yt
 jNKIDXbDIZaIb8F7r+wmfry30lZyEyz3jfs+GZtOD/qn/Kqsp69FX3zoZ/nTtqeDy35W
 F+4CGpx3ko08KQJab6O7i1the02zf13nFdKkt7ohBPHP3G15l2Hqt9xnBcVtMClBWK0N
 eh4idJZYjRvFFlFGpyPA4Vca8cHsmTCtX7B4B7cAq6H+Cqk9QvM2GE2aDL5nG74Uz3P9
 er4yEpwj24caM2ZLdzcBaZFbzwfvE8iUTnxIydlZjOEGtjiAYlwlbEDRvcGwdvIqgMgw
 vhZA==
X-Gm-Message-State: AOJu0YxQlPQ0XxNsRnf6vQfx9W9mNey65SWgisfbsdc1Qe4SgMtjbV1a
 Kq18madUUI6QVwlLLnYv4uWgKIVp90EQnQwaUYdWshpd
X-Google-Smtp-Source: AGHT+IElN6aksu1oK+yBaOfqL3T++fuQbCJa6Iw8HI/erXkT5w1r3Hgv6937B2S/s2A/083p4bMkYgFSHLs14VjzWMk=
X-Received: by 2002:ac2:58cc:0:b0:4fb:c657:3376 with SMTP id
 u12-20020ac258cc000000b004fbc6573376mr4823773lfo.29.1694332040135; Sun, 10
 Sep 2023 00:47:20 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sun, 10 Sep 2023 00:47:19 -0700
From: Stefan Kangas <stefankangas@HIDDEN>
MIME-Version: 1.0
Date: Sun, 10 Sep 2023 00:47:19 -0700
Message-ID: <CADwFkmmShU7uo6hpVOrFU61Y1D3A_rd-nhzEAgVtLRHswqRcbg@HIDDEN>
Subject: control message for bug #65736
To: control <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 65736 wishlist
quit




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 10 Sep 2023 07:49:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 10 03:49:27 2023
Received: from localhost ([127.0.0.1]:48973 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qfFCB-0007CY-BA
	for submit <at> debbugs.gnu.org; Sun, 10 Sep 2023 03:49:27 -0400
Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]:51405)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1qfFC9-0007CI-74
 for control <at> debbugs.gnu.org; Sun, 10 Sep 2023 03:49:25 -0400
Received: by mail-lf1-x12d.google.com with SMTP id
 2adb3069b0e04-5008d16cc36so5732605e87.2
 for <control <at> debbugs.gnu.org>; Sun, 10 Sep 2023 00:49:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1694332156; x=1694936956; darn=debbugs.gnu.org;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=HdQ+2A7z/deU2aiMQuirsuWHIiLD5AcpAT4JfqBK/oI=;
 b=I/bnM0bcipeIOo/vjbQNdUE2R/9ZH0VG7JGNS4wWGmgKnpTEwJehVVkVMwrOkX93fC
 bVUkBe61yt5xeKe3JWAWe4xZXHMy5hldljohuv5gppifAlTEETk/lfS6v7Bk0rI7VMxq
 qW6tJ6lTXseclSi0zdLkEpXAx4f4NP6iIn9nHLO9Lx/rKEJ9kdE6iPKF2rZvMEd91rXv
 wDG9fp8JsWQ75FuaKO/0wX635qm/foE2Dtghf0zQnRDhAdvW0U/wMFU7ZlT47Cww5YII
 N6KQ9LkmAeviwXKl5GLIJYx3eXs5ZmRCOfEs6gi49qhqGC3v6JtV6F+FGQbaoevutRAQ
 3UZw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1694332156; x=1694936956;
 h=to:subject:message-id:date:mime-version:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=HdQ+2A7z/deU2aiMQuirsuWHIiLD5AcpAT4JfqBK/oI=;
 b=rPe3CSwGyM6FlGnzEb3lMjEQPiZH1o6qj1VVrHtpOZZHluFu9n5QJDtqQzQ75dU6uZ
 2nxigCs8gEyJHV1R5tTpLXjoDP++RTSufYPAmmJ0kmW/05zRqX1uu6OTQGNeWBYeZqA+
 fyOIuv6HB144VMVeigww+PZrgJP9f8cWREgH223K61O73GWZIStl2Vak1VCRrLmGzblD
 BrhnfJbA+HswylU9rvioIRVbpcJ474VvF36zdNP01ZbCe34sS86QOKwV0+lhnIupZ46R
 9x22NW+OKqVv1L/MHCrQSFhAKSdj0TqCEJrDG2wfOblbORTYZpM6FzGeJXevgeV2fnEb
 +liQ==
X-Gm-Message-State: AOJu0Yz1UkfZPDvWt4oG40Jt18yfzX4SmFbeviGTWo9FgKfFnrC4vlxN
 kQv3WOlRf2474B3VIJi2UgZCv43Gjl94ZFYpS9DSDadx
X-Google-Smtp-Source: AGHT+IHbAjNx9nkiVGmGG10+uu7t7JjHmffIGyem98b5RcVuRznF6hNN+sV+kzdcDC4lY0tfqxDA6id+kZO49N3i4+A=
X-Received: by 2002:a05:6512:2507:b0:502:9fce:b6e3 with SMTP id
 be7-20020a056512250700b005029fceb6e3mr4803175lfb.7.1694332155683; Sun, 10 Sep
 2023 00:49:15 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sun, 10 Sep 2023 00:49:15 -0700
From: Stefan Kangas <stefankangas@HIDDEN>
MIME-Version: 1.0
Date: Sun, 10 Sep 2023 00:49:15 -0700
Message-ID: <CADwFkmmxbfkGy4p3ohdFuWn6ALoZvLNtgURq-SuQcp6F_XBHrA@HIDDEN>
Subject: control message for bug #65736
To: control <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

tags 65736 + patch
quit




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#65736: 30.0.50; Extending the use of format-prompt
Resent-From: Stefan Kangas <stefankangas@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 23 Feb 2025 01:27:02 +0000
Resent-Message-ID: <handler.65736.B65736.174027398131833 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 65736
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Stephen Berman <stephen.berman@HIDDEN>
Cc: 65736 <at> debbugs.gnu.org
Received: via spool by 65736-submit <at> debbugs.gnu.org id=B65736.174027398131833
          (code B ref 65736); Sun, 23 Feb 2025 01:27:02 +0000
Received: (at 65736) by debbugs.gnu.org; 23 Feb 2025 01:26:21 +0000
Received: from localhost ([127.0.0.1]:58162 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tm0lA-0008HM-DG
	for submit <at> debbugs.gnu.org; Sat, 22 Feb 2025 20:26:20 -0500
Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:56429)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tm0l8-0008H4-3T
 for 65736 <at> debbugs.gnu.org; Sat, 22 Feb 2025 20:26:18 -0500
Received: by mail-ed1-x535.google.com with SMTP id
 4fb4d7f45d1cf-5e02eba02e8so4476930a12.0
 for <65736 <at> debbugs.gnu.org>; Sat, 22 Feb 2025 17:26:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740273972; x=1740878772; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=+g5gIGkrGUfpE7Lk4qZRdL1J5FZPucdNw+Jqnnt4tJE=;
 b=DRYaKy3d8ZlULLIwF2ULhKgVviQdh1LJC2txOazT8WeWfR4pcMRk8z5BZNc/L+I/Jx
 3UHIn/d8bHgBtl4MbsIezT5hRY8Px6WFgfl4Vs4yzUD20XoJ3JrVCumY2qRuh8KCRRV8
 78KYCB9dyqNazaVVGOm1b0pFYZQ9j5+DgmlmTGJhxJ6UrbYTEWnqguoQewrglty2N9+S
 /GF2q93D20MEFmQm+Pj5nRxFKmytk6kJqCHc2CnzhSIFetktAOzeSTDJGTrz5gKTJIVH
 xT7qfOHqXDd8DZMQpyBQ1NegzpqbYB0CZEkvDVc+Bb51s+kpC6DXkjT0J+J78KFy4e+q
 PZUQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740273972; x=1740878772;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=+g5gIGkrGUfpE7Lk4qZRdL1J5FZPucdNw+Jqnnt4tJE=;
 b=raME6xIKhOX0xuprSQkJ2ucOQ0lq2AAaqR+aYcKMGo7i2KgdiRPmZYQidiKClb5DU0
 bn+R6QlU6TqKhlnCg9rFS51f9UJugnbPFclgXG+QNCGgHfd32nUzk3Ab1dgYpTLwI5Dc
 1oGc5VxfvoLViq1Zqe1DWe+u2G8Mk/yRef5CT4nU6ZM04VyhNUEs5mHfRsEpzYeD9b3F
 LOSYxYHfmL0QqmA5ML50Y1cphbU4MXXI+HPBvdzvSdXAMOX417wVBy/ZRvMDAvmn3smt
 6OQOlQ/QTkbxT3+ode95Yx7sBK+OFtLjl2oj0pOxJofjeYVSJ4f/yxmPdk9/0TtC7nYQ
 pLFg==
X-Gm-Message-State: AOJu0Yzldfhjk9w+mBg1h+aUIct40qiiPi+TeLkbomQoy61NR1wc9Ii9
 Hr9Or2oLFXUvxCzBTinoq8Pz2815hW7XP92qyxlwq5gPKq+SvEQUvSGiuUNW4J0E43k7pR3lBGg
 gTJxJ2Uz6OHbTWR7rSCIvHZb3G0vASwG61zKyfw==
X-Gm-Gg: ASbGncsRwPfYjE5fO3NEPIIjojZQ0IcykbqxKhnLSYBCmw9DeyDv6jEh7rzQV4Ti6zt
 1ifFqUCJN0FVWizosrfJkmFcX4wEx4Sfyg939aGeNS3+eQEZOP/nu5tG33347KhGgETyxKuyufX
 hrfKlA8gDw
X-Google-Smtp-Source: AGHT+IG2wNY41A9FRMP814kWFQyfAy23spOkVmoxhcTZKP6J2pg8BwAj6lHAqHJJudkkSXElxgBZ0FydBomcz7h+w5E=
X-Received: by 2002:a05:6402:3554:b0:5dc:5a34:1296 with SMTP id
 4fb4d7f45d1cf-5e0b70ef77dmr8286461a12.16.1740273971726; Sat, 22 Feb 2025
 17:26:11 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sun, 23 Feb 2025 01:26:11 +0000
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <87jzt599yc.fsf@HIDDEN>
References: <87jzt599yc.fsf@HIDDEN>
MIME-Version: 1.0
Date: Sun, 23 Feb 2025 01:26:11 +0000
X-Gm-Features: AWEUYZkrE6PiTLGucXpDUyZphCpK9YIYMWDufCbBOsh-tGhSj21LrXLMMNCvDzE
Message-ID: <CADwFkm=H6yNPjZ+JC1qy89i_Sf=Xk-6C04c+XAsJMZ5_qObjUw@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Stephen Berman <stephen.berman@HIDDEN> writes:

> 0. emacs -Q
> 1. Invoke read-buffer with a prompt containg grave-style quoting and
>    with no default buffer argument, e.g.:
>    M-: (read-buffer "Enter `buffer': ")
> =3D> This displays the prompt in the minibuffer with grave-style quoting,
>    i.e. as it appears in the invocation.
> 2. Repeat step 1 but add a default buffer argument, e.g.:
>    M-: (read-buffer "Enter `buffer': " "*scratch*")
> =3D> This displays the prompt in the minibuffer with curve-style quoting:
>    Enter =E2=80=98buffer=E2=80=99 (default *scratch*):
>
> The different appearances of the prompt with and without the presence of
> a default argument is due to commit 50512e36c7, which passes the prompt
> string to format-prompt when read-buffer has a non-nil default argument
> DEF, but not when DEF is nil.  (The purpose of that commit was to
> replace occurrences of prompts containing the string "(default %s)" by
> invocations of the then recently introduced function format-prompt; the
> fact that this function also calls substitute-command-keys was not a
> concern for that commit and its effect was presumably for that reason
> overlooked.)
>
> I think the simplest fix is to pass PROMPT to format-prompt regardless
> of the presence of a default argument of read-buffer, as in the first
> attached patch.
>
> But having substitute-command-keys always apply to the prompt string of
> read-buffer raises the question whether it should apply more generally
> to prompt strings.  In fact, commit 50512e36c7 did change numerous
> mostly mode-specific prompts in several Lisp libraries to pass the
> prompt to format-prompt, but in almost all cases those prompts are fixed
> strings where applying substitute-command-keys makes no difference.  But
> with read-buffer the prompt string is provided by the caller, so its
> appearance could be affected by substitute-command-keys.
>
> By default, read-buffer calls (in C) completing-read, which by default
> calls read-from-minibuffer, and indeed most, if not all, other functions
> that prompt for minibuffer input end up calling read-from-minibuffer.
> So passing the prompt string to format-prompt in read-from-minibuffer,
> as in the second attached patch (which should be applied instead of the
> first patch), would achieve a higher degree of consistency and
> simplicity in Emacs in the handling of prompts for minibuffer input, at
> least by default.  (With functions that accept a user-defined function,
> like read-buffer-function with read-buffer, it would be up to the user
> to decide whether or not to use format-prompt, if the function does not
> invoke read-from-minibuffer.)
>
> If this change (the second patch) is accepted, it will probably require
> adjustments in the Emacs code base, e.g. to avoid double invocations of
> format-prompt.  This would partly undo the changes made in 50512e36c7.
> I'd be willing to make the needed adjustments in Emacs.

(Sorry for the long delay in replying here.)

I think what you write here makes sense.  Could you please resend the
patches as formatted by something like

    git format-patch -1

and with a proper ChangeLog message as per CONTRIBUTE?

I think that would facilitate reviewing the patches, especially the
second one which seems to be a change in behavior that we would need to
agree on.

Thanks in advance.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#65736: 30.0.50; Extending the use of format-prompt
Resent-From: Stephen Berman <stephen.berman@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 25 Feb 2025 23:20:02 +0000
Resent-Message-ID: <handler.65736.B65736.17405255792042 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 65736
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Stefan Kangas <stefankangas@HIDDEN>
Cc: 65736 <at> debbugs.gnu.org
Received: via spool by 65736-submit <at> debbugs.gnu.org id=B65736.17405255792042
          (code B ref 65736); Tue, 25 Feb 2025 23:20:02 +0000
Received: (at 65736) by debbugs.gnu.org; 25 Feb 2025 23:19:39 +0000
Received: from localhost ([127.0.0.1]:48975 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tn4DC-0000Wr-IP
	for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 18:19:39 -0500
Received: from mout.gmx.net ([212.227.15.15]:55929)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <stephen.berman@HIDDEN>)
 id 1tn4D9-0000WZ-IB
 for 65736 <at> debbugs.gnu.org; Tue, 25 Feb 2025 18:19:36 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net;
 s=s31663417; t=1740525568; x=1741130368; i=stephen.berman@HIDDEN;
 bh=ecCrNVHlgS1dUioIGokc//E6bJw/9mO12PF6DSWVrjI=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc:
 content-transfer-encoding:content-type:date:from:message-id:
 mime-version:reply-to:subject:to;
 b=aw12MdNAMddsXNp/+i/F1GJBDm0pkoR7QA4nWtlUzc0LiajUzdyPtFlZ2CksLL58
 YP7I9vpT8TFHq5p9So72ApdiyeNWkWwXiMCpmVqBcRV8gxPD23/rYFYW+Qlr6KBeB
 yZm1fMjZzstQXdDpUSVKlt+aFSfW9VfwpkMJPlLC65fmS5R1w5tn/Z4TL6sC0OoxK
 naY0Bf1YtrfXi68/7QnWBWvsQKIshDK/MwvzDrLpezbsFnTpbLh2C0I8X3OSe2NJC
 Pk6i03v5BBdzNZM8gkH0u2u2EzFh0Z3t1ZNY9h1Q0Cs3FH/UULvxOC0jUK/vmdcy1
 FQkSuOrDQ2iEcYuvzg==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from strobelfssd ([88.130.50.54]) by mail.gmx.net (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M7Jza-1tfMa42fZE-00A55i; Wed, 26
 Feb 2025 00:19:28 +0100
From: Stephen Berman <stephen.berman@HIDDEN>
In-Reply-To: <CADwFkm=H6yNPjZ+JC1qy89i_Sf=Xk-6C04c+XAsJMZ5_qObjUw@HIDDEN>
References: <87jzt599yc.fsf@HIDDEN>
 <CADwFkm=H6yNPjZ+JC1qy89i_Sf=Xk-6C04c+XAsJMZ5_qObjUw@HIDDEN>
Date: Wed, 26 Feb 2025 00:19:26 +0100
Message-ID: <87jz9dr4sh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K1:XQR0x74/F6nbAcJ9tZWdZ6fC1QPYPKnGoW1xcxu2QIdmKAnYGjM
 m25TvtyuJ0vauI0ZCdJux1HTu6qS82JYAgRJCdg/4QbyPexO87AdPZQOoJZU3itQbIiuAJG
 Xwdhf9s6F/l0Nh9MdCXRsQBdP4Lo0kM5Q4Y9z+2XSF/388tf2rWkYpIzsiIdQRx7S+XFbus
 A667QeTrwohwKDL+gKINw==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:HQOD+0fFA5o=;68fYAaD/phjD7AX5O9CfHwNa72p
 gljrEbg0+/6wCkQdsGvwyh+a1Y5hVMdLghCQHRJ967KEqMDRAkdZAEnRZJpsexFB8CzM99W5Z
 etjSLiq4x9vq/+5IeHty7+UFBrXs40sH4PxxoHLcqoFP6CFB0UMoNvw6nP3h5gmbgJAnr33xc
 AsiFyccUGFlOl+Pcm0z8Nfc1GiXLCuPQqzJvEs0Zb2wqhaIkF2SvbQzkkOWNUKeUld3XOUeV5
 Qjwo1z7vrUiU+G7tznxnK8L46E03VTqKkP7aELGwQVHmeYu1JEiHkK5pp3DU24sHl8zAWKmGz
 TSLmGh9a+bA8WLIPkl4WZv1BbDGyEdYjyYQgdC0TbfRja9pN4T996OJZchoKj69ZbeBxDM67u
 IrMy7IAZf19foOVA9UjEzqU0NhxNmzoSJzLYies4hQpDGf2YbSG+Li0xK26ivi5iPKT0MOFZi
 d5tpIiWU8MpPLWtw8ksrEXQ9ZTMS+Zq37IiBJ+J136BjmM3GL6ozamaWzkjFYHPS8nlWwDfOM
 RXRqi/0yr3lc2J43YdT037tNirV5/WhK33fFzUg22e7H9K+NPGCnnAMmrPWQ9ojeAO8aUcb7r
 XHw7qgoGp34tNjlvjE2qw/qOKoNL2nFobx8L1VkM1WDwO+OvKrVkh208NGwPS0ISXefHqRz1K
 KSn++uKsZil8MrnoAPmbI5E4slsGntQzSofXky3rg2z2LR0FqCR+7AjG7MIooxenyVQDqyWB0
 pfat6xZDNt1YqsGjKG7LrsCND3I6/yukKRoiuXiA/N1zYlrH6VKYJ+kkbAqEz6uIbfkEOfJxl
 kPD4kEfhqI4mMEriwzy2uVxM82sUE22U9ZGBAPqG1V+pKcAmWBZdE6hfqobdIfF0pjiB6q/te
 pLIdefjMPCKrJ4daBdtx4BgMPUxdCT3Qd/NwUXnb7pD9atvysOgvHIrwAt18gLlNdIc9OmUei
 FfRIurvvd+bstTvu1CQPKC0QPOI4ndLyFkRMgimPfVQlHR8MTdqrzyHqU9q28narStQ+srhdK
 NrdL2wP1Jg+ssPhA5OgMiItrn2zGSWJqRgogpd46kgeLzrJHq+IeJRPxbhUrFA+v/oceMH9J4
 kbKW3vlr34b+lJ+OOwDv0WtUIUz4mnhjNtaxedInuTVprD+hDmQG7rM1Wqw8qZyfA1f2hS8T4
 cdTpRelfMbdq7zENf2xRMruzylFV58cKtDLpgwgcCPPOWvCn1IVWfIdlWAU8w5AJSvYx1tXk0
 GVUvUT6dwQVBYBlE50lNzddE7Vs/0cczF9+LckPjO3hpVMJNZVkrXewdRW2W7DPYAD+cv5Qx2
 4dWVYwIw4xBud+5IErOVFcjrfsYkpz9qz0qeUsOWg7b+8+8MFZK6xpbAPIlk1BhgO3G5xuLGQ
 uWSIIJzsyDYXzLlBzQDhPZ8ALlIIQUzO/LanTpfULZG760UrbDHtVS61zprt2QRgVSf3kuT+L
 NJm+CAA==
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On Sun, 23 Feb 2025 01:26:11 +0000 Stefan Kangas <stefankangas@HIDDEN> w=
rote:

> Stephen Berman <stephen.berman@HIDDEN> writes:
>
>> 0. emacs -Q
>> 1. Invoke read-buffer with a prompt containg grave-style quoting and
>>    with no default buffer argument, e.g.:
>>    M-: (read-buffer "Enter `buffer': ")
>> =3D> This displays the prompt in the minibuffer with grave-style quoting,
>>    i.e. as it appears in the invocation.
>> 2. Repeat step 1 but add a default buffer argument, e.g.:
>>    M-: (read-buffer "Enter `buffer': " "*scratch*")
>> =3D> This displays the prompt in the minibuffer with curve-style quoting:
>>    Enter =E2=80=98buffer=E2=80=99 (default *scratch*):
>>
>> The different appearances of the prompt with and without the presence of
>> a default argument is due to commit 50512e36c7, which passes the prompt
>> string to format-prompt when read-buffer has a non-nil default argument
>> DEF, but not when DEF is nil.  (The purpose of that commit was to
>> replace occurrences of prompts containing the string "(default %s)" by
>> invocations of the then recently introduced function format-prompt; the
>> fact that this function also calls substitute-command-keys was not a
>> concern for that commit and its effect was presumably for that reason
>> overlooked.)
>>
>> I think the simplest fix is to pass PROMPT to format-prompt regardless
>> of the presence of a default argument of read-buffer, as in the first
>> attached patch.
>>
>> But having substitute-command-keys always apply to the prompt string of
>> read-buffer raises the question whether it should apply more generally
>> to prompt strings.  In fact, commit 50512e36c7 did change numerous
>> mostly mode-specific prompts in several Lisp libraries to pass the
>> prompt to format-prompt, but in almost all cases those prompts are fixed
>> strings where applying substitute-command-keys makes no difference.  But
>> with read-buffer the prompt string is provided by the caller, so its
>> appearance could be affected by substitute-command-keys.
>>
>> By default, read-buffer calls (in C) completing-read, which by default
>> calls read-from-minibuffer, and indeed most, if not all, other functions
>> that prompt for minibuffer input end up calling read-from-minibuffer.
>> So passing the prompt string to format-prompt in read-from-minibuffer,
>> as in the second attached patch (which should be applied instead of the
>> first patch), would achieve a higher degree of consistency and
>> simplicity in Emacs in the handling of prompts for minibuffer input, at
>> least by default.  (With functions that accept a user-defined function,
>> like read-buffer-function with read-buffer, it would be up to the user
>> to decide whether or not to use format-prompt, if the function does not
>> invoke read-from-minibuffer.)
>>
>> If this change (the second patch) is accepted, it will probably require
>> adjustments in the Emacs code base, e.g. to avoid double invocations of
>> format-prompt.  This would partly undo the changes made in 50512e36c7.
>> I'd be willing to make the needed adjustments in Emacs.
>
> (Sorry for the long delay in replying here.)
>
> I think what you write here makes sense.  Could you please resend the
> patches as formatted by something like
>
>     git format-patch -1
>
> and with a proper ChangeLog message as per CONTRIBUTE?
>
> I think that would facilitate reviewing the patches, especially the
> second one which seems to be a change in behavior that we would need to
> agree on.

Last November there was a discussion on emacs-devel about read-number
(starting at
https://lists.gnu.org/archive/html/emacs-devel/2024-11/msg00216.html),
which uses read-from-minibuffer but also exceptionally has its own
nonstandard handling of the default value of the prompt string.  In that
thread I proposed a change to read-number that allows it to use
minibuffer-default-prompt-format (which format-prompt uses), but Eli
found that change too ad hoc and preferred to document recommending
against using format-prompt in read-number (and this was done in
emacs-30).  So I think the idea of making read-from-minibuffer use
format-prompt as in the second patch is not viable.  Is there still any
interest in just changing read-buffer as in the first patch?

Steve Berman





Last modified: Tue, 25 Feb 2025 23:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.