diff options
author | Roland McGrath <roland@gnu.org> | 1992-09-27 02:40:49 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1992-09-27 02:40:49 +0000 |
commit | e8f0b1049424e62b1ba6cc44d331517427ab49af (patch) | |
tree | 5b4787e5e5bd175562a310c9f3dc8c8017fb82e7 /lisp | |
parent | 71175aea41879759c3768d014fab231cdb633611 (diff) | |
download | emacs-e8f0b1049424e62b1ba6cc44d331517427ab49af.tar.gz |
(file-relative-name): Rewritten so unrelativizable file names win.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/files.el | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/files.el b/lisp/files.el index 0a0052a01ae..db50e86dccb 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -943,9 +943,17 @@ Value is a list whose car is the name for the backup file 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)))) - (substring filename (match-end 0))) + (let ((strip (lambda (directory) + (cond ((string= directory "/") + filename) + ((string-match (concat "^" (regexp-quote directory)) + filename) + (substring filename (match-end 0))) + (t + (funcall strip + (file-name-directory (substring directory + 0 -1)))))))) + (funcall strip directory))) (defun save-buffer (&optional args) "Save current buffer in visited file if modified. Versions described below. |