dotfiles

config files and scripts at HOME.
git clone git://git.ricketyspace.net/dotfiles.git
Log | Files | Refs

commit c566063d2f5e6732ab5d091bbc66b3fc6472db09
parent 11a3e95f3a3599b634f2e4e0135d8a4b88b78a45
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date:   Wed, 13 Apr 2016 18:46:55 +0000

.gnus: refactor message-setup-hook.

looks less ugly.

Diffstat:
.gnus.el | 33+++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/.gnus.el b/.gnus.el @@ -58,18 +58,27 @@ (signature-file "~/v/git/rsd/notes/personal/sig-bgc") ("X-Message-SMTP-Method" "smtp outlook.office365.com 587")))) -;; this is so ugly. fix it. -(add-hook 'message-setup-hook - (lambda () - (save-excursion - (save-restriction - (message-narrow-to-headers) - (let ((from (message-fetch-field "from"))) - (cond - ((string-match "sravik@bgsu.edu" from) - (setq mml2015-signers '("00B252AF"))) - ((string-match "rsd@gnu.org\\|rsiddharth@ninthfloor.org" from) - (setq mml2015-signers '("B6AD4643"))))))))) +(defun rsd/gnus/get-msg-header (header) + "Return value of HEADER in the message buffer." + (save-excursion + (save-restriction + (message-narrow-to-headers) + (message-fetch-field header)))) + +(defun rsd/gnus/set-gpg-key (from) + "Set gpg key according to the FROM address." + (cond + ((string-match "sravik@bgsu.edu" from) + (setq mml2015-signers '("00B252AF"))) + ((string-match "rsd@gnu.org" from) + (setq mml2015-signers '("B6AD4643"))))) + +(defun rsd/gnus/gpg-setup () + "Setup gpg." + (rsd/gnus/set-gpg-key + (rsd/gnus/get-msg-header "from"))) + +(add-hook 'message-setup-hook 'rsd/gnus/gpg-setup) ;; duh, add the vanity header. (require 'gnus-art)