Function: read-file-local-variable-value
read-file-local-variable-value is a byte-compiled function defined in
files-x.el.gz.
Signature
(read-file-local-variable-value VARIABLE)
Documentation
Read and return the value of a file-local VARIABLE using completion.
Intended to be used in the interactive spec of
add-file-local-variable and add-dir-local-variable.
Source Code
;; Defined in /usr/src/emacs/lisp/files-x.el.gz
(defun read-file-local-variable-value (variable)
"Read and return the value of a file-local VARIABLE using completion.
Intended to be used in the `interactive' spec of
`add-file-local-variable' and `add-dir-local-variable'."
(cond
((eq variable 'mode)
(let* ((default (and (symbolp major-mode) (symbol-name major-mode)))
(value
(completing-read
(format-prompt "Add %s with value" default variable)
obarray
(lambda (sym)
(string-match-p "-mode\\'" (symbol-name sym)))
nil nil nil default nil)))
(and (stringp value)
(intern (replace-regexp-in-string "-mode\\'" "" value)))))
((eq variable 'eval)
(read--expression (format "Add %s with expression: " variable)))
((eq variable 'coding)
(let ((default (and (symbolp buffer-file-coding-system)
(symbol-name buffer-file-coding-system))))
(read-coding-system (format-prompt "Add %s with value" default variable)
default)))
(t
(let ((default (format "%S"
(cond ((eq variable 'unibyte) t)
((boundp variable)
(symbol-value variable))))))
(read-from-minibuffer (format "Add %s with value: " variable)
nil read-expression-map t
'set-variable-value-history
default)))))