1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

file-attributes has a new optional arg FOLLOW-SYMLINKS.

* doc/lispref/files.texi (File Attributes): Describe it.
(Magic File Names): Use it.
* etc/NEWS: Document the change.
* lisp/files.el (remote-file-name-inhibit-cache):
* lisp/time.el (display-time-file-nonempty-p): Use it.
* lisp/files.el (after-find-file): Don't chase links before calling
file-exists-p, as file-exists-p already does the right thing.
* src/dired.c (directory_files_internal, Ffile_attributes):
New arg follow_symlinks.  All uses changed.
This commit is contained in:
Paul Eggert 2012-09-30 14:12:04 -07:00
parent b9ab1b1f1c
commit e7a2937b11
11 changed files with 59 additions and 17 deletions

View file

@ -1014,7 +1014,7 @@ consecutive checks. For example:
(defun display-time-file-nonempty-p (file)
(let ((remote-file-name-inhibit-cache (- display-time-interval 5)))
(and (file-exists-p file)
(< 0 (nth 7 (file-attributes (file-chase-links file)))))))"
(< 0 (nth 7 (file-attributes file nil t))))))"
:group 'files
:version "24.1"
:type `(choice
@ -2082,8 +2082,7 @@ unless NOMODES is non-nil."
((and error (file-attributes buffer-file-name))
(setq buffer-read-only t)
(if (and (file-symlink-p buffer-file-name)
(not (file-exists-p
(file-chase-links buffer-file-name))))
(not (file-exists-p buffer-file-name)))
"Symbolic link that points to nonexistent file"
"File exists, but cannot be read"))
((not buffer-read-only)