Mercurial > emacs
changeset 94302:5a4d9f3d23f9
(PC-do-completion): Be more robust in the presence of
unexpected values in minibuffer-completion-predicate.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 23 Apr 2008 18:39:22 +0000 |
parents | 9060af7294b9 |
children | e0b01f455de0 |
files | lisp/ChangeLog lisp/complete.el |
diffstat | 2 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Wed Apr 23 18:37:50 2008 +0000 +++ b/lisp/ChangeLog Wed Apr 23 18:39:22 2008 +0000 @@ -1,5 +1,8 @@ 2008-04-23 Stefan Monnier <monnier@iro.umontreal.ca> + * complete.el (PC-do-completion): Be more robust in the presence of + unexpected values in minibuffer-completion-predicate. + * minibuffer.el (read-file-name): Don't let-bind default-directory. Only abbreviate default-filename if it's a file.
--- a/lisp/complete.el Wed Apr 23 18:37:50 2008 +0000 +++ b/lisp/complete.el Wed Apr 23 18:39:22 2008 +0000 @@ -491,8 +491,9 @@ (and filename (let ((dir (file-name-directory str)) (file (file-name-nondirectory str)) - ;; The base dir for file-completion is passed in `predicate'. - (default-directory (expand-file-name pred))) + ;; The base dir for file-completion was passed in `predicate'. + (default-directory (if (stringp pred) (expand-file-name pred) + default-directory))) (while (and (stringp dir) (not (file-directory-p dir))) (setq dir (directory-file-name dir)) (setq file (concat (replace-regexp-in-string @@ -506,8 +507,9 @@ (and filename (string-match "\\*.*/" str) (let ((pat str) - ;; The base dir for file-completion is passed in `predicate'. - (default-directory (expand-file-name pred)) + ;; The base dir for file-completion was passed in `predicate'. + (default-directory (if (stringp pred) (expand-file-name pred) + default-directory)) files) (setq p (1+ (string-match "/[^/]*\\'" pat))) (while (setq p (string-match PC-delim-regex pat p)) @@ -522,7 +524,8 @@ (while (and (setq p (cdr p)) (equal dir (file-name-directory (car p))))) (if p - (setq filename nil table nil pred nil + (setq filename nil table nil + pred (if (stringp pred) nil pred) ambig t) (delete-region beg end) (setq str (concat dir (file-name-nondirectory str))) @@ -535,7 +538,8 @@ ;; even if we couldn't, so remove the added ;; wildcards. (setq str origstr) - (setq filename nil table nil pred nil))))) + (setq filename nil table nil + pred (if (stringp pred) nil pred)))))) ;; Strip directory name if appropriate (if filename