(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.
This commit is contained in:
Stefan Monnier 2009-04-14 02:02:30 +00:00
parent d156542d90
commit 1afbbf8521
2 changed files with 29 additions and 14 deletions

View 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
@ -6,13 +13,12 @@
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

View 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