# HG changeset patch # User Stefan Monnier # Date 1239674550 0 # Node ID ca1d2b3eaecca80047e1301c24119b1fc31b82b6 # Parent b145ec03f3783f01cd9affe145c1c899d3dab693 (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. diff -r b145ec03f378 -r ca1d2b3eaecc lisp/ChangeLog --- a/lisp/ChangeLog Tue Apr 14 01:27:02 2009 +0000 +++ b/lisp/ChangeLog Tue Apr 14 02:02:30 2009 +0000 @@ -1,3 +1,10 @@ +2009-04-14 Stefan Monnier + + * 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 * faces.el (frame-set-background-mode): Window system frames @@ -6,13 +13,12 @@ 2009-04-13 Kenichi Handa - * 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 - * 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 @@ -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 - * 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 diff -r b145ec03f378 -r ca1d2b3eaecc lisp/minibuffer.el --- a/lisp/minibuffer.el Tue Apr 14 01:27:02 2009 +0000 +++ b/lisp/minibuffer.el Tue Apr 14 02:02:30 2009 +0000 @@ -607,13 +607,17 @@ ;; 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 @@ (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