mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Read mailcaps again only when necessary
* doc/lispref/files.texi (File Attributes): Document it. * lisp/files.el (file-has-changed-p): New function. (file-has-changed-p--hash-table): Internal variable used by the new function (bug#51523). * lisp/emacs-lisp/shortdoc.el (file): Mention it. * lisp/net/mailcap.el (mailcap-parse-mailcaps): Read mailcaps again only when at least one of the mailcap files has changed. Fixes bug#51523.
This commit is contained in:
parent
453d104602
commit
daea9b3b44
5 changed files with 46 additions and 12 deletions
|
|
@ -6181,6 +6181,22 @@ Return nil if DIR is not an existing directory."
|
|||
(unless mismatch
|
||||
(file-equal-p root dir)))))))
|
||||
|
||||
(defvar file-has-changed-p--hash-table (make-hash-table)
|
||||
"Internal variable used by `file-has-changed-p'.")
|
||||
|
||||
(defun file-has-changed-p (file)
|
||||
"Return non-nil if FILE has changed.
|
||||
The modification time of FILE is compared to the modification
|
||||
time of FILE during a previous invocation of `file-has-changed-p'.
|
||||
Therefore the first invocation of `file-has-changed-p' always
|
||||
returns non-nil."
|
||||
(let* ((attr (file-attributes file 'integer))
|
||||
(mtime (file-attribute-modification-time attr))
|
||||
(saved-mtime (gethash (intern file)
|
||||
file-has-changed-p--hash-table)))
|
||||
(when (not (equal mtime saved-mtime))
|
||||
(puthash (intern file) mtime file-has-changed-p--hash-table))))
|
||||
|
||||
(defun copy-directory (directory newname &optional keep-time parents copy-contents)
|
||||
"Copy DIRECTORY to NEWNAME. Both args must be strings.
|
||||
This function always sets the file modes of the output files to match
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue