From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: RE: [External] : completing-read depricated initial-input Date: Fri, 24 Jun 2022 10:09:27 +0200 Message-ID: References: <86r13hubaw.fsf_-_@gnu.org> <86letphfke.fsf_-_@gnu.org> <86mte3lsj2.fsf_-_@gnu.org> <871qvfoce1.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40266"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , Michael Heerdegen , Arash Esbati , "eliz@gnu.org" , Help Gnu Emacs , "carlmarcos@tutanota.com" To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 24 10:11:43 2022 Return-path: 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 ) id 1o4ePm-000AH7-IU for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 24 Jun 2022 10:11:42 +0200 Original-Received: from localhost ([::1]:44740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4ePl-0007gA-3W for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 24 Jun 2022 04:11:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4eNp-0007fu-Re for help-gnu-emacs@gnu.org; Fri, 24 Jun 2022 04:09:43 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:38321) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4eNn-0002RU-Rg; Fri, 24 Jun 2022 04:09:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1656058167; bh=IfKIdzByLFA74ZAmqoplYmaUfZ9OgqpfVsXqkc5+48A=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=fwXTtuKX+6Utq0/LhJ7i5LL5n1mn/8XqEHGiLXJHHYCOe+3051zWZHNH8R+sATunN epLO/xn1KHdpWoUaqukI/ifu84IjcyA7E9GiLc4jB1K4C5sDWTur8EMC/XiqOfeoww R+I3zbgJNdELSlnSaWdNsDftoZDcw1vIwPsHxavQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [92.251.127.164] ([92.251.127.164]) by web-mail.gmx.net (3c-app-mailcom-bs07.server.lan [172.19.170.175]) (via HTTP); Fri, 24 Jun 2022 10:09:27 +0200 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:BRqtpGV4S4/JbemiGQTrbikWVvAfRfgAGw7puJfj/TbolD13nAcOfiGP6WfnpRRwLpoNB 3F8J0tw0sjslQzrDZ1Efk/LiutgWcZuQ+ZN4DvRp4stsQ8LyHx08aB31w7XOcszYyPcdxvKzyezP ocTbD+IPhvU+JAd92EfOTl3aDyoXNWnnxpolc3B6IgCJXZY/de7zo/QJY0GHx3eGb0dCgGTRDeRW xRFFEvh9EJs9KkHxVupkXYdv3h/Erzda1Hu6/hPob5TqPRG1OI9OW19+Srf5KiogwaLJie2fMqu3 wA= X-UI-Out-Filterresults: notjunk:1;V03:K0:bGPkr/loM5c=:NwmTl5s2+9cduIROSIzuEu meOKPJFAURJ//nTGIvTQZK/K8uVwvCDakEY8sOCGVtz+/MoPXNMC4IvKYNJXOa6STBxAyrABy GyPHaEoaSu6pMss6NT4TZy8tgAACYPYwoT0uOH/dA1odYFGeb2/QLbeWcLpLNtqYYQw4raKbH 94yfEWoYCZzaLRKacveec5JLKgP2ga6JjOlFWSXQhiRnIepYXCUIzqsAHOp9KVdNkKBiGU6ji 7UcATyT9T4GCYdv5KTntK/42681+nCqJY7gH0gpReKZlIanfmsAs6o9z0B0gapa0TrQQdhteG WMdHbtM4dYwloNizH84gRVQ7YIR+G8tXmpFPIofFhBfxvZ16LUVq1BhckslmJNP7n2Py8eWiA a7aEJK3k8jCIXoJtdrCcujyraVzbSc4Wh2AvqdFFEZioqsvUNNECmTBi0e05cQcuNBCIFulCf XZWOlqB1ahocfQ1WyrYUO0HgqgH0lrFphnNE2gS0lTzj/2VpJ8PSHp2xQKB2fi+8J5/RjhZpU apJELmr9HTU3M/nOWedU3Io77aCpRDlhiR8dv3ESXgSJa4iHj68hY3k3JAWJ6kO2bcGiEUeCu rtLrM2cj6U5o7A69gYIyupnbfKg6JTK9dSAwJukrbzEqpzklve9JYuuqyiuwkbBsFgvShBMVI DF5eSnAcHlYYJq+vzzYorXd9gc5V3TUtxSyAqmqqgakrhJpkTZL8DRuaxoRnd/Rce9lDb0G3W lzM0JeQt/gNW4LCfGCHX8kEdcNmMKzDrhhuZCvb7yfqzTfWbabu7w0gKbjsEPom20PYfr32x Received-SPF: pass client-ip=212.227.17.22; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, THIS_AD=1.098, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:138064 Archived-At: > Sent: Friday, June 24, 2022 at 12:10 PM > From: "Drew Adams" > To: "Stefan Monnier" , "Michael Heerdegen" > Cc: "Arash Esbati" , "Christopher Dimech" , "eliz@gnu.org" , "Help Gnu Emacs" , "carlmarcos@tutanota.com" > Subject: RE: [External] : Re: completing-read depricated initial-input > > > I haven't really followed that thread, but IMO 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 ther= e > > should be deprecated (the rare places where inserting an initial strin= g > > makes sense can use a setup-function instead). > > No comment on all of that. At least not until > it becomes something real to worry about. ;-) > > > 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 othe= r > > option of always inserting the default as initial value (pre-selected > > so it can be deleted with a quick DEL). > > Possible insertion of the default value, and its > possible addition to the prompt, should be handled > more generally than just for completion. > > Ideally the choice should belong mainly to users, > and it should apply to pretty much all minibuffer > reading functions that allow for a default value. Quite right. The ability to show an entry rather than always keeping it blank should be kept. > _____ > > FWIW, Icicle mode handles this with user option > `icicle-default-value'. > > When the value's non-`nil' and arg INITIAL-INPUT > of minibuffer-reading functions is `nil' or "", > the DEFAULT-VALUE argument can be inserted into > the minibuffer as initial input. > > For `completing-read', `read-file-name'[*], and > `read-string', if the option value is `t' then the > default value is added to the prompt as a hint. > > Adding the default value to the prompt corresponds > to a more or less conventional behavior of vanilla > Emacs. But Emacs doesn't do that systematically. > Instead, it hard-codes default values into prompts > here and there. It's up to the particular command > to decide about this - ad hoc. > > By design, individual Icicles commands never add > the default value to a prompt themselves. Instead, > option `icicle-default-value' controls the behavior. > > Non-`nil' and non-`t' inserts the default value > into the minibuffer as the initial value. > > `nil' neither inserts the default value nor adds > it to the prompt. > > (If the value is `t' or `nil', you can always use > `M-n' to insert the default value manually.) > > If you often want to use or edit the default value, > then consider setting `icicle-default-value' to > non-`nil' and non-`t'. If you rarely do so, then > consider using `nil' or `t'. > > A non-`nil', non-`t' value also controls whether > or not the inserted default value is preselected > (as the active region), and where to leave the > cursor: at its beginning or end. > > Preselecting the value can be useful in Delete > Selection mode, because it makes it easy to > replace that value by typing characters, or delete > it by hitting `DEL' or `C-d'. (However, all of > the initial input is deleted with `C-d' or `DEL', > which is inconvenient if you just want to edit it > slightly.) > > Summary of values: > > Don't insert default into minibuffer: > > nil - Don't add to prompt. > t - Add to prompt if `completing-read', > `read-file-name', or `read-string'. > > Do insert default into minibuffer: > > `insert-start' - Leave cursor at start. > `insert-end' - Leave cursor at end. > `preselect-start' - Preselect and put cursor > at beginning. > `preselect-end' - Preselect and put cursor > at end. > > `t' is the default. (I use `insert-end'.) > _____ > > When Icicles automatically puts the default value > into the prompt, as a hint, it also replaces it > there if put there already by some command, so > the hint format will be systematically the same. > > Option `icicle-default-in-prompt-format-function' > defines the format to use. By default it's this: > (lambda (default) (format " (%s)" default)) > > Function `icicle-handle-default-for-prompt' does > the work: > __ > > (icicle-handle-default-for-prompt PROMPT DEFAULT INCLUDE) > > Return PROMPT, possibly changed to format or remove the DEFAULT value. > Argument INCLUDE: > * nil means do not include DEFAULT in prompt. Remove it if there. > * non-nil means include DEFAULT, formatted according to > `icicle-default-in-prompt-format-function'. > > In the existing PROMPT before modification, recognizes inclusion of > a default value according to these possible patterns: > > `minibuffer-default-in-prompt-regexps' > "(default ___):" > "(default is ___):" > " [___] " > __ > > Icicles just reuses vanilla Emacs variable > `minibuffer-default-in-prompt-regexps', which is > defined for `minibuffer-electric-default-mode'. > > A list of regexps matching the parts of minibuffer > prompts showing defaults. > When 'minibuffer-electric-default-mode' is active, > these regexps are used to identify the portions of > prompts to elide. > > (`minibuffer-electric-default-mode'e tries to show > a default value in a prompt only when hitting RET > yields that value. If you edit the minibuffer text > so it's no longer the default value, the default's > removed from the prompt.) > ____________________ > > > [*]: However, for `read-file-name', if option > `insert-default-directory' is non-`nil' then, to > avoid duplication: > > * If the default value is the same as the value of > `default-directory' then it's not added to the > prompt. > > * If the default value is added to the prompt then > it's first made relative to `default-directory'. > >