Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 75E0D40DDD9 for ; Fri, 12 Nov 2010 07:12:06 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.899 X-Spam-Level: X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3rnnmz0L52A1 for ; Fri, 12 Nov 2010 07:11:55 -0800 (PST) Received: from smtp3-g21.free.fr (smtp3-g21.free.fr [212.27.42.3]) by olra.theworths.org (Postfix) with ESMTP id C8EAA40DDCD for ; Fri, 12 Nov 2010 07:11:53 -0800 (PST) Received: from racin (unknown [82.239.207.166]) by smtp3-g21.free.fr (Postfix) with ESMTP id 601F1A6210 for ; Fri, 12 Nov 2010 16:11:47 +0100 (CET) From: Matthieu Lemerre To: notmuch@notmuchmail.org Subject: [PATCH] How to improve the mail handling workflow? User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Fri, 12 Nov 2010 16:23:58 +0100 Message-ID: <87fwv65zw1.fsf@free.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Nov 2010 15:12:06 -0000 --=-=-= Hi, I think that there are several irritating nitpicks when using notmuch in a typical mail workflow. I don't know how other people process their email. I for myself use the following method: 1. The script I use to fetch new mails tries to add tags if it can. For instance, all new mails from the notmuch mailing lists appears with tags "(inbox,unread,notmuch)". 2. When processing mails, I manually add some tag to the mails for which no tags were added automatically. Then I archive the mail (remove its inbox tag). 3. Sometimes I keep mails in my inbox, for instance if I am expecting a specific mail and do not want to take the time to process the others. The emacs interface to notmuch gets in my way in at least several manners: - I often find myself hitting the spacebar too much, which ends up with some of my new messages being removed from all of their tags, which make them very difficult to find. I don't think the spacebar should remove the inbox tag at all. It should only change the unread tag. - It does not provide a command for deleting mails. We were several people who provided patches to add a 'd' keybinding to support deletion. I provided a complex patch for that (that added "and not tag:deleted" to all requests", but I now think that just adding a "deleted" tag and removing the "inbox" tag would be sufficient). - Processing mails which do not have any automatically added tag is boring, because I need to press several keys to archive them: "+" to add a tag, and then "a". If I forget about +, then my mail is impossible to find. Here is first a patch that copes with this last point. Whenever you want to archive a thread, it finds whether you forgot to add a custom "user" tag to a message, and if so asks you for a tag to add before archiving. That way, I no longer have messages without any tags. I probably will send patches to handle the other bullet points to, but first I would be happy to hear your comments about this, or learn about how you process your mail using the current interface. Thanks, Matthieu Lemerre --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=out.patch diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index d8773e6..57ff72e 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1054,11 +1054,35 @@ argument, hide all of the messages." (interactive) (backward-button 1)) +(defun notmuch-is-user-tag (tag) + ;; Returns true if tag is not one of + ;; inbox, deleted, replied, draft, + (not (member tag '("inbox" "replied" "draft" "deleted" + "attachment" "unread")))) + (defun notmuch-show-archive-thread-internal (show-next) ;; Remove the tag from the current set of messages. (goto-char (point-min)) - (loop do (notmuch-show-remove-tag "inbox") - until (not (notmuch-show-goto-message-next))) + (let ((has-empty-tags)) + ;; 1st pass: try to see if adding a tag is necessary. + (loop do (let ((user-tags (remove-if-not #'notmuch-is-user-tag + (notmuch-show-get-tags)))) + (setq has-empty-tags + (or has-empty-tags (eq user-tags nil)))) + until (not (notmuch-show-goto-message-next))) + ;; Only ask for a tag to add if has-empty-tags is non-nil. Use + ;; tags-to-apply to propose a default value. + (let ((tags-to-add '())) + (if has-empty-tags + (setq tags-to-add (list (notmuch-select-tag-with-completion + "Some messages in the thread have no user tags. Add: ")))) + ;; 2nd pass: tag all the messages with the user-selected tag, + ;; and remove the "inbox" tag + (goto-char (point-min)) + (loop do (progn + (apply #'notmuch-show-add-tag tags-to-add) + (notmuch-show-remove-tag "inbox")) + until (not (notmuch-show-goto-message-next))))) ;; Move to the next item in the search results, if any. (let ((parent-buffer notmuch-show-parent-buffer)) (notmuch-kill-this-buffer) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 5933747..eeff18c 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -560,7 +560,9 @@ thread or threads in the current region." This function advances the next thread when finished." (interactive) - (notmuch-search-remove-tag-thread "inbox") + (save-excursion + (notmuch-search-show-thread) + (notmuch-show-archive-thread-internal nil)) (forward-line)) (defun notmuch-search-process-sentinel (proc msg) --=-=-=--