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.

Full log


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



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.