unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jameson Graef Rollins <jrollins@phys.columbia.edu>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: notmuch@notmuchmail.org
Subject: Re: modifying emacs keymap
Date: Mon, 28 Dec 2009 19:30:29 -0500	[thread overview]
Message-ID: <20091229003029.GA4400@finestructure.net> (raw)
In-Reply-To: <87k4w691kd.fsf@thinkpad.tsdh.de>

[-- Attachment #1: Type: text/plain, Size: 1941 bytes --]

On Mon, Dec 28, 2009 at 11:27:30PM +0100, Tassilo Horn wrote:
> > (add-hook 'notmuch-search-mode
> >   (define-key notmuch-search-mode-map "A" 'notmuch-show-mark-read-then-archive-thread)
> > )
> 
> `notmuch-search-mode' is no hook, and even if it was, you couldn't add
> what you like, because that's no function.  You would need to define a
> function that doesn that or wrap it in a lambda function.

Thanks for the response, Tassilo.  I should have explained that the
command I used above did work in so far as it did make the new key
available in the correct mode (notmuch-search-mode), as I could tell
through the notmuch-help in the notmuch-search-mode.  The command I
used above has worked for me in other contexts, as I've found
documented in a couple of different place on the net.  I'm completely
an elisp n00b, though, and I can't claim to understand why it worked.

> Anyway, this should do the trick:
> 
> (define-key notmuch-search-mode-map "A" 'notmuch-show-mark-read-then-archive-thread)

As far as I can tell, this command works the same as the one I used
above.  It produces identical results.

I realize now that the problem is that the
notmuch-show-mark-read-then-archive-thread function is meant for
notmuch-show-mode (as should have been clear to me via the name) and
not for notmuch-search-mode.  I manually created a new function for
the appropriate mode, and that worked.  Below is the code that I used
that worked.

Thanks for the help, and sorry for the spam.

jamie.


(defun notmuch-search-mark-read-then-archive-thread ()
  "Mark thread as read (remove \"unread\" tag) and then archive (remove \"inbox\" tag).
This function advances to the next thread when finished."
  (interactive)
  (notmuch-search-remove-tag "inbox")
  (notmuch-search-remove-tag "unread")
  (forward-line))
(define-key notmuch-search-mode-map "A" 'notmuch-search-mark-read-then-archive-thread)

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2009-12-29  0:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28 21:18 modifying emacs keymap Jameson Graef Rollins
2009-12-28 22:27 ` Tassilo Horn
2009-12-29  0:30   ` Jameson Graef Rollins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091229003029.GA4400@finestructure.net \
    --to=jrollins@phys.columbia.edu \
    --cc=notmuch@notmuchmail.org \
    --cc=tassilo@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).