emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: which-key


From: Emanuel Berg
Subject: Re: which-key
Date: Tue, 20 Sep 2022 01:43:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Too hot code for many:

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/show-cmd.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 :)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]