mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-12 10:44:12 -08:00
(PC-do-completion): Be more robust in the presence of
unexpected values in minibuffer-completion-predicate.
This commit is contained in:
parent
e8a5fe3ed8
commit
2f65ac9e19
2 changed files with 13 additions and 6 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -491,8 +491,9 @@ GOTO-END is non-nil, however, it instead replaces up to END."
|
|||
(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 @@ GOTO-END is non-nil, however, it instead replaces up to END."
|
|||
(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 @@ GOTO-END is non-nil, however, it instead replaces up to END."
|
|||
(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 @@ GOTO-END is non-nil, however, it instead replaces up to END."
|
|||
;; 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue