[PATCH 1/1] emacs: add '?' to some prefix keymaps to describe its bindings
Mark Walters
markwalters1009 at gmail.com
Sun Aug 25 03:24:56 PDT 2013
On Sat, 24 Aug 2013, Tomi Ollila <tomi.ollila at iki.fi> 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 at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
More information about the notmuch
mailing list