aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/complete.el31
2 files changed, 33 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a690990fb64..bcca10ab0f1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12007-03-09 Martin Rudalics <rudalics@gmx.at>
2
3 * complete.el (PC-try-completion): New function.
4 (PC-do-completion, read-file-name-internal): Use it instead of
5 try-completion.
6
12007-03-08 Alan Mackenzie <acm@muc.de> 72007-03-08 Alan Mackenzie <acm@muc.de>
2 8
3 * progmodes/cc-mode.el (c-unfind-enclosing-token, 9 * progmodes/cc-mode.el (c-unfind-enclosing-token,
diff --git a/lisp/complete.el b/lisp/complete.el
index 5762a5dd69c..a5f3eea955d 100644
--- a/lisp/complete.el
+++ b/lisp/complete.el
@@ -387,6 +387,29 @@ of `minibuffer-completion-table' and the minibuffer contents.")
387 (let ((completion-ignore-case nil)) 387 (let ((completion-ignore-case nil))
388 (test-completion str table pred)))) 388 (test-completion str table pred))))
389 389
390;; The following function is an attempt to work around two problems:
391
392;; (1) When complete.el was written, (try-completion "" '(("") (""))) used to
393;; return the value "". With a change from 2002-07-07 it returns t which caused
394;; `PC-lisp-complete-symbol' to fail with a "Wrong type argument: sequencep, t"
395;; error. `PC-try-completion' returns STRING in this case.
396
397;; (2) (try-completion "" '((""))) returned t before the above-mentioned change.
398;; Since `PC-chop-word' operates on the return value of `try-completion' this
399;; case might have provoked a similar error as in (1). `PC-try-completion'
400;; returns "" instead. I don't know whether this is a real problem though.
401
402;; Since `PC-try-completion' is not a guaranteed to fix these bugs reliably, you
403;; should try to look at the following discussions when you encounter problems:
404;; - emacs-pretest-bug ("Partial Completion" starting 2007-02-23),
405;; - emacs-devel ("[address-of-OP: Partial completion]" starting 2007-02-24),
406;; - emacs-devel ("[address-of-OP: EVAL and mouse selection in *Completions*]"
407;; starting 2007-03-05).
408(defun PC-try-completion (string alist &optional predicate)
409 "Like `try-completion' but return STRING instead of t."
410 (let ((result (try-completion string alist predicate)))
411 (if (eq result t) string result)))
412
390(defun PC-do-completion (&optional mode beg end) 413(defun PC-do-completion (&optional mode beg end)
391 (or beg (setq beg (minibuffer-prompt-end))) 414 (or beg (setq beg (minibuffer-prompt-end)))
392 (or end (setq end (point-max))) 415 (or end (setq end (point-max)))
@@ -637,8 +660,8 @@ of `minibuffer-completion-table' and the minibuffer contents.")
637 660
638 ;; Check if next few letters are the same in all cases 661 ;; Check if next few letters are the same in all cases
639 (if (and (not (eq mode 'help)) 662 (if (and (not (eq mode 'help))
640 (setq prefix (try-completion (PC-chunk-after basestr skip) 663 (setq prefix (PC-try-completion
641 poss))) 664 (PC-chunk-after basestr skip) poss)))
642 (let ((first t) i) 665 (let ((first t) i)
643 ;; Retain capitalization of user input even if 666 ;; Retain capitalization of user input even if
644 ;; completion-ignore-case is set. 667 ;; completion-ignore-case is set.
@@ -676,7 +699,7 @@ of `minibuffer-completion-table' and the minibuffer contents.")
676 (setq skip (concat skip 699 (setq skip (concat skip
677 (regexp-quote prefix) 700 (regexp-quote prefix)
678 PC-ndelims-regex) 701 PC-ndelims-regex)
679 prefix (try-completion 702 prefix (PC-try-completion
680 (PC-chunk-after 703 (PC-chunk-after
681 ;; not basestr, because that does 704 ;; not basestr, because that does
682 ;; not reflect insertions 705 ;; not reflect insertions
@@ -1010,7 +1033,7 @@ absolute rather than relative to some directory on the SEARCH-PATH."
1010 (cond 1033 (cond
1011 ((not completion-table) nil) 1034 ((not completion-table) nil)
1012 ((eq action 'lambda) (test-completion str2 completion-table nil)) 1035 ((eq action 'lambda) (test-completion str2 completion-table nil))
1013 ((eq action nil) (try-completion str2 completion-table nil)) 1036 ((eq action nil) (PC-try-completion str2 completion-table nil))
1014 ((eq action t) (all-completions str2 completion-table nil))))) 1037 ((eq action t) (all-completions str2 completion-table nil)))))
1015 ad-do-it)) 1038 ad-do-it))
1016 1039