all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to insert space in minibuffer while in completing-read ?
@ 2008-03-07 20:41 Brian Adkins
  2008-03-07 21:26 ` Pascal Bourguignon
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Adkins @ 2008-03-07 20:41 UTC (permalink / raw)
  To: help-gnu-emacs

I've been using the Emacs timeclock to track my time on various
activities. When I invoke timeclock-in, I'm unable to enter a project
name containing embedded space characters (unless it's already in the
auto complete list by virtue of me manually editing the timelog file
beforehand).

I think I tracked the problem down to the completing-read function
that eventually gets invoked from timeclock-in. I put the following
snippet (from timeclock.el) in the *scratch* buffer and invoked it via
C-M-x

(completing-read "Enter string (default foo): " '("bar" "fuz") nil nil
nil nil "foo")

If I type b <space> the minibuffer will complete to bar, but I can't
then type a space. My temporary work around was to do the following:

(global-set-key (kbd "C-#") (lambda () (interactive) (insert-char ?\s
1)))

and then press C-# instead of <space> while in the minibuffer, and
that works fine :)

I suppose my question is how to unbind the <space> key from the
minibuffer-complete-word command when invoking the timeclock-in
command?


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

* Re: How to insert space in minibuffer while in completing-read ?
  2008-03-07 20:41 How to insert space in minibuffer while in completing-read ? Brian Adkins
@ 2008-03-07 21:26 ` Pascal Bourguignon
  2008-03-07 21:53   ` Brian Adkins
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Pascal Bourguignon @ 2008-03-07 21:26 UTC (permalink / raw)
  To: help-gnu-emacs

Brian Adkins <lojicdotcom@gmail.com> writes:
> I suppose my question is how to unbind the <space> key from the
> minibuffer-complete-word command when invoking the timeclock-in
> command?

C-q SPC

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Litter box not here.
You must have moved it again.
I'll poop in the sink. 


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

* Re: How to insert space in minibuffer while in completing-read ?
  2008-03-07 21:26 ` Pascal Bourguignon
@ 2008-03-07 21:53   ` Brian Adkins
  2008-03-07 22:09   ` Drew Adams
       [not found]   ` <mailman.8526.1204927839.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Brian Adkins @ 2008-03-07 21:53 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 7, 4:26 pm, Pascal Bourguignon <p...@informatimago.com> wrote:
> Brian Adkins <lojicdot...@gmail.com> writes:
> > I suppose my question is how to unbind the <space> key from the
> > minibuffer-complete-word command when invoking the timeclock-in
> > command?
>
> C-q SPC

Thanks, that's a much simpler work around than mine :)

That would work for most of my timeclock projects (0 to 2 spaces), but
occasionally I just want to enter a longer description on that line,
such as:

Met with John & Joe to discuss the authentication scheme

so, it would also be nice to get my space bar back from the over
zealous auto completer. I can M-x timeclock-visit-timelog and edit the
line manually, but it would be nicer to just enter it in the
minibuffer.

Another way to put this would be to say I'd like it to work like C-x C-
f where TAB will autocomplete, but SPC is just a SPC. Of course maybe
that's changed with v23 - I do recall some folks complaining about
losing their SPC autocomplete in find file - basically the opposite of
my problem.


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

* RE: How to insert space in minibuffer while in completing-read ?
  2008-03-07 21:26 ` Pascal Bourguignon
  2008-03-07 21:53   ` Brian Adkins
@ 2008-03-07 22:09   ` Drew Adams
       [not found]   ` <mailman.8526.1204927839.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2008-03-07 22:09 UTC (permalink / raw)
  To: 'Pascal Bourguignon', help-gnu-emacs

> > I suppose my question is how to unbind the <space> key from the
> > minibuffer-complete-word command when invoking the timeclock-in
> > command?
> 
> C-q SPC

Sure, you can quote each space character with `C-q'. Or you can fix Emacs to
do what you want all the time.

Emacs users should be able to type space chars in minibuffer input. Period.
Emacs 22 finally allows that for file-name input, but it should be available
for all minibuffer input. Input completion is not limited to command names.

Solutions:

1. Use Icicles: http://www.emacswiki.org/cgi-bin/wiki/Icicles.

