Function: allout-hotspot-key-handler

allout-hotspot-key-handler is an interactive and byte-compiled function defined in allout.el.gz.

Signature

(allout-hotspot-key-handler)

Documentation

Catchall handling of key bindings in hot-spots.

Translates unmodified keystrokes to corresponding allout commands, when they would qualify if prefixed with the allout-command-prefix, and sets this-command accordingly.

Returns the qualifying command, if any, else nil.

Probably introduced at or before Emacs version 22.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/allout.el.gz
;;;_   > allout-hotspot-key-handler ()
(defun allout-hotspot-key-handler ()
  "Catchall handling of key bindings in hot-spots.

Translates unmodified keystrokes to corresponding allout commands, when
they would qualify if prefixed with the `allout-command-prefix', and sets
`this-command' accordingly.

Returns the qualifying command, if any, else nil."
  (interactive)
  (let* ((modified (event-modifiers last-command-event))
         (key-num (cond ((numberp last-command-event) last-command-event)
                        (t 0)))
         mapped-binding)

    (if (zerop key-num)
        nil

      (if (and
           ;; exclude control chars and escape:
           (not modified)
           (<= 33 key-num)
           (setq mapped-binding
                 (or
                  ;; try control-modified versions of keys:
                  (key-binding (vconcat allout-command-prefix
                                        (vector
                                         (if (and (<= 97 key-num) ; "a"
                                                  (>= 122 key-num)) ; "z"
                                             (- key-num 96) key-num)))
                               t)
                  ;; try non-modified versions of keys:
                  (key-binding (vconcat allout-command-prefix
                                        (vector key-num))
                               t))))
          ;; Qualified as an allout command -- do hot-spot operation.
          (setq allout-post-goto-bullet t)
        ;; accept-defaults nil, or else we get allout-item-icon-key-handler.
        (setq mapped-binding (key-binding (vector key-num))))

      (while (keymapp mapped-binding)
        (setq mapped-binding
              (lookup-key mapped-binding (vector (read-char)))))

      (when mapped-binding
        (setq this-command mapped-binding)))))