]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch.el
Integrate notmuch-maildir-fcc into notmuch
[notmuch] / emacs / notmuch.el
index 1d8d7da0e8d01528525291503eead73df4562ff0..4894012a09b02617cde6d2ffd07aa4d7131806c7 100644 (file)
@@ -53,6 +53,9 @@
 
 (require 'notmuch-lib)
 (require 'notmuch-show)
+(require 'notmuch-mua)
+(require 'notmuch-hello)
+(require 'notmuch-maildir-fcc)
 
 (defcustom notmuch-search-result-format
   `(("date" . "%s ")
@@ -111,17 +114,6 @@ For example:
             (mm-save-part p))))
    mm-handle))
 
-(defun notmuch-reply (query-string)
-  (switch-to-buffer (generate-new-buffer "notmuch-draft"))
-  (call-process notmuch-command nil t nil "reply" query-string)
-  (message-insert-signature)
-  (goto-char (point-min))
-  (if (re-search-forward "^$" nil t)
-      (progn
-       (insert "--text follows this line--")
-       (forward-line)))
-  (message-mode))
-
 (defun notmuch-documentation-first-line (symbol)
   "Return the first line of the documentation string for SYMBOL."
   (let ((doc (documentation symbol)))
@@ -211,7 +203,7 @@ For a mouse binding, return nil."
     (define-key map "p" 'notmuch-search-previous-thread)
     (define-key map "n" 'notmuch-search-next-thread)
     (define-key map "r" 'notmuch-search-reply-to-thread)
-    (define-key map "m" 'message-mail)
+    (define-key map "m" 'notmuch-mua-mail)
     (define-key map "s" 'notmuch-search)
     (define-key map "o" 'notmuch-search-toggle-order)
     (define-key map "=" 'notmuch-search-refresh-view)
@@ -231,8 +223,6 @@ For a mouse binding, return nil."
 (defvar notmuch-search-query-string)
 (defvar notmuch-search-target-thread)
 (defvar notmuch-search-target-line)
-(defvar notmuch-search-oldest-first t
-  "Show the oldest mail first in the search-mode")
 (defvar notmuch-search-continuation)
 
 (defvar notmuch-search-disjunctive-regexp      "\\<[oO][rR]\\>")
@@ -405,7 +395,7 @@ Complete list of currently available key bindings:
   "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)))
+    (notmuch-mua-reply message-id)))
 
 (defun notmuch-call-notmuch-process (&rest args)
   "Synchronously invoke \"notmuch\" with the given list of arguments.
@@ -592,11 +582,13 @@ matching will be applied."
    ((string-equal field "count")
     (insert (format (cdr (assoc field notmuch-search-result-format)) count)))
    ((string-equal field "authors")
-    (insert (let ((sample (format (cdr (assoc field notmuch-search-result-format)) "")))
-             (if (> (length authors)
-                    (length sample))
-                 (concat (substring authors 0 (- (length sample) 4)) "... ")
-               (format (cdr (assoc field notmuch-search-result-format)) authors)))))
+    (insert (let* ((format-string (cdr (assoc field notmuch-search-result-format)))
+                  (formatted-sample (format format-string ""))
+                  (formatted-authors (format format-string authors)))
+             (if (> (length formatted-authors)
+                    (length formatted-sample))
+                 (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")
+               formatted-authors))))
    ((string-equal field "subject")
     (insert (format (cdr (assoc field notmuch-search-result-format)) subject)))
    ((string-equal field "tags")
@@ -668,11 +660,6 @@ characters as well as `_.+-'.
     (apply 'notmuch-call-notmuch-process "tag"
           (append action-split (list notmuch-search-query-string) nil))))
 
-(defcustom notmuch-folders (quote (("inbox" . "tag:inbox") ("unread" . "tag:unread")))
-  "List of searches for the notmuch folder view"
-  :type '(alist :key-type (string) :value-type (string))
-  :group 'notmuch)
-
 (defun notmuch-search-buffer-title (query)
   "Returns the title for a buffer with notmuch search results."
   (let* ((folder (rassoc-if (lambda (key)
@@ -819,18 +806,18 @@ current search results AND that are tagged with the given tag."
 
 ;;;###autoload
 (defun notmuch ()
-  "Run notmuch to display all mail with tag of 'inbox'"
+  "Run notmuch and display saved searches, known tags, etc."
   (interactive)
-  (notmuch-search "tag:inbox" notmuch-search-oldest-first))
+  (notmuch-hello))
 
-(setq mail-user-agent 'message-user-agent)
+(setq mail-user-agent 'notmuch-user-agent)
 
 (defvar notmuch-folder-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "?" 'notmuch-help)
     (define-key map "x" 'kill-this-buffer)
     (define-key map "q" 'kill-this-buffer)
-    (define-key map "m" 'message-mail)
+    (define-key map "m" 'notmuch-mua-mail)
     (define-key map "e" 'notmuch-folder-show-empty-toggle)
     (define-key map ">" 'notmuch-folder-last)
     (define-key map "<" 'notmuch-folder-first)