unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [RFC] Smart replying
@ 2012-03-01 20:35 Jesse Rosenthal
  2012-03-01 21:02 ` Nicolás Reynolds
  0 siblings, 1 reply; 3+ messages in thread
From: Jesse Rosenthal @ 2012-03-01 20:35 UTC (permalink / raw)
  To: notmuch

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"))

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-01 21:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-01 20:35 [RFC] Smart replying Jesse Rosenthal
2012-03-01 21:02 ` Nicolás Reynolds
2012-03-01 21:15   ` Nicolás Reynolds

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).