unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12861: wrong default value when completing in woman-file-name
@ 2012-11-11 14:30 Jonas Bernoulli
  2012-11-11 15:54 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Jonas Bernoulli @ 2012-11-11 14:30 UTC (permalink / raw)
  To: 12861

I don't use TAB to `minibuffer-complete' (I use <tab> and use C-i as a
key combination that does not have anything to do with the Tab key).

In `woman-file-name' TAB is unread, which in my case causes the
previously selected file to become the initial input for
`completing-read'.  That file is the last man page I looked at, usually
that is not the command I want to look at now.  This means that I often
get some bogus initial value in the minibuffer which I first have to
delete, then I complete to get the common prefix, and only then I can
actually select one of the files that correspond to the topic I want to
look up.

Could you please change this so that the key sequence actually used to
invoke `minibuffer-complete' is unread instead of TAB (or just call
`minibuffer-complete' explicitly?).

Thanks,
Jonas





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

* bug#12861: wrong default value when completing in woman-file-name
  2012-11-11 14:30 bug#12861: wrong default value when completing in woman-file-name Jonas Bernoulli
@ 2012-11-11 15:54 ` Stefan Monnier
  2012-11-12 22:15   ` Jonas Bernoulli
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2012-11-11 15:54 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: 12861

> Could you please change this so that the key sequence actually used to
> invoke `minibuffer-complete' is unread instead of TAB (or just call
> `minibuffer-complete' explicitly?).

Unreading events is nasty business.  Sometimes it's hard to avoid, but
I don't think it's justified here, indeed.  The patch below should fix
your problem, but could you confirm it provides the intended
completion behavior?


        Stefan


=== modified file 'lisp/woman.el'
--- lisp/woman.el	2012-10-29 10:30:11 +0000
+++ lisp/woman.el	2012-11-11 15:54:23 +0000
@@ -1303,12 +1303,11 @@
        ((null (cdr files)) (car (car files))) ; only 1 file for topic.
        (t
 	;; Multiple files for topic, so must select 1.
-	;; Unread the command event (TAB = ?\t = 9) that runs the command
-	;; `minibuffer-complete' in order to automatically complete the
-	;; minibuffer contents as far as possible.
-	(setq unread-command-events '(9)) ; and delete any type-ahead!
+	;; Run the command `minibuffer-complete' in order to automatically
+	;; complete the minibuffer contents as far as possible.
+        (minibuffer-with-setup-hook #'minibuffer-complete
 	(completing-read "Manual file: " files nil 1
-			 (try-completion "" files) 'woman-file-history))))))
+                           (try-completion "" files) 'woman-file-history)))))))
 
 (defun woman-select (predicate list)
   "Select unique elements for which PREDICATE is true in LIST.






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

* bug#12861: wrong default value when completing in woman-file-name
  2012-11-11 15:54 ` Stefan Monnier
@ 2012-11-12 22:15   ` Jonas Bernoulli
  2012-11-13 17:01     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Jonas Bernoulli @ 2012-11-12 22:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12861


Stefan Monnier writes:

>> Could you please change this so that the key sequence actually used to
>> invoke `minibuffer-complete' is unread instead of TAB (or just call
>> `minibuffer-complete' explicitly?).
>
> The patch below should fix your problem, but could you confirm it
> provides the intended completion behavior?

With emacs -Q it works but with my configuration it doesn't.  I think
that again me using <tab> instead of TAB to complete causes this.  I
will let you know once I have verified this.

The problem I see is that iff the selected topic is also the prefix of
other available topics (e.g. git-prune[-packed]) then pressing <tab>
when completing the *file-name* does not cause the *Completions* buffer
to appear.  When I do something before pressing <tab> (e.g. delete a
character or C-h c <tab> to verify it is indeed bound to
`minibuffer-complete') and *then* press <tab> then the completions are
shown, just not when completing immediately.

-- Jonas





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

* bug#12861: wrong default value when completing in woman-file-name
  2012-11-12 22:15   ` Jonas Bernoulli
@ 2012-11-13 17:01     ` Stefan Monnier
  2012-11-13 22:01       ` Jonas Bernoulli
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2012-11-13 17:01 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: 12861

> With emacs -Q it works but with my configuration it doesn't.  I think
> that again me using <tab> instead of TAB to complete causes this.
> I will let you know once I have verified this.

Thanks.  I've installed the patch because it's an improvement in any case.

> The problem I see is that iff the selected topic is also the prefix of
> other available topics (e.g. git-prune[-packed]) then pressing <tab>
> when completing the *file-name* does not cause the *Completions* buffer
> to appear.  When I do something before pressing <tab> (e.g. delete a
> character or C-h c <tab> to verify it is indeed bound to
> `minibuffer-complete') and *then* press <tab> then the completions are
> shown, just not when completing immediately.

Hmm... it rings a very distant bell, but without a test-case I don't
think I'll be able to attack this problem.
Can you provide a stripped down version of your config along with a few
steps to reproduce the problem?


        Stefan





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

* bug#12861: wrong default value when completing in woman-file-name
  2012-11-13 17:01     ` Stefan Monnier
@ 2012-11-13 22:01       ` Jonas Bernoulli
  0 siblings, 0 replies; 5+ messages in thread
From: Jonas Bernoulli @ 2012-11-13 22:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12861


Stefan Monnier writes:

> I've installed the patch because it's an improvement in any case.

The patch you installed is different from what you posted here.  Which
is good; with the installed patch completion works even when using <tab>
to invoke minibuffer-complete.

Thanks a lot,
Jonas





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

end of thread, other threads:[~2012-11-13 22:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-11 14:30 bug#12861: wrong default value when completing in woman-file-name Jonas Bernoulli
2012-11-11 15:54 ` Stefan Monnier
2012-11-12 22:15   ` Jonas Bernoulli
2012-11-13 17:01     ` Stefan Monnier
2012-11-13 22:01       ` Jonas Bernoulli

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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