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 816E6431FAF for ; Thu, 1 Mar 2012 12:34:46 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled 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 XcUcP275wtd3 for ; Thu, 1 Mar 2012 12:34:46 -0800 (PST) Received: from ipex3.johnshopkins.edu (ipex3.johnshopkins.edu [128.220.161.140]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E716A431FAE for ; Thu, 1 Mar 2012 12:34:45 -0800 (PST) X-IronPort-AV: E=Sophos;i="4.73,513,1325480400"; d="scan'208";a="197548012" Received: from unknown (HELO watt) ([10.161.33.18]) by ipex3.johnshopkins.edu with ESMTP/TLS/AES256-SHA; 01 Mar 2012 15:34:45 -0500 Received: from jkr by watt with local (Exim 4.76) (envelope-from ) id 1S3CiX-0003pO-Vd; Thu, 01 Mar 2012 15:35:14 -0500 From: Jesse Rosenthal To: notmuch@notmuchmail.org Subject: [RFC] Smart replying Date: Thu, 01 Mar 2012 15:35:13 -0500 Message-ID: <87hay8xdoe.fsf@jhu.edu> MIME-Version: 1.0 Content-Type: text/plain 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: Thu, 01 Mar 2012 20:34:46 -0000 Dear All, I know that folks recently got done haggling over reply bindings, but there's something I've been using for a little while, and I was curious about whether it's something people would be interested in. Forgive me if this functionality was already discussed and I missed it. The problem is that I often forget to reply-all to list mails and write out half a message, and then have to cut and paste. So, as usual, my solution is to try and have emacs figure it out for me. Pretty simple: have a variable `reply-all-list'. If an address in the `To' or `CC' fields is in that list, 'r' replies-all. If not, it replies-sender. CTRL-r (or whatever) forces `reply-sender', on the rare occasion I want to take a conversation offline. The nice thing about this is, if `reply-all-list' is nil, then it acts as normal, so it wouldn't make a difference to most users. The implementation that's been sitting in my .emacs is below. I'm not offering it as a patch, because I don't quite understand the current relation of notmuch-show.el and notmuch-mua.el. If people are interested, though, I could make it into a patch. And, if not, I hope it's a snippet that someone finds useful. Best, Jesse ~~~~~~~~~~~~~~~~~~~~~~~~~ (defvar reply-all-list nil) (defun jkr/notmuch-show-check-to-cc (address-list) (let* ((to-cc-list (apply 'append (mapcar 'mail-header-parse-addresses (list (notmuch-show-get-to) (notmuch-show-get-cc))))) (to-cc-addr-list (mapcar 'car to-cc-list))) (intersection address-list to-cc-addr-list :test 'equal))) (defun jkr/notmuch-show-smart-reply-all () "Reply to sender, unless address is on reply-all list" (interactive) (if (jkr/notmuch-show-check-to-cc reply-all-list) (notmuch-show-reply) (notmuch-show-reply-sender))) (defun jkr/notmuch-show-force-reply-sender () "Reply to sender only, regardless of reply-all list" (interactive) (notmuch-show-reply-sender)) (define-key notmuch-show-mode-map "r" 'jkr/notmuch-show-smart-reply-all) (define-key notmuch-show-mode-map "\C-r" 'jkr/notmuch-show-force-reply-sender) ; (setq reply-all-list '("notmuch@notmuchmail.org"))