2. If you don't want to use Icicles, but you do want to allow space chars in
minibuffer input, do this:

 (define-key minibuffer-local-completion-map
             " " 'self-insert-command))
 (define-key minibuffer-local-must-match-map
             " " 'self-insert-command))

Emacs 22 adds the keymaps `minibuffer-local-filename-completion-map' and
`minibuffer-local-must-match-filename-map', but space should already DTRT
there.


You might also want to do the same thing for the `?' character, in the same
maps: (define-key MAP "?" 'self-insert-command), where MAP is as above (plus
the two filename completion maps if you use Emacs 22 or later).

In Icicles, BTW, it is `C-?', not `?', that displays help. Printable
characters like `?' should not need to be quoted to input them.

You might also want to do the same thing for "\n", the newline character.
Icicles does that so you can have multi-line input without resorting to `C-q
C-j' for each newline char.

HTH.





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

* Re: How to insert space in minibuffer while in completing-read ?
       [not found]   ` <mailman.8526.1204927839.18990.help-gnu-emacs@gnu.org>
@ 2008-03-07 23:34     ` Brian Adkins
  2008-03-08 21:24     ` Stefan Monnier
  1 sibling, 0 replies; 7+ messages in thread
From: Brian Adkins @ 2008-03-07 23:34 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 7, 5:09 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > > I suppose my question is how to unbind the <space> key from the
> > > minibuffer-complete-word command when invoking the timeclock-in
> > > command?
>
> > C-q SPC
>
> Sure, you can quote each space character with `C-q'. Or you can fix Emacs to
> do what you want all the time.
>
> Emacs users should be able to type space chars in minibuffer input. Period.
> Emacs 22 finally allows that for file-name input, but it should be available
> for all minibuffer input. Input completion is not limited to command names.
>
> Solutions:
>
> 1. Use Icicles:http://www.emacswiki.org/cgi-bin/wiki/Icicles.
>
> 2. If you don't want to use Icicles, but you do want to allow space chars in
> minibuffer input, do this:
>
>  (define-key minibuffer-local-completion-map
>              " " 'self-insert-command))
>  (define-key minibuffer-local-must-match-map
>              " " 'self-insert-command))
>
> Emacs 22 adds the keymaps `minibuffer-local-filename-completion-map' and
> `minibuffer-local-must-match-filename-map', but space should already DTRT
> there.
>
> You might also want to do the same thing for the `?' character, in the same
> maps: (define-key MAP "?" 'self-insert-command), where MAP is as above (plus
> the two filename completion maps if you use Emacs 22 or later).
>
> In Icicles, BTW, it is `C-?', not `?', that displays help. Printable
> characters like `?' should not need to be quoted to input them.
>
> You might also want to do the same thing for "\n", the newline character.
> Icicles does that so you can have multi-line input without resorting to `C-q
> C-j' for each newline char.
>
> HTH.

Definitely helps - exactly what I was looking for. Thx.


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

* Re: How to insert space in minibuffer while in completing-read ?
       [not found]   ` <mailman.8526.1204927839.18990.help-gnu-emacs@gnu.org>
  2008-03-07 23:34     ` Brian Adkins
@ 2008-03-08 21:24     ` Stefan Monnier
  2008-03-08 22:06       ` Drew Adams
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2008-03-08 21:24 UTC (permalink / raw)
  To: help-gnu-emacs

> 2. If you don't want to use Icicles, but you do want to allow space chars in
> minibuffer input, do this:

>  (define-key minibuffer-local-completion-map
>              " " 'self-insert-command))
>  (define-key minibuffer-local-must-match-map
>              " " 'self-insert-command))

I think you mean to set those keys to nil rather than to
`self-insert-command'.  It may have the same result in 99% of the cases
in the end, of course.


        Stefan


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

* RE: How to insert space in minibuffer while in completing-read ?
  2008-03-08 21:24     ` Stefan Monnier
@ 2008-03-08 22:06       ` Drew Adams
  0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2008-03-08 22:06 UTC (permalink / raw)
  To: 'Stefan Monnier', help-gnu-emacs

> > 2. If you don't want to use Icicles, but you do want to 
> >    allow space chars in minibuffer input, do this:
> 
> >  (define-key minibuffer-local-completion-map
> >              " " 'self-insert-command))
> >  (define-key minibuffer-local-must-match-map
> >              " " 'self-insert-command))
> 
> I think you mean to set those keys to nil rather than to
> `self-insert-command'.  It may have the same result in 99% of 
> the cases in the end, of course.

Right. It's enough to remove the local binding, to restore the global
binding. Either is OK here, but what you suggest is preferable.





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

end of thread, other threads:[~2008-03-08 22:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-07 20:41 How to insert space in minibuffer while in completing-read ? Brian Adkins
2008-03-07 21:26 ` Pascal Bourguignon
2008-03-07 21:53   ` Brian Adkins
2008-03-07 22:09   ` Drew Adams
     [not found]   ` <mailman.8526.1204927839.18990.help-gnu-emacs@gnu.org>
2008-03-07 23:34     ` Brian Adkins
2008-03-08 21:24     ` Stefan Monnier
2008-03-08 22:06       ` Drew Adams

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.