From ea912aa6945ae9fb0c2075fca46e39975f8cfaad Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 27 Sep 1992 02:27:00 +0000 Subject: [PATCH] (file-relative-name): Don't lose when DIRECTORY is nil. --- lisp/files.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/files.el b/lisp/files.el index 0e14d0027f2..0a0052a01ae 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -940,7 +940,8 @@ Value is a list whose car is the name for the backup file (defun file-relative-name (filename &optional directory) "Convert FILENAME to be relative to DIRECTORY (default: default-directory)." (setq filename (expand-file-name filename) - directory (file-name-as-directory (or (expand-file-name directory) + directory (file-name-as-directory (if directory + (expand-file-name directory) default-directory))) (while (not (string-match (concat "^" (regexp-quote directory)) filename)) (setq directory (file-name-directory (substring directory 0 -1))))