;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/show-command.el (defun show-key-command (&optional key cmd) (interactive) (let*((key-ps "hit key(s)!") (ps (if cmd (format "%s %s " cmd key-ps) key-ps) ) (k (or key (read-key-sequence-vector ps))) (new-cmd (key-binding k)) (cmd-or-undef (if new-cmd (format "`%s'" new-cmd) "undefined")) ) (if (and key cmd) (string= new-cmd cmd) (if key (message "%s" cmd-or-undef) (unless (equal k [7]) ; [7] is C-g or `keyboard-quit' (show-key-command nil cmd-or-undef) ))))) ;; (show-key-command) ;; ^ eval me (provide 'show-command)