"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.")
(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
(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)
(goto-char (point-min))
(while (not (eobp))
(notmuch-search-markup-this-thread-id)
- (next-line))))
+ (forward-line))))
(defun notmuch-search-show-thread ()
(interactive)
(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)
))))