From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Cc: Visuwesh <visuweshm@gmail.com>
Subject: Re: [BUG] org-insert-link should use DEFAULT in read-string when asking for description
Date: Tue, 1 Mar 2022 23:36:02 +0700 [thread overview]
Message-ID: <a416b152-dd3a-baaf-8506-5690fc37bdb7@gmail.com> (raw)
In-Reply-To: <877d9g5lq5.fsf@gmail.com>
On 27/02/2022 23:16, Visuwesh wrote:
> [ஞாயிறு, பிப்ரவரி 27 2022] Max Nikulin wrote:
>> On 26/02/2022 21:16, Visuwesh wrote:
>>> [சனி, பிப்ரவரி 26 2022] Max Nikulin wrote:
>>>
>>>> Are you suggesting replacing
>>>> (read-string "rs-initial: " "Some initial")
>>>> by
>>>> (read-string "rs-default: " nil nil "Some default")
>>>> ?
>>> Yes, exactly.
>>
>> However you agreed that it would be regression since empty description
>> use case would be impossible.
>
> No. It is impossible to do it using read-string, but it is possible to
> do it by writing a function that calls read-from-minibuffer (and I gave
> an example of a function that does this).
>
>>> I admit that I forgot about this but Emacs can be made to not translate
>>> empty string to the default argument if you DTRT when calling
>>> `read-from-minibuffer' (and `read-shell-command' does this). If writing
>>> a new function just to get this functionality is too much, then I guess
>>
> 2. The reason why I cited read-shell-command does not have anything
> to do with the usefulness of empty string (or shell command). I
> merely wanted to point out that you can have BOTH the DEFAULT
> argument (and no INITIAL), and can make the empty string a valid
> output from the function (i.e., without getting substituted by
> the DEFAULT argument).
In my opinion deprecation of the INITIAL argument without some descent
replacement was a mistake. I suspect that such statement appeared
without realizing of the problem with discriminating default vs. empty
value. `read-string' oversimplify it by assumption that users do not
need empty values at all. Your first argument was that INITIAL is
deprecated but in the next message you pointed to a function that still
uses the INITIAL argument. On the other hand `read-shell-command'
belongs to command for which empty return value is hardly meaningful
despite it is possible. That is why I disputed that `read-shell-command'
is a good example of `read-from-minibuffer' usage in the context of
`org-insert-link'.
> Please read the docstring of read-from-minibuffer. You would be better
> served by reading it than me replicating it here. And I gave
> read-shell-command as an example so others could study the function.
>
> In essence, you can get the old behaviour (1) but you need to type M-n
> beforehand. Its one more key but it is far better than the current
> behaviour since it is consistent with rest of the Emacs ecosystem (see
> below also).
I do not think it is a good idea to require extra M-n to keep the
*current* description when a user hit C-c C-l to edit the link target
with no intention to touch its description.
> With every command I use, when I know that the DEFAULT argument will be
> of no use, I simply start typing. However, with org-insert-link I have
> to clear the input _first_ then start typing. This never happens
> elsewhere, even in grep (which you cite as an example)!
I agree that it is great to be able to just start typing to replace
default description. Unfortunately similar to significant fraction of
interfaces, `org-insert-link' behavior is a result of trade-offs and
compromises. If you see a way to improve it, please, submit a patch or
at least post a code that can be tried from a src block or from the
*scratch* buffer to evaluate possible regressions and unaddressed use cases.
prev parent reply other threads:[~2022-03-01 16:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-25 14:19 [BUG] org-insert-link should use DEFAULT in read-string when asking for description Visuwesh
2022-02-26 8:50 ` Max Nikulin
2022-02-26 14:16 ` Visuwesh
2022-02-27 10:48 ` Max Nikulin
2022-02-27 16:16 ` Visuwesh
2022-03-01 16:36 ` Max Nikulin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a416b152-dd3a-baaf-8506-5690fc37bdb7@gmail.com \
--to=manikulin@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=visuweshm@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).