[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] org-insert-link should use DEFAULT in read-string when asking

From: Visuwesh
Subject: Re: [BUG] org-insert-link should use DEFAULT in read-string when asking for description
Date: Sat, 26 Feb 2022 19:46:36 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

[சனி, பிப்ரவரி 26 2022] Max Nikulin wrote:

> On 25/02/2022 21:19, Visuwesh wrote:
>> Currently, when asking the user for the description of link,
>> `org-insert-link' calls `read-string' with a non-nil INITIAL-INPUT but
>> this argument is discouraged and deprecated; moreover, it is unfriendly.
>> `org-insert-link' should, ideally, use the DEFAULT argument.  If the
>> user decides that the suggested description is okay, they can type M-n.
> Due to lack of experience with emacs I can miss something. If so,
> please, correct me.
> Are you suggesting replacing
>     (read-string "rs-initial: " "Some initial")
> by
>     (read-string "rs-default: " nil nil "Some default")
> ?

Yes, exactly.

> Is it possible to override provided default description by empty
> string in the latter variant? Currently it is possible to erase
> description using just backspace or C-S-backspace.

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
I can live with the current behaviour, but this inconsistency is an
annoyance since I end up with garbled link names, which I only notice

> P.S. Many GUI applications pre-select whole value when some input
> field is focused, so it is possible to overwrite current value by
> typing anything. It may be convenient but is not consistent with emacs
> behavior. Moreover it makes uncertain if visually selected text
> overwrites X PRIMARY selection.

I would rather not go there.  You seem to describe
`delete-selection-mode' which, IMO, is also a nuisance given how
mark+point is not the same as "regular selections" (even with
`transient-mark-mode' turned on).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]