Function: copy-file-locals-to-dir-locals

copy-file-locals-to-dir-locals is an autoloaded, interactive and byte-compiled function defined in files-x.el.gz.

Signature

(copy-file-locals-to-dir-locals &optional FILE)

Documentation

Copy file-local variables to .dir-locals.el.

With a prefix argument, prompt for the file to modify.

When called from Lisp, FILE may be the expanded name of the dir-locals file where to copy the file-local variables.

View in manual

Probably introduced at or before Emacs version 23.2.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/files-x.el.gz
;;;###autoload
(defun copy-file-locals-to-dir-locals (&optional file)
  "Copy file-local variables to .dir-locals.el.

With a prefix argument, prompt for the file to modify.

When called from Lisp, FILE may be the expanded name of the dir-locals file
where to copy the file-local variables."
  (interactive
   (list (when current-prefix-arg
           (read-dir-locals-file))))
  (dolist (elt file-local-variables-alist)
    (unless (assq (car elt) dir-local-variables-alist)
      (add-dir-local-variable major-mode (car elt) (cdr elt) file))))