(define-key map (kbd "DEL") 'notmuch-show-rewind)
(define-key map " " 'notmuch-show-advance-marking-read-and-archiving)
(define-key map "|" 'notmuch-show-pipe-message)
+ (define-key map "?" 'describe-mode)
map)
"Keymap for \"notmuch show\" buffers.")
(fset 'notmuch-show-mode-map notmuch-show-mode-map)
(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.
(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.
(mm-display-parts (mm-dissect-buffer))
(kill-this-buffer))))
+(defun notmuch-reply (query-string)
+ (switch-to-buffer (generate-new-buffer "notmuch-draft"))
+ (call-process "notmuch" nil t nil "reply" query-string)
+ (goto-char (point-min))
+ (if (re-search-forward "^$" nil t)
+ (progn
+ (insert "--text follows this line--")
+ (forward-line)))
+ (message-mode))
+
(defun notmuch-show-reply ()
"Begin composing a reply to the current message in a new buffer."
(interactive)
(let ((message-id (notmuch-show-get-message-id)))
- (switch-to-buffer (generate-new-buffer "notmuch-draft"))
- (call-process "notmuch" nil t nil "reply" message-id)
- (goto-char (point-min))
- (if (re-search-forward "^$" nil t)
- (progn
- (insert "--text follows this line--")
- (forward-line)))
- (message-mode)))
+ (notmuch-reply message-id)))
(defun notmuch-show-pipe-message (command)
"Pipe the contents of the current message to the given command.
(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."
mode-name "notmuch-show")
(setq buffer-read-only t))
+;;;###autoload
+
+(defgroup notmuch nil
+ "Notmuch mail reader for Emacs."
+ :group 'mail)
+
+(defcustom notmuch-show-hook nil
+ "List of functions to call when notmuch displays a message."
+ :type 'hook
+ :options '(goto-address)
+ :group 'notmuch)
+
+; Make show mode a bit prettier, highlighting URLs and using word wrap
+
+(defun notmuch-show-pretty-hook ()
+ (goto-address-mode 1)
+ (visual-line-mode))
+
+(add-hook 'notmuch-show-hook 'notmuch-show-pretty-hook)
+
(defun notmuch-show (thread-id &optional parent-buffer)
"Run \"notmuch show\" with the given thread ID and display results.
(call-process "notmuch" nil t nil "show" thread-id)
(notmuch-show-markup-messages)
)
+ (run-hooks 'notmuch-show-hook)
; Move straight to the first unread message
(if (not (notmuch-show-message-unread-p))
(progn
)))
(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)))
(define-key map "o" 'notmuch-search-toggle-order)
(define-key map "p" 'previous-line)
(define-key map "q" 'kill-this-buffer)
+ (define-key map "r" 'notmuch-search-reply-to-thread)
(define-key map "s" 'notmuch-search)
(define-key map "t" 'notmuch-search-filter-by-tag)
(define-key map "x" 'kill-this-buffer)
(define-key map "\M->" 'notmuch-search-goto-last-thread)
(define-key map " " 'notmuch-search-scroll-up)
(define-key map (kbd "<DEL>") 'notmuch-search-scroll-down)
+ (define-key map "?" 'describe-mode)
map)
"Keymap for \"notmuch search\" buffers.")
(fset 'notmuch-search-mode-map notmuch-search-mode-map)
(set (make-local-variable 'scroll-preserve-screen-position) t)
(add-to-invisibility-spec 'notmuch-search)
(use-local-map notmuch-search-mode-map)
+ (setq truncate-lines t)
(setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
(setq buffer-read-only t))
(goto-char (point-min))
(while (not (eobp))
(notmuch-search-markup-this-thread-id)
- (next-line))))
+ (forward-line))))
(defun notmuch-search-show-thread ()
(interactive)
(notmuch-show thread-id (current-buffer))
(error "End of search results"))))
+(defun notmuch-search-reply-to-thread ()
+ "Begin composing a reply to the entire current thread in a new buffer."
+ (interactive)
+ (let ((message-id (notmuch-search-find-thread-id)))
+ (notmuch-reply message-id)))
+
(defun notmuch-call-notmuch-process (&rest args)
"Synchronously invoke \"notmuch\" with the given list of arguments.
(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)
))))
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)
(interactive)
(notmuch-search "tag:inbox" t))
+(setq mail-user-agent 'message-user-agent)
+
(provide 'notmuch)