28 April, 2010


My Wanderlust setup

Wanderlust is a pain to set up, but the flexibility you get is worth it. I've been using it for a month now and (thanks to various posts and trawling through the cutomisation groups for wl, bbdb, mu-cite) this is what my wanderlust setup has grown to:

;; mode:-*-emacs-lisp-*-
;; wanderlust

(setq wl-summary-always-sticky-folder-list t)
(setq wl-summary-line-format "%n%T%P %D/%M (%W) %h:%m %t%[%25(%c %f%) %] %s")
(setq wl-summary-width 150)
(setq wl-user-mail-address-list (quote ("j.shuttleworth@coventry.ac.uk" "csx239@coventry.ac.uk")))

(setq bbdb-use-pop-up nil)

;;Initial Wanderlust setup
;; autoload configuration
(autoload 'wl "wl" "Wanderlust" t)
(autoload 'wl-other-frame "wl" "Wanderlust on new frame." t)
(autoload 'wl-draft "wl-draft" "Write draft with Wanderlust." t)

;; If we wanted to we can set the init file to be something different
;; (setq wl-init-file "~/.emacs.d/wl.el")

;; This should allow us to compose mail using C-x m
(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)

;; BBDB for harvesting Email addresses.
;; THe rest in in my WL file
(add-to-list 'load-path "/usr/share/emacs23/site-lisp/bbdb/")
(setq bbdb-file "~/Documents/portables/bbdb") ;; keep ~/ clean; set before loading
(require 'bbdb)

bbdb-offer-save 1 ;; 1 means save-without-asking

bbdb-use-pop-up t ;; allow popups for addresses
bbdb-electric-p t ;; be disposable with SPC
bbdb-popup-target-lines 1 ;; very small

bbdb-dwim-net-address-allow-redundancy t ;; always use full name
bbdb-quiet-about-name-mismatches 2 ;; show name-mismatches 2 secs

bbdb-always-add-address t ;; add new addresses to existing...
;; ...contacts automatically
bbdb-canonicalize-redundant-nets-p t ;; x@foo.bar.cx => x@bar.cx

bbdb-completion-type nil ;; complete on anything

bbdb-complete-name-allow-cycling t ;; cycle through matches
;; this only works partially

bbbd-message-caching-enabled t ;; be fast
bbdb-use-alternate-names t ;; use AKA

bbdb-elided-display t ;; single-line addresses

;; auto-create addresses from mail
bbdb/mail-auto-create-p 'bbdb-ignore-some-messages-hook
;; bbdb-ignore-some-messages-alist ;; don't ask about fake addresses
;; NOTE: there can be only one entry per header (such as To, From)
;; http://flex.ee.uec.ac.jp/texi/bbdb/bbdb_11.html

;; '(( "From" . "no.?reply\\|DAEMON\\|daemon\\|facebookmail\\|twitter")))


(add-to-list 'load-path "/usr/share/emacs23/site-lisp/mu-cite/")
(require 'mu-cite)
(add-hook 'mail-citation-hook 'mu-cite-original)
(setq mu-cite-top-format
'("On " date "," full-name " spake thus:\n"))

(setq signature-file-name "~/.signature"
signature-insert-at-eof t
signature-delete-blank-lines-at-eof t
mu-cite-prefix-format (quote ("> ")) ; default to >, no questions asked, rather than name

'(lambda ()
;; Add support for (signature . "filename")
(unless (assq 'signature wl-draft-config-sub-func-alist)
(wl-append wl-draft-config-sub-func-alist
'((signature . wl-draft-config-sub-signature))))

(defun mime-edit-insert-signature (&optional arg)
"Redefine to insert a signature file directly, not as a tag."
(interactive "P")
(insert-signature arg))

;; Keep track of recently used Email addresses
;;(recent-addresses-mode 1)

(defun wl-draft-config-sub-signature (content)
"Insert the signature at the end of the MIME message."
(let ((signature-insert-at-eof nil)
(signature-file-name content))
(goto-char (mime-edit-content-end))

elmo-maildir-folder-path "~/Maildir" ;; where i store my mail

wl-stay-folder-window t ;; show the folder pane (left)
wl-folder-window-width 25 ;; toggle on/off with 'i'

wl-smtp-posting-server "mail.coventry.ac.uk" ;; put the smtp server here

;The initial setting is nil. This is the SMTP server name for mail transmission.
;The initial setting is nil. This is the SMTP port number for mail transmission. If nil, default SMTP port number (25) is used.
wl-smtp-posting-user "csx239"
;The initial setting is nil. This is the user name for SMTP AUTH authentication.
wl-smtp-authenticate-type "login"
;The initial setting is nil. This string-valued variable specifies the authentication method for SMTP AUTH authentication. You may specify plain, cram-md5, digest-md5, login, etc. If nil, authentication will not be carried out.

wl-local-domain "ng43-1.coventry.ac.uk" ;; put something here...
wl-message-id-domain "coventry.ac.uk" ;; ...

wl-from "James Shuttleworth " ;; my From:

;; note: all below are dirs (Maildirs) under elmo-maildir-folder-path
;; the '.'-prefix is for marking them as maildirs
wl-fcc ".sent" ;; sent msgs go to the "sent"-folder
wl-fcc-force-as-read t ;; mark sent messages as read
wl-default-folder ".inbox" ;; my main inbox
wl-draft-folder ".drafts" ;; store drafts in 'postponed'
wl-trash-folder ".trash" ;; put trash in 'trash'
wl-spam-folder ".trash" ;; ...spam as well
wl-queue-folder ".queue" ;; we don't use this

;; check this folder periodically, and update modeline
wl-biff-check-folder-list '(".todo") ;; check every 180 seconds
;; (default: wl-biff-check-interval)

;; hide many fields from message buffers
wl-message-ignored-field-list '("^.*:")



;;Get BBDB workiing
(require 'bbdb-wl)
(define-key wl-draft-mode-map (kbd "") 'bbdb-complete-name)

wl-forward-subject-prefix "Fwd: " ) ;; use "Fwd: " not "Forward: "

;; Invert behaviour of with and without argument replies.
;; just the author
(setq wl-draft-reply-without-argument-list
'(("Reply-To" ("Reply-To") nil nil)
("Mail-Reply-To" ("Mail-Reply-To") nil nil)
("From" ("From") nil nil)))

;; bombard the world
(setq wl-draft-reply-with-argument-list
'(("Followup-To" nil nil ("Followup-To"))
("Mail-Followup-To" ("Mail-Followup-To") nil ("Newsgroups"))
("Reply-To" ("Reply-To") ("To" "Cc" "From") ("Newsgroups"))
("From" ("From") ("To" "Cc") ("Newsgroups"))))

(defun djcb-wl-draft-subject-check ()
"check whether the message has a subject before sending"
(if (and (< (length (std11-field-body "Subject")) 1)
(null (y-or-n-p "No subject! Send current draft?")))
(error "Abort.")))

;; note, this check could cause some false positives; anyway, better
;; safe than sorry...
(defun djcb-wl-draft-attachment-check ()
"if attachment is mention but none included, warn the the user"
(goto-char 0)
(unless ;; don't we have an attachment?

(re-search-forward "^Content-Disposition: attachment" nil t)
(when ;; no attachment; did we mention an attachment?
(re-search-forward "attach" nil t)
(unless (y-or-n-p "Possibly missing an attachment. Send current draft?")
(error "Abort."))))))

(add-hook 'wl-mail-send-pre-hook 'djcb-wl-draft-subject-check)
(add-hook 'wl-mail-send-pre-hook 'djcb-wl-draft-attachment-check)

;; don't ****ing split large messages
(setq mime-edit-split-message nil)

;For printing on black and white printer...
(setq wl-ps-print-buffer-function 'ps-print-buffer)

;Auto add signature on draft edit
(remove-hook 'wl-draft-send-hook 'wl-draft-config-exec)
(add-hook 'wl-mail-setup-hook 'wl-draft-config-exec)
(setq wl-draft-config-alist
'(((string-match "1" "1")
(bottom . "\n--\n") (bottom-file . "~/.signature"))

;; Wanderlust compose becomes bound to C-x m
(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)

;; Fetchmail bount to C-x M-m

(defun fetchmail-fetch ()
(shell-command "fetchmail")
(global-set-key "\C-x\M-m" 'fetchmail-fetch)

;Stop mime errors when sending to AOL/others?
; osdir.com/ml/mail.wanderlust.general/2006-10/msg00007.html
;(setq-default mime-transfer-level 8)
(setq smtp-use-8bitmime nil)

;Swap a and A in summary mode, so citing original message is on a and no-cite on A.
;I want the most common action (for me) to be the one with fewer keypresses
(define-key wl-summary-mode-map (kbd "A") 'wl-summary-reply)
(define-key wl-summary-mode-map (kbd "a") 'wl-summary-reply-with-citation)

Very nice. Thanks.
Good guide!
Thank you for your file!

I can now compose mail from bbdb via wanderlust by just hitting m.

Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?

Social bookmarks


Bookmark this on Delicious


Support The Commons

This site:

Free your code: