Function: read-file-local-variable

read-file-local-variable is a byte-compiled function defined in files-x.el.gz.

Signature

(read-file-local-variable PROMPT)

Documentation

Read the name of a file-local variable using PROMPT and completion.

Return the symbol of the variable, or nil if the user entered empty or null name. Intended to be used in the interactive spec of add-file-local-variable, delete-file-local-variable, add-dir-local-variable, delete-dir-local-variable.

Source Code

;; Defined in /usr/src/emacs/lisp/files-x.el.gz
;;; Commands to add/delete file-local/directory-local variables.

(defun read-file-local-variable (prompt)
  "Read the name of a file-local variable using PROMPT and completion.
Return the symbol of the variable, or nil if the user entered empty or
null name.
Intended to be used in the `interactive' spec of
`add-file-local-variable', `delete-file-local-variable',
`add-dir-local-variable', `delete-dir-local-variable'."
  (let* ((default (variable-at-point))
         (default (and (symbolp default) (boundp default)
		       (symbol-name default)))
         (variable
	  (completing-read
           (format-prompt prompt default)
	   obarray
	   (lambda (sym)
	     (or (custom-variable-p sym)
                 (get sym 'safe-local-variable)
		 (memq sym '(mode eval coding unibyte))))
	   nil nil nil default nil)))
    (and (stringp variable) (intern variable))))