mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
(file-relative-name): New function.
This commit is contained in:
parent
1d30b62aa7
commit
6c636af99b
1 changed files with 9 additions and 0 deletions
|
|
@ -936,6 +936,15 @@ Value is a list whose car is the name for the backup file
|
|||
(defun file-nlinks (filename)
|
||||
"Return number of names file FILENAME has."
|
||||
(car (cdr (file-attributes filename))))
|
||||
|
||||
(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)
|
||||
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)))
|
||||
|
||||
(defun save-buffer (&optional args)
|
||||
"Save current buffer in visited file if modified. Versions described below.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue