1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-12 16:23:57 +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 directory (file-name-as-directory (if directory
(expand-file-name directory) (expand-file-name directory)
default-directory))) default-directory)))
(while (not (string-match (concat "^" (regexp-quote directory)) filename)) (let ((strip (lambda (directory)
(setq directory (file-name-directory (substring directory 0 -1)))) (cond ((string= directory "/")
(substring filename (match-end 0))) 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) (defun save-buffer (&optional args)
"Save current buffer in visited file if modified. Versions described below. "Save current buffer in visited file if modified. Versions described below.