From 8cdbbf29ad7f2156e8bba308d83910765ab5b387 Mon Sep 17 00:00:00 2001 From: Gregory Heytings Date: Wed, 3 Nov 2021 12:50:52 +0000 Subject: [PATCH] Further improvement of file-has-changed-p * lisp/files.el (file-has-changed-p): Expand the file name when necessary. Clarify and fix typo in the docstring. --- lisp/files.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 173198a424..758d0edd88 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6187,13 +6187,15 @@ file-has-changed-p--hash-table (defun file-has-changed-p (file &optional tag) "Return non-nil if FILE has changed. The size and modification time of FILE are compared to the size -and modification time of tghe same FILE during a previous +and modification time of the same FILE during a previous invocation of `file-has-changed-p'. Thus, the first invocation -of `file-has-changed-p' always returns non-nil. +of `file-has-changed-p' on a given FILE always returns non-nil. The optional argument TAG, which must be a symbol, can be used to limit the comparison to invocations with identical tags; it can be the symbol of the calling function, for example." - (let* ((fileattr (file-attributes file 'integer)) + (let* ((fileattr (file-attributes + (if (file-name-absolute-p file) file (expand-file-name file)) + 'integer)) (attr (cons (file-attribute-size fileattr) (file-attribute-modification-time fileattr))) (sym (concat (symbol-name tag) "@" file)) -- 2.33.0