]> git.eshelyaron.com Git - emacs.git/commitdiff
(completion--try-word-completion): Don't disable
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 14 Apr 2009 02:02:30 +0000 (02:02 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 14 Apr 2009 02:02:30 +0000 (02:02 +0000)
`partial-completion' any more.  Mark the added char instead.
(completion-pcm--string->pattern): Notice chars added by
completion--try-word-completion and treat them specially.

lisp/ChangeLog
lisp/minibuffer.el

index fd14c1aade7377e7fc8a3da6fe62d9430346383a..bb2855cbd2bfcbed355527c8172aed757bb512ec 100644 (file)
@@ -1,3 +1,10 @@
+2009-04-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion--try-word-completion): Don't disable
+       `partial-completion' any more.  Mark the added char instead.
+       (completion-pcm--string->pattern): Notice chars added by
+       completion--try-word-completion and treat them specially.
+
 2009-04-13  Jason Rumney  <jasonr@gnu.org>
 
        * faces.el (frame-set-background-mode): Window system frames
 
 2009-04-13  Kenichi Handa  <handa@m17n.org>
 
-       * language/japanese.el (cp932): Delete alias for
-       japanese-shift-jis.
+       * language/japanese.el (cp932): Delete alias for japanese-shift-jis.
 
 2009-04-12  Michael Albinus  <michael.albinus@gmx.de>
 
-       * net/tramp.el (tramp-do-copy-or-rename-file-directly): Overwrite
-       always the tmpfile.  (Bug#2962).
+       * net/tramp.el (tramp-do-copy-or-rename-file-directly):
+       Overwrite always the tmpfile.  (Bug#2962).
 
 2009-04-11  Chong Yidong  <cyd@stupidchicken.com>
 
@@ -25,8 +31,8 @@
        (hack-dir-local-variables): Adapt to new
        dir-locals-directory-cache entry format.
 
-       * international/mule-diag.el (describe-font-internal): Change
-       ignored argument to IGNORED.
+       * international/mule-diag.el (describe-font-internal):
+       Rename ignored argument to IGNORED.
        (describe-font): Elide unnecessary argument to
        describe-font-internal (Bug#2945).
 
@@ -85,8 +91,7 @@
 
 2009-04-09  Michael Albinus  <michael.albinus@gmx.de>
 
-       * net/tramp.el (tramp-file-name-handler-alist): Add
-       `vc-registered'.
+       * net/tramp.el (tramp-file-name-handler-alist): Add `vc-registered'.
        (tramp-handle-vc-registered ): New defun.  (Bug#1741).
 
        * net/tramp-cache.el (tramp-flush-directory-property): Use the
index 92325ae4958bfe1a1f6a174198c93fe52577b1fe..911a6b3c2d9aab7b733dad83d7a12d52757439c4 100644 (file)
@@ -607,13 +607,17 @@ If `minibuffer-completion-confirm' is `confirm-after-completion',
       ;; If completion finds next char not unique,
       ;; consider adding a space or a hyphen.
       (when (= (length string) (length (car comp)))
-        (let ((exts '(" " "-"))
+        ;; Mark the added char with the `completion-word' property, so it
+        ;; can be handled specially by completion styles such as
+        ;; partial-completion.
+        ;; We used to remove `partial-completion' from completion-styles
+        ;; instead, but it was too blunt, leading to situations where SPC
+        ;; was the only insertable char at point but minibuffer-complete-word
+        ;; refused inserting it.
+        (let ((exts (mapcar (lambda (str) (propertize str 'completion-try-word t))
+                            '(" " "-")))
               (before (substring string 0 point))
               (after (substring string point))
-             ;; Disable partial-completion for this.
-             (completion-styles
-              (or (remove 'partial-completion completion-styles)
-                  completion-styles))
              tem)
          (while (and exts (not (consp tem)))
             (setq tem (completion-try-completion
@@ -1381,7 +1385,13 @@ or a symbol chosen among `any', `star', `point'."
           (p 0)
           (p0 0))
 
-      (while (setq p (string-match-p completion-pcm--delim-wild-regex string p))
+      (while (and (setq p (string-match-p completion-pcm--delim-wild-regex
+                                          string p))
+                  ;; If the char was added by minibuffer-complete-word, then
+                  ;; don't treat it as a delimiter, otherwise "M-x SPC"
+                  ;; ends up inserting a "-" rather than listing
+                  ;; all completions.
+                  (not (get-text-property p 'completion-try-word string)))
         (push (substring string p0 p) pattern)
         (if (eq (aref string p) ?*)
             (progn