From: Mark Walters Date: Sun, 25 Aug 2013 10:24:56 +0000 (+0100) Subject: Re: [PATCH 1/1] emacs: add '?' to some prefix keymaps to describe its bindings X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=10410ce3943e1909c7cbb12221ed6e81ddd05a40;p=notmuch-archives.git Re: [PATCH 1/1] emacs: add '?' to some prefix keymaps to describe its bindings --- diff --git a/c0/645d45fba902e11cb46e8896ee1017a509a2b9 b/c0/645d45fba902e11cb46e8896ee1017a509a2b9 new file mode 100644 index 000000000..7c6fe90f3 --- /dev/null +++ b/c0/645d45fba902e11cb46e8896ee1017a509a2b9 @@ -0,0 +1,159 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id CEA15431FD7 + for ; Mon, 26 Aug 2013 12:04:51 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id nbXHf+-nV7tB for ; + Mon, 26 Aug 2013 12:04:47 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 01338431FAF + for ; Mon, 26 Aug 2013 12:04:46 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1VDXVC-000281-0T; Sun, 25 Aug 2013 11:25:01 +0100 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1VDXVB-00018j-M4; Sun, 25 Aug 2013 11:24:57 +0100 +From: Mark Walters +To: Tomi Ollila , notmuch@notmuchmail.org +Subject: Re: [PATCH 1/1] emacs: add '?' to some prefix keymaps to describe its + bindings +In-Reply-To: <1377346540-7094-1-git-send-email-tomi.ollila@iki.fi> +References: <1377346540-7094-1-git-send-email-tomi.ollila@iki.fi> +User-Agent: Notmuch/0.15.2+269~g01f5508 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sun, 25 Aug 2013 11:24:56 +0100 +Message-ID: <8761uu2hl3.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 5ea73a0ceb601597eb8dab528fbda68d (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 0.0 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 26 Aug 2013 19:04:51 -0000 + + +On Sat, 24 Aug 2013, Tomi Ollila wrote: +> Added (private) function `notmuch--prefix-bindings' which wraps +> `describe-prefix-bindings' to provide more suitable user interface for +> showing the key sequences that follow a particular notmuch prefix +> keymap invocation. +> +> The key '?' in prefix keymaps `notmuch-search-stash-map', +> `notmuch-show-stash-map' and `notmuch-show-part-map' is bound to this +> function via `lambda' expression. By using this lambda expression the +> pop-up binding description window shows '??' instead of +> `notmuch--prefix-bindings' for the binding of '?' -- which suits our +> needs perfectly. + +This looks good to me +1. + +[I think I would prefer docstrings to function names but getting that +does not seem to be easy so is probably not worth the effort.] + +Best wishes + +Mark + + +> --- +> emacs/notmuch-lib.el | 9 +++++++++ +> emacs/notmuch-show.el | 2 ++ +> emacs/notmuch.el | 1 + +> 3 files changed, 12 insertions(+) +> +> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +> index 4796f17..8191aec 100644 +> --- a/emacs/notmuch-lib.el +> +++ b/emacs/notmuch-lib.el +> @@ -553,6 +553,15 @@ status." +> (message "%s" (error-message-string err)))) +> (ignore-errors (delete-file err-file)))) +> +> +(defun notmuch--prefix-bindings () +> + "Notmuch private wrapper for `describe-prefix-bindings'." +> + ;;(interactive) +> + (describe-prefix-bindings) +> + (pop-to-buffer "*Help*") ; XXX that's what describe-bindings-internal uses +> + (let ((buffer-read-only nil)) +> + (goto-char (point-min)) +> + (insert "\nPress 'q' to quit this window.\n\n"))) +> + +> ;; This variable is used only buffer local, but it needs to be +> ;; declared globally first to avoid compiler warnings. +> (defvar notmuch-show-process-crypto nil) +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 82b70ba..98bf3d4 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -1248,6 +1248,7 @@ reset based on the original query." +> (define-key map "t" 'notmuch-show-stash-to) +> (define-key map "l" 'notmuch-show-stash-mlarchive-link) +> (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go) +> + (define-key map "?" (lambda () (interactive) (notmuch--prefix-bindings))) +> map) +> "Submap for stash commands") +> (fset 'notmuch-show-stash-map notmuch-show-stash-map) +> @@ -1258,6 +1259,7 @@ reset based on the original query." +> (define-key map "v" 'notmuch-show-view-part) +> (define-key map "o" 'notmuch-show-interactively-view-part) +> (define-key map "|" 'notmuch-show-pipe-part) +> + (define-key map "?" (lambda () (interactive) (notmuch--prefix-bindings))) +> map) +> "Submap for part commands") +> (fset 'notmuch-show-part-map notmuch-show-part-map) +> diff --git a/emacs/notmuch.el b/emacs/notmuch.el +> index f3ce840..3a115c8 100644 +> --- a/emacs/notmuch.el +> +++ b/emacs/notmuch.el +> @@ -245,6 +245,7 @@ For a mouse binding, return nil." +> (defvar notmuch-search-stash-map +> (let ((map (make-sparse-keymap))) +> (define-key map "i" 'notmuch-search-stash-thread-id) +> + (define-key map "?" (lambda () (interactive) (notmuch--prefix-bindings))) +> map) +> "Submap for stash commands") +> (fset 'notmuch-search-stash-map notmuch-search-stash-map) +> -- +> 1.8.0 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch