Function: customize-dirlocals
customize-dirlocals is an autoloaded, interactive and byte-compiled
function defined in cus-edit.el.gz.
Signature
(customize-dirlocals &optional FILENAME)
Documentation
Customize Directory Local Variables in the current directory.
With optional argument FILENAME non-nil, customize the .dir-locals.el file
that FILENAME specifies.
Probably introduced at or before Emacs version 30.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
;;;###autoload
(defun customize-dirlocals (&optional filename)
"Customize Directory Local Variables in the current directory.
With optional argument FILENAME non-nil, customize the `.dir-locals.el' file
that FILENAME specifies."
(interactive)
(let* ((file (or filename (expand-file-name ".dir-locals.el")))
(dirlocals (when (file-exists-p file)
(with-current-buffer (find-file-noselect file)
(goto-char (point-min))
(prog1
(condition-case _
(read (current-buffer))
(end-of-file nil))
(kill-buffer))))))
(custom-dirlocals-with-buffer
(widget-insert
"This buffer is for customizing the Directory Local Variables in:\n")
(setq custom-dirlocals-file-widget
(widget-create `(file :action ,#'custom-dirlocals-change-file
,file)))
(widget-insert
(substitute-command-keys
"
To select another file, edit the above field and hit RET.
After you enter a user option name under the symbol field,
be sure to press \\`RET' or \\`TAB', so that the field that holds the
value changes to an appropriate field for the option.
Type \\`C-x C-s' when you've finished editing it, to save the
settings to the file."))
(widget-insert "\n\n\n")
(widget-create 'push-button :tag " Revert "
:action #'Custom-dirlocals-revert-buffer)
(widget-insert " ")
(widget-create 'push-button :tag " Save Settings "
:action #'Custom-dirlocals-save)
(widget-insert "\n\n")
(setq custom-dirlocals-widget
(widget-create 'custom-dirlocals :value dirlocals))
(setq default-directory (file-name-directory file))
(goto-char (point-min)))))