* [PATCH] emacs: notmuch-hello: respect notmuch-help's wishes
@ 2011-04-16 13:12 Pieter Praet
2011-11-11 17:29 ` David Bremner
2011-12-30 11:37 ` [PATCH] emacs: Better handling of inherited keymaps for `nomuch-help' David Edmondson
0 siblings, 2 replies; 4+ messages in thread
From: Pieter Praet @ 2011-04-16 13:12 UTC (permalink / raw)
To: notmuch
Calling notmuch-help in notmuch-hello-mode results in error
"apply: Wrong type argument: listp, keymap"
As this is the very first screen new users see, a failing
notmuch-help can be considered a marketing catastrophe.
Appears to be in introduced in commit 9ccd978665103a20
(patch id:"1273857338-20127-1-git-send-email-nelhage@mit.edu").
This patch makes notmuch-hello-mode-map consistent with
notmuch-show-mode-map and notmuch-search-mode-map.
To keep everything in working order, awaiting a real fix,
I copied in widget-keymap's bindings (as defined in "wid-edit.el").
Signed-off-by: Pieter Praet <pieter@praet.org>
---
emacs/notmuch-hello.el | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index e58dd24..1193f74 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -290,7 +290,17 @@ should be. Returns a cons cell `(tags-per-line width)'."
(defvar notmuch-hello-mode-map
(let ((map (make-sparse-keymap)))
- (set-keymap-parent map widget-keymap)
+ ; TODO make this play nice with notmuch-help:
+ ; (set-keymap-parent map widget-keymap)
+ ; In the meantime, make due with a copy of widget-keymap's contents:
+ (define-key map "\t" 'widget-forward)
+ (define-key map "\e\t" 'widget-backward)
+ (define-key map [(shift tab)] 'advertised-widget-backward)
+ (define-key map [backtab] 'widget-backward)
+ (define-key map [down-mouse-2] 'widget-button-click)
+ (define-key map [down-mouse-1] 'widget-button-click)
+ (define-key map [(control ?m)] 'widget-button-press)
+ ; end of widget-keymap's contents
(define-key map "v" '(lambda () "Display the notmuch version" (interactive)
(message "notmuch version %s" (notmuch-version))))
(define-key map "?" 'notmuch-help)
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] emacs: notmuch-hello: respect notmuch-help's wishes
2011-04-16 13:12 [PATCH] emacs: notmuch-hello: respect notmuch-help's wishes Pieter Praet
@ 2011-11-11 17:29 ` David Bremner
2011-11-16 10:56 ` Pieter Praet
2011-12-30 11:37 ` [PATCH] emacs: Better handling of inherited keymaps for `nomuch-help' David Edmondson
1 sibling, 1 reply; 4+ messages in thread
From: David Bremner @ 2011-11-11 17:29 UTC (permalink / raw)
To: Pieter Praet, notmuch
On Sat, 16 Apr 2011 15:12:43 +0200, Pieter Praet <pieter@praet.org> wrote:
> Calling notmuch-help in notmuch-hello-mode results in error
> "apply: Wrong type argument: listp, keymap"
Hi Pieter;
I'm a little confused here. I still get the same error after applying
your patch. Is there a followup patch I missed?
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] emacs: notmuch-hello: respect notmuch-help's wishes
2011-11-11 17:29 ` David Bremner
@ 2011-11-16 10:56 ` Pieter Praet
0 siblings, 0 replies; 4+ messages in thread
From: Pieter Praet @ 2011-11-16 10:56 UTC (permalink / raw)
To: David Bremner, notmuch
On Fri, 11 Nov 2011 12:29:34 -0500, David Bremner <david@tethera.net> wrote:
> On Sat, 16 Apr 2011 15:12:43 +0200, Pieter Praet <pieter@praet.org> wrote:
> > Calling notmuch-help in notmuch-hello-mode results in error
> > "apply: Wrong type argument: listp, keymap"
>
> Hi Pieter;
>
> I'm a little confused here. I still get the same error after applying
> your patch. Is there a followup patch I missed?
>
Hmm, it works here...
I've tried cooking up a proper test:
#+begin_src sh
test_begin_subtest "Help in notmuch-hello"
test_emacs '(let ((major-mode '\''notmuch-hello-mode))
(notmuch-help)
(test-output))'
cat <<EOF >EXPECTED
Placeholder for actual expected output...
EOF
test_expect_equal_file OUTPUT EXPECTED
#+end_src
... but I'm making some stupid mistake, because it doesn't output
*anything*, not even for `notmuch-search-mode' and `notmuch-show-mode'.
It works when running Emacs like this, though:
#+begin_src sh
emacs --no-init-file --eval '(progn
(add-to-list '\''load-path (concat
(getenv "HOME") "/src/dev/notmuch/emacs"))
(require '\''notmuch)
(notmuch-hello)
(notmuch-help))'
#+end_src
Anyways, it's a rather lame patch (even more so when taking my horrible
typo into consideraton) so I wouldn't waste too much time on it if I
were you. Duplication is evil, so this bug should be fixed in
`notmuch-substitute-one-command-key-with-prefix' instead.
> David
Peace
--
Pieter
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] emacs: Better handling of inherited keymaps for `nomuch-help'.
2011-04-16 13:12 [PATCH] emacs: notmuch-hello: respect notmuch-help's wishes Pieter Praet
2011-11-11 17:29 ` David Bremner
@ 2011-12-30 11:37 ` David Edmondson
1 sibling, 0 replies; 4+ messages in thread
From: David Edmondson @ 2011-12-30 11:37 UTC (permalink / raw)
To: notmuch
`notmuch-hello-mode' inherits the keymap for widgets, which confused
`notmuch-substitute-command-keys'. Fix the confusion.
Simplify `notmuch-substitute-command-keys' a little to make it easier
to read.
---
emacs/notmuch.el | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index fde2377..6dd65ff 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -164,16 +164,23 @@ For a mouse binding, return nil."
"\t"
(notmuch-documentation-first-line action))))))
-(defalias 'notmuch-substitute-one-command-key
- (apply-partially 'notmuch-substitute-one-command-key-with-prefix nil))
+(defun notmuch-substitute-command-keys-one (key)
+ ;; A `keymap' key indicates inheritance from a parent keymap - the
+ ;; inherited mappings follow, so there is nothing to print for
+ ;; `keymap' itself.
+ (when (not (eq key 'keymap))
+ (notmuch-substitute-one-command-key-with-prefix nil key)))
(defun notmuch-substitute-command-keys (doc)
"Like `substitute-command-keys' but with documentation, not function names."
(let ((beg 0))
(while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)
- (let ((map (substring doc (match-beginning 1) (match-end 1))))
- (setq doc (replace-match (mapconcat 'notmuch-substitute-one-command-key
- (cdr (symbol-value (intern map))) "\n") 1 1 doc)))
+ (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))
+ (keymap (symbol-value (intern keymap-name))))
+ (setq doc (replace-match
+ (mapconcat #'notmuch-substitute-command-keys-one
+ (cdr keymap) "\n")
+ 1 1 doc)))
(setq beg (match-end 0)))
doc))
--
1.7.7.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-12-30 11:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-16 13:12 [PATCH] emacs: notmuch-hello: respect notmuch-help's wishes Pieter Praet
2011-11-11 17:29 ` David Bremner
2011-11-16 10:56 ` Pieter Praet
2011-12-30 11:37 ` [PATCH] emacs: Better handling of inherited keymaps for `nomuch-help' David Edmondson
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).