]> git.notmuchmail.org Git - notmuch/commitdiff
contrib: pick: archive message updated
authorMark Walters <markwalters1009@gmail.com>
Sat, 8 Dec 2012 12:41:34 +0000 (12:41 +0000)
committerDavid Bremner <bremner@debian.org>
Sat, 15 Dec 2012 17:48:02 +0000 (13:48 -0400)
Update pick's archive message to respect notmuch-archive-tags. Also
split archive message into an archiving part and a separate
"then-next" part, to move more inline with show. Update the keybinding
so default behaviour is unchanged.

contrib/notmuch-pick/notmuch-pick.el

index cf026af3b23d0d5783b60199c28fa9b77b13bc74..9d3999bf0f0cc2ee7258e6f393791a21494fbb70 100644 (file)
     (define-key map "q" 'notmuch-pick-quit)
     (define-key map "x" 'notmuch-pick-quit)
     (define-key map "?" 'notmuch-help)
     (define-key map "q" 'notmuch-pick-quit)
     (define-key map "x" 'notmuch-pick-quit)
     (define-key map "?" 'notmuch-help)
-    (define-key map "a" 'notmuch-pick-archive-message)
+    (define-key map "a" 'notmuch-pick-archive-message-then-next)
     (define-key map "=" 'notmuch-pick-refresh-view)
     (define-key map "s" 'notmuch-search)
     (define-key map "z" 'notmuch-pick)
     (define-key map "=" 'notmuch-pick-refresh-view)
     (define-key map "s" 'notmuch-search)
     (define-key map "z" 'notmuch-pick)
@@ -393,10 +393,23 @@ Does NOT change the database."
       (kill-buffer notmuch-pick-message-buffer))
     t))
 
       (kill-buffer notmuch-pick-message-buffer))
     t))
 
-(defun notmuch-pick-archive-message ()
+(defun notmuch-pick-archive-message (&optional unarchive)
+  "Archive the current message.
+
+Archive the current message by applying the tag changes in
+`notmuch-archive-tags' to it (remove the \"inbox\" tag by
+default). If a prefix argument is given, the message will be
+\"unarchived\", i.e. the tag changes in `notmuch-archive-tags'
+will be reversed."
+  (interactive "P")
+  (when notmuch-archive-tags
+    (apply 'notmuch-pick-tag
+          (notmuch-tag-change-list notmuch-archive-tags unarchive))))
+
+(defun notmuch-pick-archive-message-then-next (&optional unarchive)
   "Archive the current message and move to next matching message."
   "Archive the current message and move to next matching message."
-  (interactive)
-  (notmuch-pick-tag "-inbox")
+  (interactive "P")
+  (notmuch-pick-archive-message unarchive)
   (notmuch-pick-next-matching-message))
 
 (defun notmuch-pick-next-message ()
   (notmuch-pick-next-matching-message))
 
 (defun notmuch-pick-next-message ()