;;; Nhat Minh's Wanderlust configuration ;; This code is public domain. ;; This file is part of my Emacs configuration. Please see also my ;; main .emacs file. ;; -- Nhat Minh LĂȘ ;; Mailbox/server/auth. settings. (setq elmo-imap4-default-port my-imap-port) (setq elmo-passwd-alist-file-name "~/.wl-passwd") ;; The OpenSSL subprocess expects an expanded path and WL doesn't do ;; that for us. (setq ssl-certificate-directory (expand-file-name my-ssl-cert-dir)) ;; Use local special folders. (setq wl-draft-folder "+draft" wl-trash-folder "+trash") ;; XXX: Used in conjunction with my patched FLIM with CCL encodings ;; removed, let mimencode(1) handle all the encoding/decoding ;; stuff. Believe me, it's for your own good... (setq base64-internal-encoding-limit 0 base64-internal-decoding-limit 0 quoted-printable-internal-decoding-limit 0 quoted-printable-internal-encoding-limit 0) ;; Modern MUAs usually don't handle split messages properly. (setq mime-edit-split-message nil) ;; Make WL recognize outbound mails. (setq wl-user-mail-address-list my-mail-addresses) ;; Format for some default headers in replies. (setq wl-draft-reply-without-argument-list '(("Followup-To" ("Mail-Followup-To" "Mail-Reply-To" "Reply-To") nil ("Followup-To")) ("Mail-Followup-To" ("Mail-Followup-To") nil nil) ("Newsgroups" ("Mail-Reply-To" "Reply-To" "To") ("Cc") ("Newsgroups")) ("Mail-Reply-To" ("Mail-Reply-To" "Reply-To") ("Cc") nil) ("Reply-To" ("Reply-To") ("Cc") nil) (wl-draft-self-reply-p ("To") ("Cc") nil) ("From" ("From") ("Cc") nil))) ;; Interface settings. (setq wl-demo-display-logo t wl-folder-desktop-name "Mail" wl-folder-window-width 30 wl-icon-directory (concat my-dot-emacs-dir "/wl-icons") wl-stay-folder-window t wl-summary-line-format "%T%P%W %D.%M, %h:%m %22(%f%) %s" wl-summary-width nil wl-summary-showto-folder-regexp ".") ;; FIXME: Doesn't work(?). Should add `text-mode' settings ;; (e.g. word wrapping) to WL message viewing mode. (add-hook 'mime-view-mode-hook 'my-text-mode-init) ;; Make MIME understand HTML while preferring the text version if ;; one is provided. (require 'mime-w3m nil t) (setq mime-view-type-subtype-score-alist '(((text . plain) . 4) ((text . enriched) . 3) ((text . html) . 2) ((text . richtext) . 1))) ;; For some reason, `wl-draft-save' is not bound in `wl-draft-mode' ;; even though it should rightfully override the defaults. Also, fix ;; gratuitous overriding of `M-t'. (defun my-wl-draft-mode-init () (define-key wl-draft-mode-map (kbd "C-x C-s") 'wl-draft-save) (define-key wl-draft-mode-map (kbd "M-t") nil)) (add-hook 'wl-draft-mode-hook 'my-wl-draft-mode-init) ;; Add a nice highlighting of the current line in WL folder mode. (add-hook 'wl-folder-mode-hook (lambda () (hl-line-mode 1))) ;; Add some cosmetic to try to make the summary look better. (defun my-wl-summary-init () (hl-line-mode 1) (setq header-line-format (concat (propertize " " 'display '((space :align-to 0))) "*" (propertize " " 'display '((space :align-to 2))) "Date" (propertize " " 'display '((space :align-to 22))) "From" (propertize " " 'display '((space :align-to 48))) "Subject"))) (add-hook 'wl-summary-mode-hook 'my-wl-summary-init) ;;;; Biff ;; It does not seem like WL provides a function to list all the ;; folders it knows by name, so here's one. (defun my-wl-folder-name-list () "Return a list of all folder names." ;; XXX: It seems the first folder always has ID 1. ;; `wl-folder-get-next-folder' is broken in my version of WL: it ;; wouldn't accept folder names, so we have to rely on IDs. (let (folder-list (id 1) (entity (wl-folder-get-folder-name-by-id 1))) (setq folder-list (list entity)) (setq entity (wl-folder-get-next-folder id)) (while entity (setq id (wl-folder-get-entity-id entity)) (setq folder-list (cons entity folder-list)) (setq entity (wl-folder-get-next-folder id))) folder-list)) ;; XXX: The doc is wrong, `wl-biff-check-folder-list' cannot hold ;; regexps meaningfully. We have to list all our folders. However, ;; this can only be done once WL is started, so we leave it to the ;; main .emacs. (defun my-mail-notify () "Notify through Ratpoison that new mail has arrived." (ratpoison-command "echo New mail")) (defun my-wl-biff () "Set up biff on all WL folders." (setq wl-biff-check-folder-list (my-wl-folder-name-list) wl-biff-check-interval 600) (add-hook 'wl-biff-notify-hook 'my-mail-notify) (wl-biff-start)) ;; My IMAP server (Dovecot) interprets the call to ;; `elmo-folder-exists-p' as a client query that should unmark new ;; mails and leave them as simply Unread (instead of Recent). (defun my-elmo-folder-exists-p (folder) t) (defadvice wl-biff-check-folders (around my-disable-exists-test activate) "Disable `elmo-folder-exists-p' and make it return t." (let ((real-elmo-folder-exists-p (symbol-function 'elmo-folder-exists-p))) (fset 'elmo-folder-exists-p (symbol-function 'my-elmo-folder-exists-p)) ad-do-it (fset 'elmo-folder-exists-p real-elmo-folder-exists-p)))