From 6fd132b4622694b0658b5dd2c18de568bcf922c2 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Sat, 24 Aug 2013 15:15:40 +0300 Subject: [PATCH] [PATCH 1/1] emacs: add '?' to some prefix keymaps to describe its bindings --- 77/a16772bfd1924b35050086ea88d0f4d86053f4 | 115 ++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 77/a16772bfd1924b35050086ea88d0f4d86053f4 diff --git a/77/a16772bfd1924b35050086ea88d0f4d86053f4 b/77/a16772bfd1924b35050086ea88d0f4d86053f4 new file mode 100644 index 000000000..c50f40029 --- /dev/null +++ b/77/a16772bfd1924b35050086ea88d0f4d86053f4 @@ -0,0 +1,115 @@ +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 53A1F431FDC + for ; Sat, 24 Aug 2013 05:15:52 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 LMpZu7ARJJoJ for ; + Sat, 24 Aug 2013 05:15:47 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 76981431FBD + for ; Sat, 24 Aug 2013 05:15:47 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 9C67410009D; Sat, 24 Aug 2013 15:15:41 +0300 (EEST) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH 1/1] emacs: add '?' to some prefix keymaps to describe its + bindings +Date: Sat, 24 Aug 2013 15:15:40 +0300 +Message-Id: <1377346540-7094-1-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +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: Sat, 24 Aug 2013 12:15:52 -0000 + +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. +--- + 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 + -- 2.26.2