]> git.notmuchmail.org Git - notmuch-wiki/blobdiff - emacstips.mdwn
Mention change from notmuch-search-tag-thread to notmuch-search-tag
[notmuch-wiki] / emacstips.mdwn
index ef96e00210a201767b12bb162a4235bef2f8c9f2..ffc057c83f9b2e86af2a0ecf7a115af5029a9341 100644 (file)
@@ -1,14 +1,13 @@
-<!-- -*- mode: text; indent-tabs-mode: nil -*- -->
+# Tips and Tricks for using notmuch with Emacs
 
-[[!img notmuch-logo.png alt="Notmuch logo" class="left"]]
-#Tips and Tricks for using notmuch with Emacs
+One of the more popular notmuch message reading clients is
+**notmuch.el**, an [emacs](http://www.gnu.org/software/emacs/) major
+mode for interacting with notmuch.  It is included in the notmuch
+package.  This page goes over some usage tips for using notmuch with
+Emacs.
 
 [[!toc levels=2]]
 
-The main Notmuch message reading client is **notmuch.el**, which is an
-[emacs](http://www.gnu.org/software/emacs/) major mode, and is
-included in the notmuch package.
-
 ## Setup
 
 To use the Notmuch emacs mode, first add the following line to your
@@ -162,7 +161,8 @@ the above needs to be changed to this:
 You can do the same for threads in `notmuch-search-mode` by just
 replacing "show" with "search" in the called functions.
 
-(Starting from notmuch 0.12 use `notmuch-search-tag-thread` instead)
+(Starting from notmuch 0.12 use `notmuch-search-tag-thread` instead,
+starting from 0.13 use `notmuch-search-tag`).
 
 The definition above makes use of a lambda function, but you could
 also define a separate function first:
@@ -197,6 +197,34 @@ And version for notmuch 0.12 (not released yet)
               (if (member "deleted" (notmuch-show-get-tags))
                   "-deleted" "+deleted"))))
 
+## Adding many tagging keybindings
+
+If you want to have have many tagging keybindings, you can save the typing
+the few lines of  boilerplate for every binding (for versions before 0.12,
+you will need to change notmuch-show-apply-tag-macro).
+
+    (eval-after-load 'notmuch-show
+      '(define-key notmuch-show-mode-map "`" 'notmuch-show-apply-tag-macro))
+
+    (setq notmuch-show-tag-macro-alist
+      (list
+       '("m" "+notmuch::patch" "+notmuch::moreinfo" "-notmuch::needs-review")
+       '("n" "+notmuch::patch" "+notmuch::needs-review" "-notmuch::pushed")
+       '("o" "+notmuch::patch" "+notmuch::obsolete"
+             "-notmuch::needs-review" "-notmuch::moreinfo")
+       '("p" "-notmuch::pushed" "-notmuch::needs-review"
+         "-notmuch::moreinfo" "+pending")
+       '("P" "-pending" "-notmuch::needs-review" "-notmuch::moreinfo" "+notmuch::pushed")
+       '("r" "-notmuch::patch" "+notmuch::review")
+       '("s" "+notmuch::patch" "-notmuch::obsolete" "-notmuch::needs-review" "-notmuch::moreinfo" "+notmuch::stale")
+       '("t" "+notmuch::patch" "-notmuch::needs-review" "+notmuch::trivial")
+       '("w" "+notmuch::patch" "+notmuch::wip" "-notmuch::needs-review")))
+
+    (defun notmuch-show-apply-tag-macro (key)
+      (interactive "k")
+      (let ((macro (assoc key notmuch-show-tag-macro-alist)))
+        (apply 'notmuch-show-tag-message (cdr macro))))
+
 ## Restore reply-to-all key binding to 'r'
 
 Starting from notmuch 0.12 the 'r' key is bound to reply-to-sender instead of