From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#56380: 29.0.50; completing-read: INITIAL-INPUT arg Date: Mon, 04 Jul 2022 14:18:55 +0200 Message-ID: <878rp9840g.fsf@web.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24823"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Arash Esbati , Stefan Monnier , Drew Adams To: 56380@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 04 14:30:08 2022 Return-path: Envelope-to: geb-bug-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 ) id 1o8LDM-0006DU-0Z for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Jul 2022 14:30:08 +0200 Original-Received: from localhost ([::1]:42368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8LDJ-0003kM-CY for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Jul 2022 08:30:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8L3a-0000M7-WC for bug-gnu-emacs@gnu.org; Mon, 04 Jul 2022 08:20:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52483) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8L3a-0008Ow-Mw for bug-gnu-emacs@gnu.org; Mon, 04 Jul 2022 08:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o8L3a-0001lj-E5 for bug-gnu-emacs@gnu.org; Mon, 04 Jul 2022 08:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Jul 2022 12:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56380 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16569371576736 (code B ref -1); Mon, 04 Jul 2022 12:20:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Jul 2022 12:19:17 +0000 Original-Received: from localhost ([127.0.0.1]:46380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o8L2q-0001ka-Kc for submit@debbugs.gnu.org; Mon, 04 Jul 2022 08:19:16 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:49044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o8L2o-0001kQ-32 for submit@debbugs.gnu.org; Mon, 04 Jul 2022 08:19:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8L2m-0006p0-Vg for bug-gnu-emacs@gnu.org; Mon, 04 Jul 2022 08:19:13 -0400 Original-Received: from mout.web.de ([212.227.17.11]:59041) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8L2h-0008Ic-L7; Mon, 04 Jul 2022 08:19:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1656937137; bh=LFjjamDwI5fflqmiNzneHunfq4S2uIY6DdfjE8Jb/7I=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=dDgtSr6QGTgRCD/r2nB7vegkUk1ZRs6268wUbHK5rq8w+A+7h6iU7kKcX5lOjTDL7 A8qY/0UkSfYUpJPh51j0P4I4SLz3nCXvmHuzrX7sg1ROtnw6J8oTvyp6Eplfoe1mva ijk2mXv4O1meO/UWobGhXPZmK9TaIwzKcB5iyshI= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from drachen.dragon ([88.66.201.45]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Mv3Yg-1nHKqW3vKS-00rKku; Mon, 04 Jul 2022 14:18:57 +0200 X-Provags-ID: V03:K1:bjtN2CusgdyEvGPtGfDcwvp/lrnNXQ2ie3G61Eg2KO5EePp4grP n7bM0/Dx+reihDb3uIeeeOP13jgD7/1m1hqv8JInGcoAbIqMXAQ/VXQE8E6Oa8N1ELIoVfs dcVu1eh0mjxAW9c+9N6iiZ4gETwUkMUqXwBydrVNAHqzLSzovgzNoWWXkJl7oG7Yv8BrkjP xeGuWtaPv8a6t+cW3iFLw== X-UI-Out-Filterresults: notjunk:1;V03:K0:VJ4iZ4DIQOQ=:1m98gEE/wp+Xfr6Y3Ah5G8 Lzc7mY4j8h4Djui72GyG0NhlnmEmNrIh67oQU50OV0WsVoIYjgCWzVvx6GCR9vVrlC618I+7u jBTh7QAuuUs9/xBDeQw4/dTqNC4hy5FY/R+r3zuBJDi+U6TzGBAp87P3X9/MiFE/U8/kWrjwg oHfXVrTms4CUPDQx6WXcfesu26GRHmHDUyWIaPXty2zPGbu8r3ZXa5QYr9AjW47tunsWgGEL2 5LkLwteb/l/YitksUKdMPWuwjd+6r7c+xQi0NtPsBJBSnlUl9UDzAPHqXPqx2WXDQAl8ndLDZ I5FeVoH2ZcJ/Qzx+NQyNiIygAaMi9DbYJCwf3b7B+XFgAOzT5tk+fl4yg6EyvWKgXlWJRhlmy 4wZf2NGVLTYg2HxtOoRdLhZQVmdf2cABAiwGvLZFvyMTo6ry9ucID0Ut+9YxEQXteuvRBGk90 RxXoXDKCIj5PhgqvTXXz1nkYfEGY9VepUuuAVQS4MILcR3wUV4XdsKFSUFKrspLsHhw69sM34 plkNusfCZXXObq2Sxn8TZAQUybLuyk0A1khBSUPiin++1nVCZW20JGtKxhA7CDYSf0SpqlO+V /egkGqgG2gkgn9PusEgLXfaX9YMh2CbAi8ElxVI1wUGhaQMtLV4X759WTK/kAropeP8ErbA7s nD6Ee6QIVRta5nobbC3o3Ou6yvEOGfvQ0m471E3/Z/ye39gZQ4IVaVrOjEQNlDFhxNW+waFJI qsFsD9RcC8Sf1kl/w6NTzOPsGIrAPS6dSbp0MgrL+V6g7JcaGlTdi0QIqKHUHRnZiioTRJ+h Received-SPF: pass client-ip=212.227.17.11; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:236057 Archived-At: --=-=-= Content-Type: text/plain Hello, The docstring of `completing-read' says the argument INITIAL-INPUT is deprecated - yet there are over 30 nontrivial uses in Emacs' own Elisp sources. So, although we currently don't want that this argument is used just to insert a default input, it's sometimes not possible to avoid using it. Here is an attempt to improve the documentation: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-completing-read-Clarify-why-to-avoid-INITIAL-INPUT.patch Content-Transfer-Encoding: quoted-printable =46rom e2a4e843c262416b7b866203a7e636265beb4673 Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Mon, 27 Jun 2022 15:42:58 +0200 Subject: [PATCH] completing-read: Clarify why to avoid INITIAL-INPUT * src/minibuf.c (completing-read): Don't say INITIAL-INPUT is deprecated because it's necessary to use it in some cases. Mention M-n and M-p as well as `minibuffer-with-setup-hook'. Co-authored-by: Drew Adams =2D-- src/minibuf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/minibuf.c b/src/minibuf.c index c2e270a450..2ad74e4d38 100644 =2D-- a/src/minibuf.c +++ b/src/minibuf.c @@ -2026,10 +2026,11 @@ DEFUN ("completing-read", Fcompleting_read, Scompl= eting_read, 2, 8, 0, initial input is STRING, but point is placed at _zero-indexed_ position POSITION in STRING. (*Note* that this is different from `read-from-minibuffer' and related functions, which use one-indexing - for POSITION.) This feature is deprecated--it is best to pass nil - for INITIAL-INPUT and supply the default value DEF instead. The - user can yank the default value into the minibuffer easily using - \\\\[next-history-element]. + for POSITION.) Don't use this argument to insert a default value -- + use DEF for that. You can use INITIAL-INPUT, for example, to insert + a prefix common to all completion candidates. See + `minibuffer-with-setup-hook' for a general method to prepare the + minibuffer. HIST, if non-nil, specifies a history list and optionally the initial position in the list. It can be a symbol, which is the history list @@ -2044,6 +2045,9 @@ DEFUN ("completing-read", Fcompleting_read, Scomplet= ing_read, 2, 8, 0, of a history list. If HIST is t, history is not recorded. DEF, if non-nil, is the default value or the list of default values. + These can be yanked into the minibuffer using \ +\\\\[next-history-element] and \ +\\[previous-history-element]. If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits the current input method and the setting of `enable-multibyte-characters'. =2D- 2.30.2 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable This patch is the result of a discussion in emacs dev: https://yhetil.org/emacs-devel/87v8smt9lp.fsf@web.de/ Further things mentioned in that discussion: 1. Likewise we want to improve the docstrings of `read-string' and `read-from-minibuffer'. And as well (Arash Esbati): Emacs Lisp reference the text/descriptions in @node Text from Minibuffer @section Reading Text Strings with the Minibuffer @node Initial Input @section Initial Input @node Minibuffer Completion @subsection Completion and the Minibuffer 2. Add a minor mode that automatically inserts a DEF into the minibuffer, and add a defcustom to allow users to enable that mode in their configuration. Some people simply prefer that behavior. This would allow people to avoid using INITIAL-INPUT to get what they want. 3. Stefan Monnier: [...] the `initial-input` arg should be changed into `setup-function` (so we don't have to use the hideous `minibuffer-with-setup-function` hack) and using a string there should be deprecated (the rare places where inserting an initial string makes sense can use a setup-function instead). Also the prompt handling should be changed so that it automatically inserts the default into the prompt. Doing that in a reliable and backward compatible way is not completely straightforward, tho, so maybe a simpler solution is to introduce a whole new function instead. Then a user-customization could also be used to choose between the current default (where the default is added to the prompt) or the other option of always inserting the default as initial value (pre-selected so it can be deleted with a quick DEL). TIA, Michael. In GNU Emacs 29.0.50 (build 13, x86_64-pc-linux-gnu, GTK+ Version 3.24.24,= cairo version 1.16.0) of 2022-07-03 built on drachen Repository revision: 0de355d8ee729ed6fec3ea379258d4a1f1d49021 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Debian GNU/Linux 11 (bullseye) --=-=-=--