Function: dir-locals--load-mode-if-needed

dir-locals--load-mode-if-needed is a byte-compiled function defined in files.el.gz.

Signature

(dir-locals--load-mode-if-needed KEY ALIST)

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun dir-locals--load-mode-if-needed (key alist)
  ;; If KEY is an extra parent it may remain not loaded
  ;; (hence with some of its mode-specific vars missing their
  ;; `safe-local-variable' property), leading to spurious
  ;; prompts about unsafe vars (bug#68246).
  (when (and (symbolp key) (autoloadp (indirect-function key)))
    (let ((unsafe nil))
      (pcase-dolist (`(,var . ,_val) alist)
        (unless (or (memq var '(mode eval))
                    (get var 'safe-local-variable))
          (setq unsafe t)))
      (when unsafe
        (ignore-errors
          (autoload-do-load (indirect-function key)))))))