From 424f4c9cfaf7c44e1e4ed1cc21d0d13f7dd59331 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 2 Aug 2006 14:08:49 +0000 Subject: [PATCH] =?utf8?q?(PC-expand-many-files):=20Avoid=20signalling=20a?= =?utf8?q?n=20error=20when=20the=20current=20directory=20doesn't=20exist.?= =?utf8?q?=20=20Reported=20by=20Micha=C3=ABl=20Cadilhac.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lisp/ChangeLog | 5 +++++ lisp/complete.el | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9e028970a00..a8d70ba5619 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-02 Stefan Monnier + + * complete.el (PC-expand-many-files): Avoid signalling an error when + the current directory doesn't exist. Reported by Micha,Ak(Bl Cadilhac. + 2006-08-02 Andreas Schwab * bindings.el (mode-line-format): Simplify reference to vc-mode. diff --git a/lisp/complete.el b/lisp/complete.el index ca6231893c3..c49ad488536 100644 --- a/lisp/complete.el +++ b/lisp/complete.el @@ -811,6 +811,12 @@ or properties are considered." (defun PC-expand-many-files (name) (with-current-buffer (generate-new-buffer " *Glob Output*") (erase-buffer) + (when (and (file-name-absolute-p name) + (not (file-directory-p default-directory))) + ;; If the current working directory doesn't exist `shell-command' + ;; signals an error. So if the file names we're looking for don't + ;; depend on the working directory, switch to a valid directory first. + (setq default-directory "/")) (shell-command (concat "echo " name) t) (goto-char (point-min)) ;; CSH-style shells were known to output "No match", whereas -- 2.39.2