]> git.cworth.org Git - obsolete/notmuch-wiki/blobdiff - emacstips.mdwn
Debian squeeze users should start with up to date versions from backports.
[obsolete/notmuch-wiki] / emacstips.mdwn
index e63ab3137f9d45fc2a3802bc043523392050fb13..90b7a2553ae65a2fce61dcdbe1875aac5c775463 100644 (file)
@@ -3,13 +3,17 @@
 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.
+package (notmuch-emacs in Debian).  This page goes over some usage
+tips for using notmuch with Emacs.
 
 [[!toc levels=2]]
 
 ## Setup
 
+Have a look at the [Howto](http://notmuchmail.org/howto/) for
+prerequisites.  Be sure you have done the general setup using the
+notmuch cli command!
+
 To use the Notmuch emacs mode, first add the following line to your
 `.emacs` rc file:
 
@@ -25,8 +29,11 @@ notmuch` from within a running emacs.
 ## Navigating & reading mails
 
 When first starting notmuch in emacs, you will be presented with the
-notmuch "hello" page.  From here you can do searches, see lists of
-recent searches, saved searches, message tags, help information, etc.
+notmuch "hello" page.  If it exits with an error after writing
+"Welcome to notmutch. You have" you need to do the basic notmuch setup
+first (see above).  
+From here you can do searches, see lists of recent
+searches, saved searches, message tags, help information, etc.
 
 Executing a search will open a new buffer in `notmuch-search-mode`
 displaying the search results.  Each line in the search results
@@ -579,3 +586,30 @@ buffer.
               (setq notmuch-hello-refresh-count new-count))))
 
         (add-hook 'notmuch-hello-refresh-hook 'notmuch-hello-refresh-status-message)
+
+## Replacing tabs with spaces in subject and header
+
+Mailman mailing list software rewrites and rewraps long message subjects in
+a way that causes TABs to appear in the middle of the subject and header
+lines. Add this to your `.emacs` to replace tabs with spaces in subject
+lines:
+
+       (defun notmuch-show-subject-tabs-to-spaces ()
+         "Replace tabs with spaces in subject line."
+         (goto-char (point-min))
+         (when (re-search-forward "^Subject:" nil t)
+           (while (re-search-forward "\t" (line-end-position) t)
+             (replace-match " " nil nil))))
+
+       (add-hook 'notmuch-show-markup-headers-hook 'notmuch-show-subject-tabs-to-spaces)
+
+And in header lines (this will only work with the yet to be released
+notmuch version 0.15):
+
+       (defun notmuch-show-header-tabs-to-spaces ()
+         "Replace tabs with spaces in header line."
+         (setq header-line-format
+               (notmuch-show-strip-re
+                (replace-regexp-in-string "\t" " " (notmuch-show-get-subject)))))
+
+       (add-hook 'notmuch-show-hook 'notmuch-show-header-tabs-to-spaces)