From eeffc1f5ae36284e8d08c0f529e115032d7e0d04 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 14 Oct 2022 21:32:15 +0200 Subject: [PATCH] Rename `file-attribute-file-number' to `file-attribute-file-identifier' * doc/lispref/files.texi (File Attributes): * etc/NEWS: * lisp/files.el (find-buffer-visiting, find-file-noselect) (set-visited-file-name, basic-save-buffer) (file-attribute-file-identifier): * lisp/startup.el (normal-top-level-add-subdirs-to-load-path): * lisp/eshell/em-unix.el (eshell-shuffle-files): * src/dired.c (Ffile_attributes): Rename `file-attribute-file-number' to `file-attribute-file-identifier'. --- doc/lispref/files.texi | 2 +- etc/NEWS | 2 +- lisp/eshell/em-unix.el | 4 ++-- lisp/files.el | 11 ++++++----- lisp/startup.el | 3 ++- src/dired.c | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 2467364dc6e..b26d4f10585 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -1413,7 +1413,7 @@ to distinguish remote filesystems from local ones. The file's inode and device together give enough information to distinguish any two files on the system---no two files can have the same values for both of these attributes. This tuple that uniquely -identifies the file is returned by @code{file-attribute-file-number}. +identifies the file is returned by @code{file-attribute-file-identifier}. For example, here are the file attributes for @file{files.texi}: diff --git a/etc/NEWS b/etc/NEWS index b73c2c47d5d..96415870523 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3159,7 +3159,7 @@ The following generalized variables have been made obsolete: * Lisp Changes in Emacs 29.1 +++ -** New accessor function 'file-attribute-file-number'. +** New accessor function 'file-attribute-file-identifier'. It returns the list of the inode number and device identifier retrieved by 'file-attributes'. This value can be used to identify a file uniquely. The device identifier can be a single number or (for diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 378b0ceeeae..4b5e4dd53ed 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -374,8 +374,8 @@ Remove the DIRECTORY(ies), if they are empty.") (file-attribute-inode-number attr) (file-attribute-device-number attr-target) (file-attribute-device-number attr) - (equal (file-attribute-file-number attr-target) - (file-attribute-file-number attr))) + (equal (file-attribute-file-identifier attr-target) + (file-attribute-file-identifier attr))) (eshell-error (format-message "%s: `%s' and `%s' are the same file\n" command (car files) target))) (t diff --git a/lisp/files.el b/lisp/files.el index dd10f7399cc..3fa0f2f3b81 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2164,7 +2164,7 @@ If there is no such live buffer, return nil." (setq list (cdr list))) found) (let* ((attributes (file-attributes truename)) - (number (file-attribute-file-number attributes)) + (number (file-attribute-file-identifier attributes)) (list (buffer-list)) found) (and buffer-file-numbers-unique (car-safe number) ;Make sure the inode is not just nil. @@ -2367,7 +2367,7 @@ the various files." (let* ((buf (get-file-buffer filename)) (truename (abbreviate-file-name (file-truename filename))) (attributes (file-attributes truename)) - (number (file-attribute-file-number attributes)) + (number (file-attribute-file-identifier attributes)) ;; Find any buffer for a file that has same truename. (other (and (not buf) (find-buffer-visiting @@ -4745,7 +4745,7 @@ the old visited file has been renamed to the new name FILENAME." (setq buffer-file-name truename)))) (setq buffer-file-number (if filename - (file-attribute-file-number (file-attributes buffer-file-name)) + (file-attribute-file-identifier (file-attributes buffer-file-name)) nil)) ;; write-file-functions is normally used for things like ftp-find-file ;; that visit things that are not local files as if they were files. @@ -5734,7 +5734,8 @@ Before and after saving the buffer, this function runs (setq save-buffer-coding-system last-coding-system-used) (setq buffer-file-coding-system last-coding-system-used)) (setq buffer-file-number - (file-attribute-file-number (file-attributes buffer-file-name))) + (file-attribute-file-identifier + (file-attributes buffer-file-name))) (if setmodes (condition-case () (progn @@ -8662,7 +8663,7 @@ It is a nonnegative integer." It is an integer or a cons cell of integers." (nth 11 attributes)) -(defsubst file-attribute-file-number (attributes) +(defsubst file-attribute-file-identifier (attributes) "The inode and device numbers in ATTRIBUTES returned by `file-attributes'. The value is a list of the form (INODENUM DEVICE), where DEVICE could be either a single number or a cons cell of two numbers. diff --git a/lisp/startup.el b/lisp/startup.el index c7faf4abc6f..725984b815b 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -458,7 +458,8 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." ;; The Windows version doesn't report meaningful inode numbers, so ;; use the canonicalized absolute file name of the directory instead. (setq attrs (or canonicalized - (file-attribute-file-number (file-attributes this-dir)))) + (file-attribute-file-identifier + (file-attributes this-dir)))) (unless (member attrs normal-top-level-add-subdirs-inode-list) (push attrs normal-top-level-add-subdirs-inode-list) (dolist (file contents) diff --git a/src/dired.c b/src/dired.c index 1b4edf20483..ef729df5d2b 100644 --- a/src/dired.c +++ b/src/dired.c @@ -928,7 +928,7 @@ Elements of the attribute list are: Large integers are bignums, so `eq' might not work on them. On most filesystems, the combination of the inode and the device identifier uniquely identifies the file. This unique file identification -is provided by the access function `file-attribute-file-number'. +is provided by the access function `file-attribute-file-identifier'. On MS-Windows, performance depends on `w32-get-true-file-attributes', which see. -- 2.39.5