]> git.cworth.org Git - notmuch-wiki/blobdiff - emacstips.mdwn
request searching by clicking on id:Message-ID in notmuch-show
[notmuch-wiki] / emacstips.mdwn
index c9b95b84db035d400e563cd537da29b1cec2c84d..5f483355b2579d57fd36124953a2a44489f8514e 100644 (file)
@@ -74,10 +74,35 @@ works by dragging from the file manager without any modifications.
 
 <h2 id="advanced_tips">Advanced tips and tweaks</h2>
 
-* <span id="custom_keybinding">**Add a keybinding to add/remove/toggle a tag.**</span>
+* <span id="custom_keybinding">**Add a key binding to add/remove/toggle a tag.**</span>
 
-  Here's an example of how to add a key binding to notmuch-show-mode
-  to toggle a "deleted" tag:
+  The notmuch-{search,show}-{add,remove}-tag functions are very useful
+  for making quick tag key bindings.  For instance, here's an example
+  of how to make a key binding to add the "spam" tag and remove the
+  "inbox" tag in notmuch-show-mode:
+
+               (define-key notmuch-show-mode-map "S"
+                 (lambda ()
+                   "mark message as spam"
+                   (interactive)
+                   (notmuch-show-add-tag "spam")
+                   (notmuch-show-remove-tag "inbox")))
+
+  You can do the same for threads in notmuch-search-mode by just
+  replacing "show" with "search" in the called functions.
+
+  The definition above makes use of a lambda function, but you could
+  also define a separate function first:
+
+               (defun notmuch-show-tag-spam()
+                 "mark message as spam"
+                 (interactive)
+                 (notmuch-show-add-tag "spam")
+                 (notmuch-show-remove-tag "inbox")))
+               (define-key notmuch-show-mode-map "S" 'notmuch-show-tag-spam)
+
+  Here's a more complicated example of how to add a toggle "deleted"
+  key:
 
                (define-key notmuch-show-mode-map "d"
                  (lambda ()
@@ -87,19 +112,6 @@ works by dragging from the file manager without any modifications.
                        (notmuch-show-remove-tag "deleted")
                      (notmuch-show-add-tag "deleted"))))
 
-  You can do the same for threads in notmuch-search-mode by just
-  replacing "show" with "search" in the called functions.  This
-  definition makes use of a lambda function, but you could just as
-  easily defined a separate function first:
-
-               (defun notmuch-show-toggle-deleted-tag()
-                 "toggle deleted tag for message"
-                 (interactive)
-                 (if (member "deleted" (notmuch-show-get-tags))
-                     (notmuch-show-remove-tag "deleted")
-                   (notmuch-show-add-tag "deleted")))
-               (define-key notmuch-show-mode-map "d" 'notmuch-show-toggle-deleted-tag)
-
 * <span id="fcc">**How to do FCC/BCC...**</span>
 
   Any notmuch reply will automatically include your primary email
@@ -212,35 +224,32 @@ works by dragging from the file manager without any modifications.
 
   There are currently two solutions to this:
 
-  * [bbdb](http://bbdb.sourceforge.net) is a contact database for
-    emacs that works quite nicely together with message mode,
-    including address autocompletion.
+  [bbdb](http://bbdb.sourceforge.net) is a contact database for emacs
+  that works quite nicely together with message mode, including
+  address autocompletion.
 
-  * You can also use the notmuch database as a mail address book
-    itself.  To do this you need a command line tool that outputs
-    likely address candidates based on a search string.   There are currently two available:
+  You can also use the notmuch database as a mail address book itself.
+  To do this you need a command line tool that outputs likely address
+  candidates based on a search string.  There are currently two
+  available:
 
-    * The python tool notmuch_address.py ('git clone
+    * The python tool notmuch\_address.py ('git clone
       http://jkr.acm.jhu.edu/git/notmuch_addresses.git`) (slower, but
       no compilation required so good for testing the setup)
 
     * The vala-based
       [addrlookup](http://github.com/spaetz/vala-notmuch) (faster, but
-      needs compiling).  This is how you compile the (3rd party) tool
-      "addrlookup" to give you address completion:
-
-      * you need the addrlookup binary, first of all. Grab
-        http://github.com/spaetz/vala-notmuch/raw/static-sources/src/addrlookup.c
-        and build it with `cc -o addrlookup addrlookup.c ``pkg-config
-        --cflags --libs gobject-2.0`` -lnotmuch`. That should give you
-        the binary that you can test already.
-
-      * EUDC is integrated into emacs and can be used for tab
-        completion of email addresses. The code I use is here
-        http://gist.github.com/359425. It was announce in [this
-        mail](http://mid.gmane.org/87fx3uflkx.fsf@jhu.edu)
-        (id:87fx3uflkx.fsf@jhu.edu) which contains links to the git
-        repositories which contain the files.
+      needs compiling).  The addrlookup binary needs to be compiled.
+      Grab
+      http://github.com/spaetz/vala-notmuch/raw/static-sources/src/addrlookup.c
+      and build it with:
+
+                      cc -o addrlookup addrlookup.c `pkg-config --cflags --libs gobject-2.0` -lnotmuch
+
+  EUDC is integrated into emacs and is needed for tab completion of
+  email addresses. See [this
+  mail](http://mid.gmane.org/87fx3uflkx.fsf@jhu.edu)
+  (id:87fx3uflkx.fsf@jhu.edu) for more information.
 
 * <span id="sign_messages_gpg">**how to sign/encrypt my messages with
   gpg**</span>