Function: help-fns--var-file-local

help-fns--var-file-local is a byte-compiled function defined in help-fns.el.gz.

Signature

(help-fns--var-file-local VARIABLE)

Source Code

;; Defined in /usr/src/emacs/lisp/help-fns.el.gz
(defun help-fns--var-file-local (variable)
  (when (boundp variable)
    (let ((val (symbol-value variable)))
      (when (member (cons variable val)
                    file-local-variables-alist)
        (if (member (cons variable val)
                    dir-local-variables-alist)
	    (let ((file (and buffer-file-name
                             (not (file-remote-p buffer-file-name))
                             (dir-locals-find-file buffer-file-name)))
                  (is-directory nil))
	      (princ (substitute-command-keys
		      "  This variable's value is directory-local"))
              (when (consp file)       ; result from cache
                ;; If the cache element has an mtime, we
                ;; assume it came from a file.
                (if (nth 2 file)
                    ;; (car file) is a directory.
                    (setq file (dir-locals--all-files (car file)))
                  ;; Otherwise, assume it was set directly.
                  (setq file (car file)
                        is-directory t)))
              (if (null file)
                  (princ ".\n")
                (princ ", set ")
                (princ (substitute-command-keys
                        (cond
                         (is-directory "for the directory\n  `")
                         ;; Many files matched.
                         ((and (consp file) (cdr file))
                          (setq file (file-name-directory (car file)))
                          (format "by one of the\n  %s files in the directory\n  `"
                                  dir-locals-file))
                         (t (setq file (car file))
                            "by the file\n  `"))))
                (with-current-buffer standard-output
                  (insert-text-button
                   file 'type 'help-dir-local-var-def
                   'help-args (list variable file)))
                (princ (substitute-quotes "'.\n"))))
          (princ (substitute-quotes
                  "  This variable's value is file-local.\n")))))))