[RFC] Smart replying
Jesse Rosenthal
jrosenthal at jhu.edu
Thu Mar 1 12:35:13 PST 2012
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 at notmuchmail.org"))
More information about the notmuch
mailing list