lisp/my-mail.el
changeset 1 a234a7579958
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/my-mail.el	Thu Oct 13 08:46:42 2011 -0400
@@ -0,0 +1,81 @@
+(require 'browse-url)
+
+;;;_ Custom functions
+
+; Redefine browse-url-mail for ?subject=SUBJECT support.
+
+(defun browse-url-mail (url &optional new-window)
+  "Open a new mail message buffer within Emacs.
+Default to using the mailto: URL around or before point as the
+recipient's address.  Supplying a non-nil interactive prefix argument
+will cause the mail to be composed in another window rather than the
+current one.
+
+When called interactively, if variable `browse-url-new-window-flag' is
+non-nil use `compose-mail-other-window', othserwise `compose-mail'.  A
+non-nil interactive prefix argument reverses the effect of
+`browse-url-new-window-flag'.
+
+When called non-interactively, optional second argument NEW-WINDOW is
+used instead of `browse-url-new-window-flag'."
+  (interactive (browse-url-interactive-arg "Mailto URL: "))
+  (save-excursion
+    (let ((to (if (string-match "^mailto:" url)
+		  (substring url 7)
+		url))
+	  (subject nil))
+      (if (string-match "\\?subject=" to)
+	  (setq subject (substring to (match-end 0))
+		to (substring to 0 (match-beginning 0))))
+      (if (browse-url-maybe-new-window new-window)
+	  (compose-mail-other-window to subject nil nil
+				     (list 'insert-buffer (current-buffer)))
+	(compose-mail to subject nil nil nil
+		      (list 'insert-buffer (current-buffer)))))))
+
+;;;_ Wanderlust settings
+
+(autoload 'wl-user-agent-compose "wl-draft" nil t)
+(if (boundp 'mail-user-agent)
+    (setq mail-user-agent 'wl-user-agent))
+(if (fboundp 'define-mail-user-agent)
+    (define-mail-user-agent
+      'wl-user-agent
+      'wl-user-agent-compose
+      'wl-draft-send
+      'wl-draft-kill
+      'mail-send-hook))
+(setq wl-draft-init-config-alist
+      '((reply "^\\(To\\|CC\\): .*@alteranode.com" 
+	       ("From" . "Fabien Ninoles <fabien@alteranode.com>")) 
+	(reply "^\\(To\\|CC\\): .*fabien@flipr.com" 
+	       ("From" . "Fabien Ninoles <fabien@flipr.com>"))))
+(setq wl-draft-send-config-alist 
+      '(("^From: .*fabien\\(\\+.*\\)?@tzone.org"
+	 ("BCC" . "fabien+sentmail@tzone.org"))
+	("From: .*fabien\\(\\+.*\\)?@alteranode.com" 
+	 ("Organisation" . "Alteranode, inc.")
+	 ("BCC" . "fabien+sentmail@alteranode.com")) 
+	("From: .*fabien\\(\\+.*\\)?@flipr.com" 
+	 ("BCC" . "fabien+sentmail@alteranode.com"))))
+(add-hook 'wl-mail-setup-hook
+	  '(lambda ()
+	     (wl-draft-config-exec wl-draft-init-config-alist)
+	     (setq wl-draft-config-exec-flag t)))
+(add-hook 'wl-draft-send-hook
+	  '(lambda ()
+	     (setq wl-draft-config-exec-flag t)
+	     (wl-draft-config-exec wl-draft-send-config-alist)
+	     ))
+
+;;;_ BBDB configuration
+
+(require 'bbdb-wl)
+(bbdb-wl-setup)
+;; exceptional folders against auto collection
+(setq bbdb-wl-ignore-folder-regexp "^@")
+(setq signature-use-bbdb t)
+;; automatically add mailing list fields
+(setq bbdb-ignore-selected-messages-confirmation t)
+
+(provide 'my-mail)
\ No newline at end of file