Commit f2440e42 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(locate-file-completion): Handle nil in path-and-suffixes.

(file-truename): Expand all ~ constructs directly.
(insert-directory): Delete any error msg output by the
`insert-directory-program'.
parent 95c12694
...@@ -616,6 +616,8 @@ PATH-AND-SUFFIXES is a pair of lists (DIRECTORIES . SUFFIXES)." ...@@ -616,6 +616,8 @@ PATH-AND-SUFFIXES is a pair of lists (DIRECTORIES . SUFFIXES)."
(suffix (concat (regexp-opt (cdr path-and-suffixes) t) "\\'")) (suffix (concat (regexp-opt (cdr path-and-suffixes) t) "\\'"))
(string-dir (file-name-directory string))) (string-dir (file-name-directory string)))
(dolist (dir (car path-and-suffixes)) (dolist (dir (car path-and-suffixes))
(unless dir
(setq dir default-directory))
(if string-dir (setq dir (expand-file-name string-dir dir))) (if string-dir (setq dir (expand-file-name string-dir dir)))
(when (file-directory-p dir) (when (file-directory-p dir)
(dolist (file (file-name-all-completions (dolist (file (file-name-all-completions
...@@ -668,14 +670,17 @@ Do not specify them in other calls." ...@@ -668,14 +670,17 @@ Do not specify them in other calls."
;; PREV-DIRS can be a cons cell whose car is an alist ;; PREV-DIRS can be a cons cell whose car is an alist
;; of truenames we've just recently computed. ;; of truenames we've just recently computed.
;; The last test looks dubious, maybe `+' is meant here? --simon. (cond ((or (string= filename "") (string= filename "~"))
(if (or (string= filename "") (string= filename "~") (setq filename (expand-file-name filename))
(and (string= (substring filename 0 1) "~") (if (string= filename "")
(string-match "~[^/]*" filename))) (setq filename "/")))
(progn ((and (string= (substring filename 0 1) "~")
(setq filename (expand-file-name filename)) (string-match "~[^/]*/?" filename))
(if (string= filename "") (let ((first-part
(setq filename "/")))) (substring filename 0 (match-end 0)))
(rest (substring filename (match-end 0))))
(setq filename (concat (expand-file-name first-part) rest)))))
(or counter (setq counter (list 100))) (or counter (setq counter (list 100)))
(let (done (let (done
;; For speed, remove the ange-ftp completion handler from the list. ;; For speed, remove the ange-ftp completion handler from the list.
...@@ -4307,6 +4312,8 @@ normally equivalent short `-D' option is just passed on to ...@@ -4307,6 +4312,8 @@ normally equivalent short `-D' option is just passed on to
;; If `insert-directory-program' failed, signal an error. ;; If `insert-directory-program' failed, signal an error.
(unless (eq 0 result) (unless (eq 0 result)
;; Delete the error message it may have output.
(delete-region beg (point))
;; On non-Posix systems, we cannot open a directory, so ;; On non-Posix systems, we cannot open a directory, so
;; don't even try, because that will always result in ;; don't even try, because that will always result in
;; the ubiquitous "Access denied". Instead, show the ;; the ubiquitous "Access denied". Instead, show the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment