aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/complete.el16
2 files changed, 13 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9f4da1f394a..11355da864c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12008-04-23 Stefan Monnier <monnier@iro.umontreal.ca> 12008-04-23 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * complete.el (PC-do-completion): Be more robust in the presence of
4 unexpected values in minibuffer-completion-predicate.
5
3 * minibuffer.el (read-file-name): Don't let-bind default-directory. 6 * minibuffer.el (read-file-name): Don't let-bind default-directory.
4 Only abbreviate default-filename if it's a file. 7 Only abbreviate default-filename if it's a file.
5 8
diff --git a/lisp/complete.el b/lisp/complete.el
index 3c4385273d1..c16e4af61c0 100644
--- a/lisp/complete.el
+++ b/lisp/complete.el
@@ -491,8 +491,9 @@ GOTO-END is non-nil, however, it instead replaces up to END."
491 (and filename 491 (and filename
492 (let ((dir (file-name-directory str)) 492 (let ((dir (file-name-directory str))
493 (file (file-name-nondirectory str)) 493 (file (file-name-nondirectory str))
494 ;; The base dir for file-completion is passed in `predicate'. 494 ;; The base dir for file-completion was passed in `predicate'.
495 (default-directory (expand-file-name pred))) 495 (default-directory (if (stringp pred) (expand-file-name pred)
496 default-directory)))
496 (while (and (stringp dir) (not (file-directory-p dir))) 497 (while (and (stringp dir) (not (file-directory-p dir)))
497 (setq dir (directory-file-name dir)) 498 (setq dir (directory-file-name dir))
498 (setq file (concat (replace-regexp-in-string 499 (setq file (concat (replace-regexp-in-string
@@ -506,8 +507,9 @@ GOTO-END is non-nil, however, it instead replaces up to END."
506 (and filename 507 (and filename
507 (string-match "\\*.*/" str) 508 (string-match "\\*.*/" str)
508 (let ((pat str) 509 (let ((pat str)
509 ;; The base dir for file-completion is passed in `predicate'. 510 ;; The base dir for file-completion was passed in `predicate'.
510 (default-directory (expand-file-name pred)) 511 (default-directory (if (stringp pred) (expand-file-name pred)
512 default-directory))
511 files) 513 files)
512 (setq p (1+ (string-match "/[^/]*\\'" pat))) 514 (setq p (1+ (string-match "/[^/]*\\'" pat)))
513 (while (setq p (string-match PC-delim-regex pat p)) 515 (while (setq p (string-match PC-delim-regex pat p))
@@ -522,7 +524,8 @@ GOTO-END is non-nil, however, it instead replaces up to END."
522 (while (and (setq p (cdr p)) 524 (while (and (setq p (cdr p))
523 (equal dir (file-name-directory (car p))))) 525 (equal dir (file-name-directory (car p)))))
524 (if p 526 (if p
525 (setq filename nil table nil pred nil 527 (setq filename nil table nil
528 pred (if (stringp pred) nil pred)
526 ambig t) 529 ambig t)
527 (delete-region beg end) 530 (delete-region beg end)
528 (setq str (concat dir (file-name-nondirectory str))) 531 (setq str (concat dir (file-name-nondirectory str)))
@@ -535,7 +538,8 @@ GOTO-END is non-nil, however, it instead replaces up to END."
535 ;; even if we couldn't, so remove the added 538 ;; even if we couldn't, so remove the added
536 ;; wildcards. 539 ;; wildcards.
537 (setq str origstr) 540 (setq str origstr)
538 (setq filename nil table nil pred nil))))) 541 (setq filename nil table nil
542 pred (if (stringp pred) nil pred))))))
539 543
540 ;; Strip directory name if appropriate 544 ;; Strip directory name if appropriate
541 (if filename 545 (if filename