Function: trusted-content-p

trusted-content-p is a byte-compiled function defined in compat-30.el.

Signature

(trusted-content-p)

Documentation

[Compatibility function for trusted-content-p, defined in Emacs 30.1. See
(compat) Emacs 30.1' for more details.]

Return non-nil if we trust the contents of the current buffer. Here, "trust" means that we are willing to run code found inside of it. See also trusted-content.

Source Code

;; Defined in ~/.emacs.d/elpa/compat-30.1.0.1/compat-30.el
(compat-defun trusted-content-p () ;; <compat-tests:trusted-content-p>
  "Return non-nil if we trust the contents of the current buffer.
Here, \"trust\" means that we are willing to run code found inside of it.
See also `trusted-content'."
  (and (not untrusted-content)
       (or
        (eq trusted-content :all)
        (and
         buffer-file-truename
         (with-demoted-errors "trusted-content-p: %S"
           (let ((exists (file-exists-p buffer-file-truename)))
             (or
              (if (and exists user-init-file)
                  (file-equal-p buffer-file-truename user-init-file)
                (equal buffer-file-truename user-init-file))
              (let ((file (abbreviate-file-name buffer-file-truename))
                    (trusted nil))
                (dolist (tf trusted-content)
                  (when (or (if exists (file-equal-p tf file) (equal tf file))
                            (and (string-suffix-p "/" tf)
                                 (string-prefix-p tf file)))
                    (setq trusted t)))
                trusted))))))))