]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch.el
Fix linking with gcc to use g++ to link in C++ libs.
[notmuch] / notmuch.el
index 6d609dba752534438bfca5f3db73fc3d07186879..014d15bc85508edf392fe15171c5eec9a4004add 100644 (file)
   "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
 
+(defvar notmuch-show-signature-regexp "\\(-- ?\\|_+\\)$"
+  "Pattern to match a line that separates content from signature.
+
+The regexp can (and should) include $ to match the end of the
+line, but should not include ^ to match the beginning of the
+line. This is because notmuch may have inserted additional space
+for indentation at the beginning of the line. But notmuch will
+move past the indentation when testing this pattern, (so that the
+pattern can still test against the entire line).")
+
 (defvar notmuch-show-signature-lines-max 12
   "Maximum length of signature that will be hidden by default.")
 
@@ -195,7 +205,7 @@ Unlike builtin `next-line' this version accepts no arguments."
 (defun notmuch-show-mark-read-then-archive-thread ()
   "Remove \"unread\" tag from each message, then archive and show next thread.
 
-Archive each message currrently shown by removing the \"unread\"
+Archive each message currently shown by removing the \"unread\"
 and \"inbox\" tag from each. Then kill this buffer and show the
 next thread from the search from which this thread was originally
 shown.
@@ -210,7 +220,7 @@ buffer."
 (defun notmuch-show-archive-thread ()
   "Archive each message in thread, and show next thread from search.
 
-Archive each message currrently shown by removing the \"inbox\"
+Archive each message currently shown by removing the \"inbox\"
 tag from each. Then kill this buffer and show the next thread
 from the search from which this thread was originally shown.
 
@@ -330,7 +340,7 @@ there are no more unread messages past the current point."
       (notmuch-show-next-message)))
 
 (defun notmuch-show-next-open-message ()
-  "Advance to the the next message which is not hidden.
+  "Advance to the next message which is not hidden.
 
 If read messages are currently hidden, advance to the next unread
 message. Otherwise, advance to the next message."
@@ -443,7 +453,8 @@ which this thread was originally shown."
                           (concat indent
                                   "[" (number-to-string (count-lines beg-sub (point)))
                                   "-line citation. Press 'c' to show.]\n")))))
-      (if (looking-at "[[:space:]]*-- ?$")
+      (move-to-column depth)
+      (if (looking-at notmuch-show-signature-regexp)
          (let ((sig-lines (- (count-lines beg-sub end) 1)))
            (if (<= sig-lines notmuch-show-signature-lines-max)
                (progn
@@ -464,11 +475,15 @@ which this thread was originally shown."
        (let ((beg (point-marker)))
          (re-search-forward notmuch-show-part-end-regexp)
          (let ((end (copy-marker (match-beginning 0))))
+           (goto-char end)
+           (if (not (bolp))
+               (insert "\n"))
            (indent-rigidly beg end depth)
            (notmuch-show-markup-citations-region beg end depth)
            ; Advance to the next part (if any) (so the outer loop can
            ; determine whether we've left the current message.
-           (re-search-forward notmuch-show-part-begin-regexp nil t))))
+           (if (re-search-forward notmuch-show-part-begin-regexp nil t)
+               (beginning-of-line)))))
     (goto-char end)))
 
 (defun notmuch-show-markup-parts-region (beg end depth)
@@ -659,7 +674,7 @@ thread from that buffer can be show when done with this one)."
       )))
 
 (defvar notmuch-search-authors-width 40
-  "Number of columns to use to diplay authors in a notmuch-search buffer.")
+  "Number of columns to use to display authors in a notmuch-search buffer.")
 
 (defvar notmuch-search-mode-map
   (let ((map (make-sparse-keymap)))
@@ -776,7 +791,7 @@ global search.
     (goto-char (point-min))
     (while (not (eobp))
       (notmuch-search-markup-this-thread-id)
-      (next-line))))
+      (forward-line))))
 
 (defun notmuch-search-show-thread ()
   (interactive)
@@ -859,8 +874,8 @@ This function advances point to the next line when finished."
       (goto-char (point-min))
       (save-excursion
        (if oldest-first
-           (call-process "notmuch" nil t nil "search" query)
-         (call-process "notmuch" nil t nil "search" "--reverse" query))
+           (call-process "notmuch" nil t nil "search" "--sort=oldest-first" query)
+         (call-process "notmuch" nil t nil "search" "--sort=newest-first" query))
        (notmuch-search-markup-thread-ids)
        ))))
 
@@ -895,7 +910,7 @@ the beginning of the buffer).
 
 This command toggles the sort order for the current search.
 
-Note that any fitlered searches created by
+Note that any filtered searches created by
 `notmuch-search-filter' retain the search order of the parent
 search."
   (interactive)