unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Command timeclock-out
@ 2014-01-16 15:14 Miguel Guedes
  2014-01-16 17:07 ` completing-read does not accept spaces (was: Command timeclock-out) Óscar Fuentes
  0 siblings, 1 reply; 9+ messages in thread
From: Miguel Guedes @ 2014-01-16 15:14 UTC (permalink / raw)
  To: help-gnu-emacs

I've just noticed that when executing `timeclock-out' and inputting a 
reason it does not accept spaces.  This command makes use of the 
function `completing-read'.

Is not accepting spaces when entering a reason for clocking out the 
intended behaviour?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* completing-read does not accept spaces (was: Command timeclock-out)
  2014-01-16 15:14 Command timeclock-out Miguel Guedes
@ 2014-01-16 17:07 ` Óscar Fuentes
  2014-01-16 18:13   ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Óscar Fuentes @ 2014-01-16 17:07 UTC (permalink / raw)
  To: Miguel Guedes; +Cc: help-gnu-emacs

Miguel Guedes <miguel.a.guedes@gmail.com> writes:

> I've just noticed that when executing `timeclock-out' and inputting a
> reason it does not accept spaces.  This command makes use of the
> function `completing-read'.
>
> Is not accepting spaces when entering a reason for clocking out the
> intended behaviour?

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. 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"))

Please submit a bug report (M-x report-emacs-bug) against completing-read.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: completing-read does not accept spaces (was: Command timeclock-out)
  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
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Drew Adams @ 2014-01-16 18:13 UTC (permalink / raw)
  To: Óscar Fuentes, Miguel Guedes; +Cc: help-gnu-emacs

> > I've just noticed that when executing `timeclock-out' and inputting a
> > reason it does not accept spaces.  This command makes use of the
> > function `completing-read'.
> >
> > Is not accepting spaces when entering a reason for clocking out the
> > intended behaviour?
> 
> 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'.

> 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.
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.

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. ;-)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: completing-read does not accept spaces
  2014-01-16 18:13   ` Drew Adams
@ 2014-01-16 18:36     ` Óscar Fuentes
  2014-01-16 18:50       ` Drew Adams
  2014-01-16 19:01     ` Stefan Monnier
  2014-01-23 12:29     ` Miguel Guedes
  2 siblings, 1 reply; 9+ messages in thread
From: Óscar Fuentes @ 2014-01-16 18:36 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams <drew.adams@oracle.com> writes:

>> 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".

>> 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.

> 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.

> 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.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: completing-read does not accept spaces
  2014-01-16 18:36     ` completing-read does not accept spaces Óscar Fuentes
@ 2014-01-16 18:50       ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2014-01-16 18:50 UTC (permalink / raw)
  To: Óscar Fuentes, help-gnu-emacs

> >> 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.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: completing-read does not accept spaces
  2014-01-16 18:13   ` Drew Adams
  2014-01-16 18:36     ` completing-read does not accept spaces Óscar Fuentes
@ 2014-01-16 19:01     ` Stefan Monnier
  2014-01-23 12:29     ` Miguel Guedes
  2 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2014-01-16 19:01 UTC (permalink / raw)
  To: help-gnu-emacs

> Patience. ;-)

Bug reports can help, too,


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: completing-read does not accept spaces
  2014-01-16 18:13   ` Drew Adams
  2014-01-16 18:36     ` completing-read does not accept spaces Óscar Fuentes
  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
  2 siblings, 2 replies; 9+ messages in thread
From: Miguel Guedes @ 2014-01-23 12:29 UTC (permalink / raw)
  To: Drew Adams, Óscar Fuentes; +Cc: help-gnu-emacs

On 16/01/14 18:13, Drew Adams wrote:
<snip>
> No.  There is no bug here.  This is the behavior by design, like
> it or not.
>
> 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. ;-)
>

But would it be fair to say that the command `timeclock-out' shouldn't 
be making use of `completing-read' for entering a reason (to clock out) 
and thus a bug should be filed?

Many thanks for your replies.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: completing-read does not accept spaces
  2014-01-23 12:29     ` Miguel Guedes
@ 2014-01-23 14:20       ` Óscar Fuentes
  2014-01-23 17:20       ` Drew Adams
  1 sibling, 0 replies; 9+ messages in thread
From: Óscar Fuentes @ 2014-01-23 14:20 UTC (permalink / raw)
  To: Miguel Guedes; +Cc: help-gnu-emacs

Miguel Guedes <miguel.a.guedes@gmail.com> writes:

> But would it be fair to say that the command `timeclock-out' shouldn't
> be making use of `completing-read' for entering a reason (to clock
> out) and thus a bug should be filed?

I'm not sure about the intent of the timeclock author about that. The
same as `project', `reason' could be expected to be a keyword
("finished", "pause", "lunch".) You can use non-blank separators to
cheat ("walk-dog").

Anyways, if the author's plans was to allow full strings, there is a bug
related to completing-read usage; if not, the documentation of timeclock
should be expanded to explain how `reason' should look like.

So I'll go ahead and file a bug (M-x report-emacs-bug)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: completing-read does not accept spaces
  2014-01-23 12:29     ` Miguel Guedes
  2014-01-23 14:20       ` Óscar Fuentes
@ 2014-01-23 17:20       ` Drew Adams
  1 sibling, 0 replies; 9+ messages in thread
From: Drew Adams @ 2014-01-23 17:20 UTC (permalink / raw)
  To: Miguel Guedes, Óscar Fuentes; +Cc: help-gnu-emacs

> But would it be fair to say that the command `timeclock-out' shouldn't
> be making use of `completing-read' for entering a reason (to clock out)
> and thus a bug should be filed?

Sorry, I know nothing about Timeclock - what it does, or why, or how.

I never time anything.  And I haven't punched a timeclock since
doing factory work when young - many moon ago.

You can probably judge yourself whether it has a bug.  And you need
not be sure, to file a bug report.  Emacs Dev will tell you whether
they agree that what you reported is a bug.  `M-x report-emacs-bug'.



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-01-23 17:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).