Function: org--mks-read-key

org--mks-read-key is a byte-compiled function defined in org-macs.el.gz.

Signature

(org--mks-read-key ALLOWED-KEYS PROMPT NAVIGATION-KEYS)

Documentation

Read a key and ensure it is a member of ALLOWED-KEYS.

Enable keys to scroll the window if NAVIGATION-KEYS is set. TAB, SPC and RET are treated equivalently.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-macs.el.gz
(defun org--mks-read-key (allowed-keys prompt navigation-keys)
  "Read a key and ensure it is a member of ALLOWED-KEYS.
Enable keys to scroll the window if NAVIGATION-KEYS is set.
TAB, SPC and RET are treated equivalently."
  (setq header-line-format (when navigation-keys "Use C-n, C-p, C-v, M-v to navigate."))
  (let ((char-key (read-char-exclusive prompt)))
    (if (and navigation-keys (memq char-key '(14 16 22 134217846)))
	(progn
	  (org-scroll char-key)
	  (org--mks-read-key allowed-keys prompt navigation-keys))
      (let ((key (char-to-string
		  (pcase char-key
		    ((or ?\s ?\t ?\r) ?\t)
		    (char char)))))
	(if (member key allowed-keys)
	    key
	  (message "Invalid key: `%s'" key)
	  (sit-for 1)
	  (org--mks-read-key allowed-keys prompt navigation-keys))))))