all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "Óscar Fuentes" <ofv@wanadoo.es>, help-gnu-emacs@gnu.org
Subject: RE: completing-read does not accept spaces
Date: Thu, 16 Jan 2014 10:50:35 -0800 (PST)	[thread overview]
Message-ID: <ecfc0586-7b3a-46a8-a902-0615f8d6d30d@default> (raw)
In-Reply-To: <871u073han.fsf@wanadoo.es>

> >> Reading the docstring of completing-read I see no reason why it should
> >> not accept spaces. So either the docstring is at fault or there is a bug
> >> on completing-read.
> >
> > No.  The doc to read is (elisp) `Completion Commands', in particular,
> > about the variables named `minibuffer-local-*-map'.
> 
> This is terrible. completing-read docstring says
>
>    Read a string in the minibuffer, with completion.
> 
> A string is a string is a string. It doesn't say "a word", or "a
> symbol", or "a string without spaces". It says "a string".

It should perhaps say something like "Read your input in the minibuffer
with completion, and return a string."

It says "a string" because that is what `completing-read' returns.

But if you find that doc string confusing, then by all means, consider
filing a doc bug.  

> >> Curiously, the function will complete the user's input to a string
> >> containing spaces if there is one on the collection of candidates:
> >> (completing-read "say: " (list "hello there"))
> >
> > Irrelevant here.  As the doc I mentioned says, `SPC' is bound to
> > `minibuffer-complete-word', and that is what you are seeing.  `SPC' is
> > not bound to `self-insert-command' here - it is not inserting itself.
> 
> So by not binding SPC to self-insert-command they are breaking
> completing-read stated purpose.

The purpose as stated does not say anything about what keys you can type
to produce the minibuffer content that gets read.

> > It is just completing a "word" at a time.
> >
> >> Please submit a bug report (M-x report-emacs-bug) against completing-
> >> read.
> >
> > No.  There is no bug here.  This is the behavior by design, like
> > it or not.
> 
> The docstring is wrong when it says "Read a string". That's a bug, IMO.

See above.  The input part of the minibuffer (i.e., after the prompt)
can be said to be read as a string.  But even that is not necessarily
accurate.  It is certainly not simply read as a Lisp string, in the
sense of what function `read' does.

But really, I believe what is intended by "Read a string" here is that
the minibufer content is possibly completed and then is accepted and
interpreted.  IOW, this use of "read" is in the general sense of
_reading input_.

The "as a string" really refers to the fact that what is produced by
the act of reading (i.e., what is returned by the function) is a string.

But again, if the doc is not clear to you, consider letting Emacs Dev
know, by filing a bug report.  Perhaps they can improve it to remove
the perceived ambiguity.

> > Do I personally think that `SPC' should generally be self-inserting
> > during completion?  You bet I do.  And so should `?'.  And so should
> > `C-j' (newline).  (And this is the case in Icicle mode, for instance.)
> >
> > But that is not the opinion of Emacs Dev.  It took decades to finally
> > get `SPC' to be self-inserting for file-name completion (see variable
> > `minibuffer-local-filename-completion-map', in the same Elisp manual
> > node).  Patience. ;-)
> 
> Sigh. I know what you mean.

Hang in there, Oscar.



  reply	other threads:[~2014-01-16 18:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-16 15:14 Command timeclock-out Miguel Guedes
2014-01-16 17:07 ` completing-read does not accept spaces (was: Command timeclock-out) Óscar Fuentes
2014-01-16 18:13   ` Drew Adams
2014-01-16 18:36     ` completing-read does not accept spaces Óscar Fuentes
2014-01-16 18:50       ` Drew Adams [this message]
2014-01-16 19:01     ` Stefan Monnier
2014-01-23 12:29     ` Miguel Guedes
2014-01-23 14:20       ` Óscar Fuentes
2014-01-23 17:20       ` Drew Adams

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=ecfc0586-7b3a-46a8-a902-0615f8d6d30d@default \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=ofv@wanadoo.es \
    /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.