1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-25 10:47:00 +00:00

(file-relative-name): Rewritten so unrelativizable file names win.

This commit is contained in:
Roland McGrath 1992-09-27 02:40:49 +00:00
parent ea912aa694
commit 71fe1fcc56

View File

@ -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.