Function: tmm-shortcut

tmm-shortcut is an interactive and byte-compiled function defined in tmm.el.gz.

Signature

(tmm-shortcut)

Documentation

Choose the shortcut that the user typed.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/tmm.el.gz
(defun tmm-shortcut ()
  "Choose the shortcut that the user typed."
  (interactive)
  (let ((c last-command-event) s)
    (if (symbolp tmm-shortcut-style)
        (setq c (funcall tmm-shortcut-style c)))
    (if (memq c tmm-short-cuts)
	(if (equal (buffer-name) "*Completions*")
	    (progn
	      (goto-char (point-min))
	      (re-search-forward
	       (concat "\\(^\\|[ \t]\\)" (char-to-string c) tmm-mid-prompt))
	      (choose-completion))
	  ;; In minibuffer
	  (delete-region (minibuffer-prompt-end) (point-max))
          (dolist (elt tmm-km-list)
            (let ((str (car elt))
                  (index 0))
              (when tmm-shortcut-inside-entry
                (if (get-char-property 0 'face str)
                    (setq index 0)
                  (let ((next (next-single-char-property-change 0 'face str)))
                    (setq index (if (= (length str) next) 0 next)))))
              (if (= (aref str index) c)
                  (setq s str))))
	  (insert s)
	  (exit-minibuffer)))))