[notmuch] [PATCH] Change From and Bcc when creating reply draft buffer

James Vasile james at hackervisions.org
Thu Mar 11 11:45:03 PST 2010


On Thu, 11 Mar 2010 17:22:41 +0100, Michal Sojka <sojkam1 at fel.cvut.cz> wrote:
> thanks for clarification. It all sounds reasonable. The only problem I
> can see now is that if I create a new account on my machine and run
> emacs there, then the value of user-mail-address is <login>@<hostname>
> which doesn't refer to existing mailbox. I think that the header should
> only be rewritten if these variables are known to have valid values. Do
> you know how to do this?
> 

I explicitly set these in my .emacs file, so I don't do any detection.
If you could define "valid" I suppose you could test for such things.

Something like the following works for me.  I run mail-profile-foo with
M-x or run it automatically with profile-guessing/setting routines.
When I get the system ironed out, I'll emit patches and a wiki entry.

(defun message-mode-set-profile ()
  (save-excursion
    (when (string= "message-mode" major-mode)
      (goto-char (point-min))
      (when (re-search-forward "^From: " nil t)
	(kill-line)
	(insert (format "%s <%s>" user-full-name user-mail-address)))

      (goto-char (point-min))
      (when (re-search-forward "^Bcc: " nil t)
	(kill-line)
	(insert (format "%s <%s>" user-full-name user-mail-address))))))

(defun mail-profile-hv ()
  (interactive)
  (setq mail-host-address "hackervisions.org"
      user-full-name "James Vasile"
      message-sendmail-extra-arguments '("-a" "hv")
      user-mail-address "james at hackervisions.org")
  (message-mode-set-profile)
  user-mail-address)
(mail-profile-hv)

<other mail-profile-foo functions>


More information about the notmuch mailing list