Function: read-file-local-variable-mode

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

Signature

(read-file-local-variable-mode)

Documentation

Read per-directory file-local variable's mode using completion.

Intended to be used in the interactive spec of add-dir-local-variable, delete-dir-local-variable.

Source Code

;; Defined in /usr/src/emacs/lisp/files-x.el.gz
(defun read-file-local-variable-mode ()
  "Read per-directory file-local variable's mode using completion.
Intended to be used in the `interactive' spec of
`add-dir-local-variable', `delete-dir-local-variable'."
  (let* ((default (and (symbolp major-mode) (symbol-name major-mode)))
	 (mode
	  (completing-read
	   (format-prompt "Mode or subdirectory" default)
	   obarray
	   (lambda (sym)
	     (and (string-match-p "-mode\\'" (symbol-name sym))
		  (not (or (memq sym minor-mode-list)
                           (string-match-p "-minor-mode\\'"
                                           (symbol-name sym))))))
	   nil nil nil default nil)))
    (cond
     ((equal mode "nil") nil)
     ((and (stringp mode) (fboundp (intern mode))) (intern mode))
     (t mode))))