mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 03:13:24 +00:00
* lisp/files.el (trusted-content-p): Make :all
work in non-file buffers
This commit is contained in:
parent
4b685bc4fc
commit
b9dc337ea7
1 changed files with 22 additions and 20 deletions
|
@ -742,26 +742,28 @@ See also `trusted-content'."
|
||||||
;; to try and avoid marking as trusted a file that's merely accessed
|
;; to try and avoid marking as trusted a file that's merely accessed
|
||||||
;; via a symlink that happens to be inside a trusted dir.
|
;; via a symlink that happens to be inside a trusted dir.
|
||||||
(and (not untrusted-content)
|
(and (not untrusted-content)
|
||||||
buffer-file-truename
|
(or
|
||||||
(with-demoted-errors "trusted-content-p: %S"
|
(eq trusted-content :all)
|
||||||
(let ((exists (file-exists-p buffer-file-truename)))
|
(and
|
||||||
(or
|
buffer-file-truename
|
||||||
(eq trusted-content :all)
|
(with-demoted-errors "trusted-content-p: %S"
|
||||||
;; We can't avoid trusting the user's init file.
|
(let ((exists (file-exists-p buffer-file-truename)))
|
||||||
(if (and exists user-init-file)
|
(or
|
||||||
(file-equal-p buffer-file-truename user-init-file)
|
;; We can't avoid trusting the user's init file.
|
||||||
(equal buffer-file-truename user-init-file))
|
(if (and exists user-init-file)
|
||||||
(let ((file (abbreviate-file-name buffer-file-truename))
|
(file-equal-p buffer-file-truename user-init-file)
|
||||||
(trusted nil))
|
(equal buffer-file-truename user-init-file))
|
||||||
(dolist (tf trusted-content)
|
(let ((file (abbreviate-file-name buffer-file-truename))
|
||||||
(when (or (if exists (file-equal-p tf file) (equal tf file))
|
(trusted nil))
|
||||||
;; We don't use `file-in-directory-p' here, because
|
(dolist (tf trusted-content)
|
||||||
;; we want to err on the conservative side: "guilty
|
(when (or (if exists (file-equal-p tf file) (equal tf file))
|
||||||
;; until proven innocent".
|
;; We don't use `file-in-directory-p' here, because
|
||||||
(and (string-suffix-p "/" tf)
|
;; we want to err on the conservative side: "guilty
|
||||||
(string-prefix-p tf file)))
|
;; until proven innocent".
|
||||||
(setq trusted t)))
|
(and (string-suffix-p "/" tf)
|
||||||
trusted))))))
|
(string-prefix-p tf file)))
|
||||||
|
(setq trusted t)))
|
||||||
|
trusted))))))))
|
||||||
|
|
||||||
;; This is an odd variable IMO.
|
;; This is an odd variable IMO.
|
||||||
;; You might wonder why it is needed, when we could just do:
|
;; You might wonder why it is needed, when we could just do:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue