emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat b467df10ca 1/6: Add file-attribute-file-identifi


From: ELPA Syncer
Subject: [elpa] externals/compat b467df10ca 1/6: Add file-attribute-file-identifier
Date: Thu, 5 Jan 2023 07:57:27 -0500 (EST)

branch: externals/compat
commit b467df10ca533c8940b27c3612f15acabdcd1de3
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Add file-attribute-file-identifier
---
 compat-29.el    | 7 +++++++
 compat-tests.el | 1 +
 compat.texi     | 7 +++++++
 3 files changed, 15 insertions(+)

diff --git a/compat-29.el b/compat-29.el
index 2280d5e5a2..6ecf0fca9d 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -483,6 +483,13 @@ The variable list SPEC is the same as in `if-let'."
 
 ;;;; Defined in files.el
 
+(compat-defun file-attribute-file-identifier (attributes) ;; <OK>
+  "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.
+This tuple of numbers uniquely identifies the file."
+  (nthcdr 10 attributes))
+
 (compat-defun file-name-parent-directory (filename) ;; <UNTESTED>
   "Return the directory name of the parent directory of FILENAME.
 If FILENAME is at the root of the filesystem, return nil.
diff --git a/compat-tests.el b/compat-tests.el
index 735fc667a9..605b58e82c 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -615,6 +615,7 @@
 (ert-deftest file-attribute-getters ()
   (let ((attrs '(type link-number user-id group-id access-time 
modification-time
                  status-change-time size modes unspecified inode-number 
device-number)))
+    (should-equal (file-attribute-file-identifier attrs) '(inode-number 
device-number))
     (should-equal (file-attribute-type attrs) 'type)
     (should-equal (file-attribute-link-number attrs) 'link-number)
     (should-equal (file-attribute-user-id attrs) 'user-id)
diff --git a/compat.texi b/compat.texi
index 631ba8f80a..ffdadaee99 100644
--- a/compat.texi
+++ b/compat.texi
@@ -2318,6 +2318,13 @@ etc. -- will not be noticed, and the buffer will still 
be marked
 unmodified, effectively ignoring those changes.
 @end defmac
 
+@defun file-attribute-file-identifier
+Return the fields @code{(inodenum device)} as a list from attributes
+generated by @code{file-attributes}.
+
+@xref{File Attributes,,,elisp}.
+@end defun
+
 @c copied from lispref/files.texi
 @defun file-name-parent-directory filename
 This function returns the directory name of the parent directory of



reply via email to

[Prev in Thread] Current Thread [Next in Thread]