X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch.el;h=05e7c4d1cece5e075e0e6b3f23d7a618750549a1;hp=608c76d43138a4bdeafd35bb730ce7bc8bc36755;hb=a5e9c06eb6d6334da8505a527be22cdd935aacfb;hpb=26bb521f52960af10775864b822d6e84c507ead3 diff --git a/notmuch.el b/notmuch.el index 608c76d4..05e7c4d1 100644 --- a/notmuch.el +++ b/notmuch.el @@ -225,10 +225,15 @@ buffer." (defun notmuch-show-reply () "Begin composing a reply to the current message in a new buffer." (interactive) - (view-file (notmuch-show-get-filename)) - (let ((buf (current-buffer))) - (message-reply) - (kill-buffer buf))) + (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))) (defun notmuch-show-pipe-message (command) "Pipe the contents of the current message to the given command. @@ -679,6 +684,7 @@ global search. (interactive) (kill-all-local-variables) (make-local-variable 'notmuch-search-query-string) + (make-local-variable 'notmuch-search-oldest-first) (set (make-local-variable 'scroll-preserve-screen-position) t) (add-to-invisibility-spec 'notmuch-search) (use-local-map notmuch-search-mode-map) @@ -708,18 +714,6 @@ global search. (notmuch-search-markup-this-thread-id) (next-line)))) -(defun notmuch-search-hide-thread-ids () - (interactive) - (add-to-invisibility-spec 'notmuch-search) - (force-window-update) - (redisplay t)) - -(defun notmuch-search-show-thread-ids () - (interactive) - (remove-from-invisibility-spec 'notmuch-search) - (force-window-update) - (redisplay t)) - (defun notmuch-search-show-thread () (interactive) (let ((thread-id (notmuch-search-find-thread-id))) @@ -784,13 +778,14 @@ This function advances point to the next line when finished." (notmuch-search-remove-tag "inbox") (forward-line)) -(defun notmuch-search (query) +(defun notmuch-search (query &optional oldest-first) "Run \"notmuch search\" with the given query string and display results." (interactive "sNotmuch search: ") (let ((buffer (get-buffer-create (concat "*notmuch-search-" query "*")))) (switch-to-buffer buffer) (notmuch-search-mode) (set 'notmuch-search-query-string query) + (set 'notmuch-search-oldest-first oldest-first) (let ((proc (get-buffer-process (current-buffer))) (inhibit-read-only t)) (if proc @@ -799,7 +794,9 @@ This function advances point to the next line when finished." (erase-buffer) (goto-char (point-min)) (save-excursion - (call-process "notmuch" nil t nil "search" query) + (if oldest-first + (call-process "notmuch" nil t nil "search" query) + (call-process "notmuch" nil t nil "search" "--reverse" query)) (notmuch-search-markup-thread-ids) )))) @@ -813,10 +810,11 @@ thread. Otherwise, point will be moved to attempt to be in the same relative position within the new buffer." (interactive) (let ((here (point)) + (oldest-first notmuch-search-oldest-first) (thread (notmuch-search-find-thread-id)) (query notmuch-search-query-string)) (kill-this-buffer) - (notmuch-search query) + (notmuch-search query oldest-first) (goto-char (point-min)) (if (re-search-forward (concat "^" thread) nil t) (beginning-of-line) @@ -828,7 +826,7 @@ same relative position within the new buffer." Runs a new search matching only messages that match both the current search results AND the additional query string provided." (interactive "sFilter search: ") - (notmuch-search (concat notmuch-search-query-string " and " query))) + (notmuch-search (concat notmuch-search-query-string " and " query) notmuch-search-oldest-first)) (defun notmuch-search-filter-by-tag (tag) "Filter the current search results based on a single tag. @@ -836,11 +834,11 @@ current search results AND the additional query string provided." Runs a new search matching only messages that match both the current search results AND that are tagged with the given tag." (interactive "sFilter by tag: ") - (notmuch-search (concat notmuch-search-query-string " and tag:" tag))) + (notmuch-search (concat notmuch-search-query-string " and tag:" tag) notmuch-search-oldest-first)) (defun notmuch () "Run notmuch to display all mail with tag of 'inbox'" (interactive) - (notmuch-search "tag:inbox")) + (notmuch-search "tag:inbox" t)) (provide 'notmuch)