From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.bugs Subject: bug#43709: minibuffer keybinding cheatsheet and launcher [CODE SUBMISSION] Date: Tue, 29 Sep 2020 14:22:19 -0400 Message-ID: <20200929182219.5r5nbvmipo33l24q@E15-2016.optimum.net> References: <20200929165957.ibj67dnyaem6nezg@E15-2016.optimum.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="jlyugc4je2zrr3gx" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31555"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: NeoMutt/20180716 Cc: 43709@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 29 20:23:49 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNKI0-00086k-Cb for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Sep 2020 20:23:48 +0200 Original-Received: from localhost ([::1]:55504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNKHy-0001rN-KE for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Sep 2020 14:23:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNKHG-0001q8-6I for bug-gnu-emacs@gnu.org; Tue, 29 Sep 2020 14:23:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kNKHF-00042l-Tt for bug-gnu-emacs@gnu.org; Tue, 29 Sep 2020 14:23:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kNKHF-0002oi-Qo for bug-gnu-emacs@gnu.org; Tue, 29 Sep 2020 14:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Boruch Baum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Sep 2020 18:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43709 X-GNU-PR-Package: emacs Original-Received: via spool by 43709-submit@debbugs.gnu.org id=B43709.160140375810795 (code B ref 43709); Tue, 29 Sep 2020 18:23:01 +0000 Original-Received: (at 43709) by debbugs.gnu.org; 29 Sep 2020 18:22:38 +0000 Original-Received: from localhost ([127.0.0.1]:57116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNKGr-0002o3-IF for submit@debbugs.gnu.org; Tue, 29 Sep 2020 14:22:37 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:42997) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNKGp-0002np-7h for 43709@debbugs.gnu.org; Tue, 29 Sep 2020 14:22:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1601403742; bh=1wKPyL6uaS16qZDu68drFI6N0Bcu7ytVHSxqKJuDF8o=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=VuUBFdlmiVfimcmGAs0Ttj6WtbJw3HuEU3Hu3VM+q9L7E//2DvwL/cyM+pRk+6NZA Qeh2L4LyG/Dmp1aPExeEEblUdVK9JFKKzIsVnL9CCc1JqU/eCD4shyVudMSrXmPGcu Vn/8yIpX+yfaQ+2vnO/hyR8EcBZZjy2pSFRNG8uM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from E15-2016.optimum.net ([72.89.170.172]) by mail.gmx.com (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MNbkp-1k2bW10H4V-00P6mg; Tue, 29 Sep 2020 20:22:22 +0200 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:yWxw94tTzsuXoaodueWT6NOxubGoVJMotnTWm4SelIo6UphZS94 +U+L06YacyO8z48OAdICWFGfcZHifVqYlYc1kwZ/q7rQy3eeOqwp0t7H+0CfQ2twBmP8pDZ IDaxBEu6FwTHcaNcJ71dsgSuV4HJniP17usxQ6n9nLUJeqSXIQL0TMCErQfE9+rgmaV4pI4 +5mGpdD6NC89Dt87SXVIQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:ZxphVb80qhg=:4Tguy72oiadsz2Iy36Mh1T rrdG7G6+ao70fdlqERZwErEFvL3oWOvVI4sHo+tGO0IJOiNJJdvQ5YloIPO6zIwre3EfeS99g tOREeGK0bG3zR95g/LYNXcRrLqVrhOy4e/qbzzx5cEnqa/I2iCz74PBo/C5B4R/q4+sURzIpZ 8czo2/HwdazhmPaKmDQAphPev9/S2Qt4PJxvteFmFfHNLW1kJATM/9Dytkd1xECS8Zny+zTv5 aewttXk8WbcUgdLDtNdybTZ2URKvTQsfXxUCWJLdpZta0TcVvlRtCRFSM6b68YUZYWm+Fq3j8 ffWyh4XCBNaEqUePy7GLJtIrmEi5Pl+iov/zIba3vPc6q682ZfR0IBhkKDOtLPRzxNdOGjJLR hcnH3gAs71oGgI8qBznXpF1+lzOoUnMVNcSEVjFINmCqauxJ75b1fkpevRzmBBN7V/eUiw7Nj Dx9ZAM2ryG+1FB0nnEQyDQ3pRKyq5WhpCldDNfBBma1HRPGfw1v3E+pX7ZmsDsiEbDBjxy8EH C3JPw1Uv+T3Y3/pUMXgXxqWOG0usm1jFeh/YUZiltebNH+9vsyx34D6r9Tzc8GtIFlxMkEexA TeOxctI52FKzjEiey4GCsaAEtFxDAHrObN9ki201W5shfp20RGByrLnD+b8FzOPNkZ3oZt+xm lnnFeGkr7ySBb+kRjuWWaiaPr+a8IF/uWkXXE6Cx0GZfdZrz9BCoK82xvDly44aGDm0LYg4wp 9Uya4MUTzowPsPuWgxRJx6cHJlQS1GIohlawCw9CzvDjpqzsvL3b3N+Q+1gEfUeeE1/a+YlS X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:189287 Archived-At: --jlyugc4je2zrr3gx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-09-29 10:41, Drew Adams wrote: > Cf. `keysee.el' > > https://www.emacswiki.org/emacs/KeySee > > https://www.emacswiki.org/emacs/download/keysee.el Oh. Had I known... Would I? / Wouldn't have I? From reading the emacswiki description, it seems that there are some differences in presentation. My motivation was specifically to write just a few lines for an element of another code submission I have pending, and then the idea got out of control. It didn't occur to me to check emacs-wiki. BACKGROUND: I have a collection of dired extensions that'll be ready for submission as soon as I complete the documentation. It includes a set of 'trash' management functions, eg. smart empty trash, restore trashed file(s), report trash status. But who can be expected to remember all the arcane keybindings of all the arcane modes? So I wrote it hard-wired for about four commands of diredc-trash, and then ... ATTACHED: I'm attaching that original function because someone may ask why include in `key-assist.el' a programmatic option to supply a list of elements (command . function). In the attached example, you can see that I'm presenting a description of the command `diredc-trash-toggle' based upon what it would do at any particular time. FOLLOW-UP: Another follow-up might be to supply some specific code for some notorious major modes. I'm thinking in particular of `calc-mode', which is such a beauty-in-the-rough, but suffers from a particularly bad case of keybinding hell (it also suffers from a consistent absence of docstrings). =2D- hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0 --jlyugc4je2zrr3gx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="diredc-trash-assistant.el" (defun diredc-trash-assistant () "Minibuffer cheatsheet and launcher for diredc-trash functions." ;; This was the inspiration for `key-assist.el' (interactive) (let ((zz (lambda (x) (let (shortest) (dolist (key (mapcar 'key-description (where-is-internal x diredc-mode-map nil t))) (when (or (not shortest) (> (length shortest) (length key))) (setq shortest key))) shortest))) (options (list (list (if delete-by-moving-to-trash "Switch to using deletion" "Switch to using trash") 'diredc-trash-toggle) '("Jump to trash files dir" diredc-trash-view) '("Report trash size" diredc-trash-info) '("Empty the trash" diredc-trash-empty) '("Restore file at point" diredc-trash-restore))) (prompt (concat (diredc-trash-info) "\nSelect: ")) choices choice) (setq choices (mapcar (lambda(x) (format "%-23s %s" (car x) (funcall zz (cadr x)))) options)) (while (not (setq choice (cl-position (completing-read prompt choices nil t nil 'choices ) choices :test 'equal)))) (funcall (cadr (nth choice options))))) --jlyugc4je2zrr3gx--