all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Dmitry Gutov <dgutov@yandex.ru>, Ryan <rct@thompsonclan.org>,
	27158@debbugs.gnu.org
Subject: bug#27158: 25.2; Eliminating old usage of completing-read from built-in files
Date: Wed, 31 May 2017 08:19:10 -0700 (PDT)	[thread overview]
Message-ID: <3d3bc85b-31d3-4701-8acd-45591d075253@default> (raw)
In-Reply-To: <4dfcd02b-53bc-c430-89db-f93ad6b283c2@yandex.ru>

> I mean that having the default argument when it's not specified, is
> not necessary. There is no need for "default default".
> 
> > Just because some callers might not need it does not mean that
> > it is not useful for other callers.
> 
> They can use the DEFAULT argument.

So are you arguing that DEFAULT should be a mandatory argument?
I addressed that in my first message.

> >> Prohibit them from finishing completion, except through entering
> >> a valid value, or pressing C-g.
> >
> > (while <no valid value> <get input with completion>)
> >
> > Is that hard?
> 
> It makes completing-read-function calling convention
> more complex for no real gain.

So you do think that it is hard?  Hard to believe.

And how so, no real gain?  If there is no real gain for
you then don't do it.  You said you wanted to keep
prompting and getting input as long as the user tried
to exit with no input.  Now you are saying that doing
that would e no real gain.  (?)

> The simpler the API is, the easier it is to provide
> alternative implementations for.

By that logic we should get rid of most of the optional
args to `completing-read'.  Or maybe we should get rid
of `completing-read' and let people do it all using
`read-from-minibuffer'?

But go ahead.  Make DEFAULT mandatory if you like.
See how that change goes down.

But if an explicit DEFAULT arg is the solution then your
completion system need only set arg DEFAULT to "" when
it is nil, no?  Or set it to the first completion candidate
when it is nil or "".  Or ... <whatever floats your boat>.

> And also, we will have new callers who are not aware of this quirk.
> Those packages might fail to account for the possibility that
> completing-read can return "". After all, they passed t as the
> REQUIRE-MATCH argument.
> 
> > What happens when you set `completing-read-function' to your
> > `my-completing-read'?
> 
> Some callers rely on it returning an empty string when the user
> presses RET.

Imagine that.  And they would rely on the same thing if they
passed "" as an explicit DEFAULT arg.

> In those cases, if my-completing-read does not provide this
> ability (literally, does not return "" when the user presses
> RET right away), the user experience can suffer.

Indeed.  So don't do that.  Respect what the caller expects.

> And some UIs make it non-trivial for the
> completing-read-function to behave like above. E.g. add
> "" to the completions list but only when the user does
> not type anything.

If you cannot test for "" return value then checking for
no input becomes even harder.

Sure, explicit "" DEFAULT provides the same possibility
for checking for input.

What does your `completing-read-function' want to do in
that case?

Sorry, but it's not clear to me what the problem is.
Anything I think I see you saying about the problem does
not seem to be solved by making DEFAULT mandatory.
What am I missing?  How about a concrete example?





  reply	other threads:[~2017-05-31 15:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31  4:41 bug#27158: 25.2; Eliminating old usage of completing-read from built-in files Ryan
2017-05-31  5:52 ` Drew Adams
2017-05-31 11:45   ` Ryan Thompson
2017-05-31 14:51     ` Drew Adams
2017-05-31 12:23   ` Dmitry Gutov
2017-05-31 14:51     ` Drew Adams
2017-05-31 14:59       ` Dmitry Gutov
2017-05-31 15:19         ` Drew Adams [this message]
2017-05-31 15:44           ` Ryan Thompson
2017-05-31 22:41             ` Dmitry Gutov
2017-05-31 23:16               ` Drew Adams
2017-05-31 23:54                 ` Dmitry Gutov
2017-06-01  2:23                   ` Drew Adams
2017-06-01  9:27                     ` Dmitry Gutov
2017-06-01 14:57                       ` Drew Adams
2017-06-01 20:53                         ` Dmitry Gutov
2017-06-01 21:04                           ` Ryan Thompson
2017-06-05 23:01                             ` Dmitry Gutov
2017-06-06  0:06                               ` Ryan Thompson
2017-06-06  0:09                                 ` Dmitry Gutov
2017-05-31 21:20           ` Dmitry Gutov
2020-08-24 14:58 ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d3bc85b-31d3-4701-8acd-45591d075253@default \
    --to=drew.adams@oracle.com \
    --cc=27158@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=rct@thompsonclan.org \
    /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 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.