all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Doc of deprecated INITIAL-INPUT arg of completing-read
@ 2022-06-27 15:22 Michael Heerdegen
  2022-06-27 16:33 ` [External] : " Drew Adams
  2022-06-28 19:15 ` Jean Louis
  0 siblings, 2 replies; 30+ messages in thread
From: Michael Heerdegen @ 2022-06-27 15:22 UTC (permalink / raw)
  To: Emacs Development

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

Hello,

there was a long discussion in emacs-help about the INITIAL-INPUT
argument of `completing-read'.  Among other things people complained
about the argument being deprecated.

I agree that it's not good to use it in nearly all cases, but there ARE
a few cases where it hardly can be avoided - we have over 30 uses in
Emacs itself.  So I want to suggest to change the docstring to warn
strongly about the usage of that argument, but stop saying it would be
deprecated.

This is to make the current state of the code more consistent - I don't
plan to work on changes that had been suggested in that discussion.

So would this patch be ok to install for now?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-completing-read-clarify-why-to-avoid-INITIAL-INPUT.patch --]
[-- Type: text/x-diff, Size: 1577 bytes --]

From c6c2fa8b09be579271d274b38fc17a788132076c Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
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 few special cases.
---
 src/minibuf.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/minibuf.c b/src/minibuf.c
index 85d6ec4434..c0182cb704 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -2025,9 +2025,11 @@ DEFUN ("completing-read", Fcompleting_read, Scompleting_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
+  for POSITION.)  Using this argument is strongly discouraged--it is
+  normally best to pass nil for INITIAL-INPUT and supply the default
+  value DEF except in few special cases like inserting a prefix common
+  to all completions or an initial part of a file name.  The user can
+  yank the default value into the minibuffer easily using
   \\<minibuffer-local-map>\\[next-history-element].

 HIST, if non-nil, specifies a history list and optionally the initial
--
2.30.2


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


Or should we rather - as Stefan suggested - change every usage of the
argument to use a kind of setup function (which would at the moment mean
use `minibuffer-with-setup-hook' unless someone implements a SETUP-FUN
argument for that function, but I won't do that as I don't speak C)?

TIA,

Michael.

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

end of thread, other threads:[~2024-02-17 17:41 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-27 15:22 Doc of deprecated INITIAL-INPUT arg of completing-read Michael Heerdegen
2022-06-27 16:33 ` [External] : " Drew Adams
2022-06-27 17:22   ` Christopher Dimech
2022-06-28 16:19   ` Michael Heerdegen
2022-06-28 16:40     ` Drew Adams
2022-06-29 13:42       ` Michael Heerdegen
2022-06-29 14:24         ` Drew Adams
2022-06-28 21:46     ` Christopher Dimech
2022-06-29  9:15     ` Arash Esbati
2022-06-29 13:46       ` Michael Heerdegen
2022-06-30  9:10         ` Arash Esbati
2022-07-04 12:25           ` Michael Heerdegen
2022-06-28 19:17   ` [External] : " Jean Louis
2022-06-28 19:15 ` Jean Louis
2022-06-28 21:10   ` Stefan Monnier
2022-06-28 22:00     ` Jean Louis
2022-06-29  2:58       ` Stefan Monnier
2022-06-30  3:08     ` Richard Stallman
2022-06-30 14:28       ` Stefan Monnier
2024-02-13 14:43     ` Tim Landscheidt
2024-02-13 14:59       ` Stefan Monnier
2024-02-13 17:07         ` Tim Landscheidt
2024-02-13 20:09           ` Stefan Monnier
2024-02-15  8:21             ` Tim Landscheidt
2024-02-15 16:09               ` [External] : " Drew Adams
2024-02-15 18:39               ` Stefan Monnier
2024-02-17 17:12                 ` Tim Landscheidt
2024-02-17 17:41                   ` Stefan Monnier
2022-06-30  3:08   ` Richard Stallman
2022-07-01  5:54     ` Jean Louis

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.