GNU bug report logs - #4176
23.1; partial completions

Previous Next

Package: emacs;

Reported by: Eli Barzilay <eli <at> barzilay.org>

Date: Mon, 17 Aug 2009 14:35:04 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

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 4176 in the body.
You can then email your comments to 4176 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4176; Package emacs. (Mon, 17 Aug 2009 14:35:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eli Barzilay <eli <at> barzilay.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 17 Aug 2009 14:35:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Eli Barzilay <eli <at> barzilay.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; partial completions
Date: Mon, 17 Aug 2009 10:30:10 -0400
With the default settings, enter

  C-h f select-window TAB

and Emacs will tell you that this is the only completion.

Trying this with `sele-wind TAB' does a partial completion to
`select-window' and moves the cursor to the right place -- a
second TAB pops up the completions (showing both functions) saying
"complete but not unique" *but* moves the cursor to the end.

It would be very nice if the cursor was always at the right place, and
it would not say that this is the only completion.  Doing

  (setq completion-styles '(partial-completion))

is fixes the message, but the cursor still moves to the end.

Another related problem -- the doc string for `completion-styles'
doesn't say anything about what's allowed (should mention
`completion-styles-alist').  Also, the functions that are used in
`completion-styles-alist' are not documented -- which leaves the user
with no explanation at all about the available completion styles.



In GNU Emacs 23.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.10.14)
 of 2009-08-01 on winooski.ccs.neu.edu
Windowing system distributor `The X.Org Foundation', version 11.0.10300000
configured using `configure  '--prefix=/home/eli/bin/local/emacs-dir''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  whitespace-mode: t
  cua-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
l e c t <tab> <tab> <tab> <tab> <tab> <tab> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
- w i <tab> <tab> <C-left> <end> <tab> <tab> <tab> 
<tab> <tab> <tab> <C-left> <left> l <end> <tab> <tab> 
<tab> <tab> <tab> <tab> <tab> C-g C-g C-g <up> <left> 
<left> <delete> <up> ; <f2> <down> <down> <right> C-x 
C-e C-h f s e l e c <tab> - w i n <tab> <tab> <tab> 
<tab> <C-left> <C-left> <C-right> <tab> <C-left> <left> 
<tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> 
<C-left> <left> <tab> <tab> <tab> <tab> <tab> <tab> 
<tab> <tab> <tab> <tab> <C-left> <C-left> <C-right> 
<tab> <tab> <tab> <tab> <tab> <tab> C-g <up> <left> 
<left> ; <left> <up> <delete> <up> <delete> <f2> <down> 
<down> <down> <end> C-x C-e <up> C-h f s e l e - w 
i n d <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> 
<tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> 
<tab> <tab> <C-left> <left> <tab> <tab> <tab> <tab> 
<tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> 
<tab> <left> <left> <C-left> <left> <tab> <tab> <tab> 
<tab> <tab> <tab> <tab> C-g C-g C-h f s e l - w i n 
<tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> C-g 
C-g <up> <C-left> <up> ; <f2> <down> <down> <down> 
<end> C-x C-e C-h f s e l e c t - w i n d o <C-left> 
<C-left> <C-right> <backspace> <backspace> <tab> <tab> 
<tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> 
<tab> <tab> <tab> <tab> <tab> <tab> C-g C-g C-h f s 
e l - w i n <tab> <tab> <tab> <tab> <tab> <tab> <tab> 
<tab> C-g C-g M-x r e p o r t - w i n <backspace> <backspace> 
e <backspace> <backspace> e m a - b u <tab> <retur
n>




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4176; Package emacs. (Mon, 17 Aug 2009 15:00:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eli Barzilay <eli <at> barzilay.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 17 Aug 2009 15:00:05 GMT) Full text and rfc822 format available.

Message #10 received at 4176 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Eli Barzilay <eli <at> barzilay.org>
To: 4176 <at> debbugs.gnu.org
Subject: Re: bug#4176: Acknowledgement (23.1; partial completions)
Date: Mon, 17 Aug 2009 10:52:08 -0400
After a quick look, I tried to redefine `minibuffer-complete' and just
comment out the second (goto-char (field-end)).  This seems to work
wrt wrongly moving the cursor to the end which seems to resolve both
problems when combined with

  (setq completion-styles '(partial-completion))

However,

1. Since this code was put there explicitly, there must be some issue
   I don't see in removing it.

2. Even after the quick code browse I have no idea what wonderful
   features I'm losing by removing `basic' and `emacs22' from
   `completion-styles'.  I would be happy if someone can enlighten me.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4176; Package emacs. (Mon, 17 Aug 2009 20:05:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 17 Aug 2009 20:05:05 GMT) Full text and rfc822 format available.

Message #15 received at 4176 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Barzilay <eli <at> barzilay.org>
Cc: 4176 <at> debbugs.gnu.org
Subject: Re: bug#4176: Acknowledgement (23.1; partial completions)
Date: Mon, 17 Aug 2009 15:57:21 -0400
> After a quick look, I tried to redefine `minibuffer-complete' and just
> comment out the second (goto-char (field-end)).  This seems to work
> wrt wrongly moving the cursor to the end which seems to resolve both
[...]
> 1. Since this code was put there explicitly, there must be some issue
>    I don't see in removing it.

I don't have time to dig into this right now, but the cursor placement
is fairly tricky indeed, and there are often different valid choices
depending on your particular preferences.

The rule I tried to follow (in the partia-completion code) is that the
cursor should be placed to the rightmost position that still offers ways
to persue completion.  In your `select-window' example, it seems that
the behavior doesn't follow this rule, so it might indeed be
a plain bug.

> 2. Even after the quick code browse I have no idea what wonderful
>    features I'm losing by removing `basic' and `emacs22' from
>    `completion-styles'.  I would be happy if someone can enlighten me.

You lose the fact that the default Emacs-23 completion is a compromise
between the non-partial-completion and the partial-completion behavior.
If you used partial-completion and liked it, you probably want to do
(setq completion-styles '(partial-completion)) like you did.
But remember that enabling partial-completion by default in Emacs-23
didn't get accepted without a fight.


        Stefan



Reply sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
You have taken responsibility. (Thu, 20 Aug 2009 20:30:28 GMT) Full text and rfc822 format available.

Notification sent to Eli Barzilay <eli <at> barzilay.org>:
bug acknowledged by developer. (Thu, 20 Aug 2009 20:30:29 GMT) Full text and rfc822 format available.

Message #20 received at 4176-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Eli Barzilay <eli <at> barzilay.org>
Subject: Re: bug#4176: 23.1; partial completions
Date: Tue, 18 Aug 2009 15:11:54 -0400
>>>>> "Eli" == Eli Barzilay <eli <at> barzilay.org> writes:

> With the default settings, enter
>   C-h f select-window TAB

> and Emacs will tell you that this is the only completion.

> Trying this with `sele-wind TAB' does a partial completion to
> `select-window' and moves the cursor to the right place -- a
> second TAB pops up the completions (showing both functions) saying
> "complete but not unique" *but* moves the cursor to the end.

Removing the second (goto-char (field-end)) in minibuffer-complete was
indeed a correct solution, in the end.  I've installed a sligtly
different patch so that the point-motion is consolidated inside
completion--do-completion.  See below the patch I installed.

> It would be very nice if the cursor was always at the right place, and
> it would not say that this is the only completion.  Doing

>   (setq completion-styles '(partial-completion))

> is fixes the message, but the cursor still moves to the end.

The "sole completion" message is correct, given the default value of
completion-styles.

> Another related problem -- the doc string for `completion-styles'
> doesn't say anything about what's allowed (should mention
> `completion-styles-alist').

Thanks, it does mention it now.

> Also, the functions that are used in `completion-styles-alist' are not
> documented -- which leaves the user with no explanation at all about
> the available completion styles.

The functions are low-level, so the user shouldn't be expected to look
at them and/or their docstrings to find out what the style does.
The name of the style should hopefully be sufficient.


        Stefan


--- minibuffer.el.~1.77.~	2009-08-04 14:03:35.000000000 -0400
+++ minibuffer.el	2009-08-18 15:07:35.000000000 -0400
@@ -308,7 +308,8 @@
 ALL-COMPLETIONS is the function that lists the completions.")
 
 (defcustom completion-styles '(basic partial-completion emacs22)
-  "List of completion styles to use."
+  "List of completion styles to use.
+The available styles are listed in `completion-styles-alist'."
   :type `(repeat (choice ,@(mapcar (lambda (x) (list 'const (car x)))
                                    completion-styles-alist)))
   :group 'minibuffer
@@ -388,7 +389,9 @@
     (cond
      ((null comp)
       (ding) (minibuffer-message "No match") (minibuffer--bitset nil nil nil))
-     ((eq t comp) (minibuffer--bitset nil nil t)) ;Exact and unique match.
+     ((eq t comp)
+      (goto-char (field-end))
+      (minibuffer--bitset nil nil t)) ;Exact and unique match.
      (t
       ;; `completed' should be t if some completion was done, which doesn't
       ;; include simply changing the case of the entered string.  However,
@@ -462,11 +465,9 @@
 
       (case (completion--do-completion)
         (#b000 nil)
-        (#b001 (goto-char (field-end))
-               (minibuffer-message "Sole completion")
+        (#b001 (minibuffer-message "Sole completion")
                t)
-        (#b011 (goto-char (field-end))
-               (minibuffer-message "Complete, but not unique")
+        (#b011 (minibuffer-message "Complete, but not unique")
                t)
         (t     t)))))
 
@@ -694,11 +695,9 @@
   (interactive)
   (case (completion--do-completion 'completion--try-word-completion)
     (#b000 nil)
-    (#b001 (goto-char (field-end))
-           (minibuffer-message "Sole completion")
+    (#b001 (minibuffer-message "Sole completion")
            t)
-    (#b011 (goto-char (field-end))
-           (minibuffer-message "Complete, but not unique")
+    (#b011 (minibuffer-message "Complete, but not unique")
            t)
     (t     t)))
 



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Fri, 18 Sep 2009 14:24:17 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 278 days ago.

Previous Next


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