GNU bug report logs - #12861
wrong default value when completing in woman-file-name

Previous Next

Package: emacs;

Reported by: Jonas Bernoulli <jonas <at> bernoul.li>

Date: Sun, 11 Nov 2012 14:39:02 UTC

Severity: minor

Tags: patch

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12861 in the body.
You can then email your comments to 12861 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12861; Package emacs. (Sun, 11 Nov 2012 14:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jonas Bernoulli <jonas <at> bernoul.li>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 11 Nov 2012 14:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jonas Bernoulli <jonas <at> bernoul.li>
To: bug-gnu-emacs <at> gnu.org
Subject: wrong default value when completing in woman-file-name
Date: Sun, 11 Nov 2012 15:30:00 +0100
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12861; Package emacs. (Sun, 11 Nov 2012 15:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 12861 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jonas Bernoulli <jonas <at> bernoul.li>
Cc: 12861 <at> debbugs.gnu.org
Subject: Re: bug#12861: wrong default value when completing in woman-file-name
Date: Sun, 11 Nov 2012 10:54:53 -0500
> 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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12861; Package emacs. (Mon, 12 Nov 2012 22:16:02 GMT) Full text and rfc822 format available.

Message #11 received at 12861 <at> debbugs.gnu.org (full text, mbox):

From: Jonas Bernoulli <jonas <at> bernoul.li>
To: "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Cc: 12861 <at> debbugs.gnu.org
Subject: Re: bug#12861: wrong default value when completing in woman-file-name
Date: Mon, 12 Nov 2012 23:15:20 +0100
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12861; Package emacs. (Tue, 13 Nov 2012 17:03:01 GMT) Full text and rfc822 format available.

Message #14 received at 12861 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Jonas Bernoulli <jonas <at> bernoul.li>
Cc: 12861 <at> debbugs.gnu.org
Subject: Re: bug#12861: wrong default value when completing in woman-file-name
Date: Tue, 13 Nov 2012 12:01:50 -0500
> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12861; Package emacs. (Tue, 13 Nov 2012 22:03:02 GMT) Full text and rfc822 format available.

Message #17 received at 12861 <at> debbugs.gnu.org (full text, mbox):

From: Jonas Bernoulli <jonas <at> bernoul.li>
To: "Stefan Monnier" <monnier <at> IRO.UMontreal.CA>
Cc: 12861 <at> debbugs.gnu.org
Subject: Re: bug#12861: wrong default value when completing in woman-file-name
Date: Tue, 13 Nov 2012 23:01:38 +0100
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




bug closed, send any further explanations to 12861 <at> debbugs.gnu.org and Jonas Bernoulli <jonas <at> bernoul.li> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 08 Dec 2012 04:15:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 05 Jan 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 254 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.