From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Philip Kaludercic <philipk@posteo.net>
Newsgroups: gmane.emacs.help
Subject: Re: completing-read depricated initial-input
Date: Fri, 24 Jun 2022 08:40:08 +0000
Message-ID: <87iloqqwt3.fsf@posteo.net>
References: <N54Fw5q--3-2@tutanota.com>
 <trinity-13948e17-827f-4e18-8aff-4d51f4a10713-1655815187077@3c-app-mailcom-bs15>
 <SJ0PR10MB54883E6463D50914DFE89CBEF3B39@SJ0PR10MB5488.namprd10.prod.outlook.com>
 <86r13hubaw.fsf_-_@gnu.org>
 <SJ0PR10MB5488CFA45C182CB8A2F2677BF3B39@SJ0PR10MB5488.namprd10.prod.outlook.com>
 <86letphfke.fsf_-_@gnu.org> <87bkuljsvz.fsf@yahoo.com>
 <86fsjvlrjo.fsf@gnu.org> <874k0bkco7.fsf@dataswamp.org>
 <87letnhhj3.fsf@gnu.org> <87zgi3itb7.fsf@dataswamp.org>
 <86a6a3zj4y.fsf@gnu.org> <87a6a3y3zu.fsf@gnus.org>
 <874k0bh2v4.fsf@gnu.org> <86tu8bxwrm.fsf@gnu.org>
 <87mte3wgq2.fsf@gmail.com> <86bkujm7l2.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="32331"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: Robert Pluim <rpluim@gmail.com>,  Tassilo Horn <tsdh@gnu.org>,  Lars
 Ingebrigtsen <larsi@gnus.org>,  help-gnu-emacs@gnu.org
To: Arash Esbati <arash@gnu.org>
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 24 10:41:51 2022
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1o4esx-0008BG-B0
	for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 24 Jun 2022 10:41:51 +0200
Original-Received: from localhost ([::1]:35026 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1o4esw-0007iA-4q
	for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 24 Jun 2022 04:41:50 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41916)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philipk@posteo.net>)
 id 1o4erQ-0007di-6R
 for help-gnu-emacs@gnu.org; Fri, 24 Jun 2022 04:40:22 -0400
Original-Received: from mout02.posteo.de ([185.67.36.66]:48005)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philipk@posteo.net>)
 id 1o4erN-0007LP-Cb
 for help-gnu-emacs@gnu.org; Fri, 24 Jun 2022 04:40:15 -0400
Original-Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 54E1124010A
 for <help-gnu-emacs@gnu.org>; Fri, 24 Jun 2022 10:40:11 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1656060011; bh=Y7TDuxefXgtk6+DgMv/UMdUXLDIj7lbjBNnNxhz8Eac=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=mo4fHcLEFnKaTfTtpS+YuF4vWzURcTa9tvt/ReqAKzdG7+caRed+JV5DfIxc6i1dd
 IwA10lWuRsoGriGmAIlYZc5AFz5o278f5ZKDDppw7EnaAToO2jyaxSXm8VJwnsT/H+
 a1van5kavuSVOjDCZl4/4B9uuxV1WlweLD1/mEhqgUC4RX/2tJqo+7CMaPWHqXA3ie
 7h4Dn+D6HpkHc8j4XSs022Qv4C5WS9Ekzqk/of7L+fbVAPk5pfu170Y+2gTnXpnFEn
 o0Gd/elJjTWyO6ieVNcRk2Wg8FQBtH8j0PG5L+97F0K2MdbpWQIuwSB6KKaA3tlaHx
 j0XJQvSYax7HQ==
Original-Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4LTrCr6P56z6tmb;
 Fri, 24 Jun 2022 10:40:08 +0200 (CEST)
X-Hashcash: 1:20:220624:rpluim@gmail.com::gJPvs3E/kVAbbSPA:00RnK
X-Hashcash: 1:20:220624:larsi@gnus.org::v73QZE9A2XsuQr4a:0000cFd
X-Hashcash: 1:20:220624:help-gnu-emacs@gnu.org::wRvC/vIcRe80TXbh:0000000000000000000000000000000000000000keI
X-Hashcash: 1:20:220624:tsdh@gnu.org::YePEDcF/cLxZnQiE:000002rqk
X-Hashcash: 1:20:220624:arash@gnu.org::B6eKLQPomzjdBoJB:0000639L
Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
In-Reply-To: <86bkujm7l2.fsf@gnu.org> (Arash Esbati's message of "Thu, 23 Jun
 2022 22:46:17 +0200")
Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net;
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 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,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no
X-Spam_action: no action
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "help-gnu-emacs"
 <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>
Xref: news.gmane.io gmane.emacs.help:138067
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/138067>

Arash Esbati <arash@gnu.org> writes:

> Robert Pluim <rpluim@gmail.com> writes:
>
>>>>>>> On Thu, 23 Jun 2022 16:46:53 +0200, Arash Esbati <arash@gnu.org> said:
>>
>>     Arash> I'd say it's up to the AUCTeX maintainers to bump the minimum required
>>     Arash> Emacs version at a faster pace ;-)
>>
>> Either that, or they can depend on the 'compat' package, and then just
>> use emacs-28 features with wild abandon.
>
> Thanks for reminding me of compat.  I think compat-28.el has currently a
> bug since the return value of `format-prompt' is not the same as in
> Emacs>=28:
>
> (format-prompt "Foo" "")
> => "Foo: "
>
> This is what compat-28.el does:
>
> (defun compat-format-prompt (prompt default &rest format-args)
>   "Format PROMPT with DEFAULT.
> If FORMAT-ARGS is nil, PROMPT is used as a plain string.  If
> FORMAT-ARGS is non-nil, PROMPT is used as a format control
> string, and FORMAT-ARGS are the arguments to be substituted into
> it.  See `format' for details.
>
> If DEFAULT is a list, the first element is used as the default.
> If not, the element is used as is.
>
> If DEFAULT is nil or an empty string, no \"default value\" string
> is included in the return value."
>   (concat
>    (if (null format-args)
>        prompt
>      (apply #'format prompt format-args))
>    (and default
>         (or (not (stringp default))
>             (not (null default)))
>         ;;  (length> default 0) ; This is in Emacs stock version
>         (format " (default %s)"
>                 (if (consp default)
>                     (car default)
>                   default)))
>    ": "))
>
> (compat-format-prompt "Foo" "")
> => "Foo (default ): "
>
> compat doesn't check if DEFAULT is an empty string.  I'm CC'ing Philip,
> maybe he can comment.

You are right, this is a bug.  When "reimplementing" format-prompt with
backwards compatibility in mind, I replaced the (length> default 0) with
(not (null default)).  This would work on lists, but not on arrays.  I
have replaced it and updated the tests.

> Best, Arash