.emacs.d / lisplets / activate-wanderlust.el

The fluss branch has multiple heads

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

;; First get the current wanderlust into the path
; add goto last change
; to the path
(setq load-path (cons "~/.emacs.d/libs/wanderlust/wl" load-path))
(require 'wl)

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

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

; Encryption via GnuPG

(require 'mailcrypt)
 (load-library "mailcrypt") ; provides "mc-setversion"
(mc-setversion "gpg")    ; for PGP 2.6 (default); also "5.0" and "gpg"

(autoload 'mc-install-write-mode "mailcrypt" nil t)
(autoload 'mc-install-read-mode "mailcrypt" nil t)
(add-hook 'mail-mode-hook 'mc-install-write-mode)

(add-hook 'wl-summary-mode-hook 'mc-install-read-mode)
(add-hook 'wl-mail-setup-hook 'mc-install-write-mode)

(setq mc-encrypt-for-me t)

(defun mc-wl-verify-signature ()

(defun mc-wl-decrypt-message ()
    (let ((inhibit-read-only t))

(eval-after-load "mailcrypt"
  '(setq mc-modes-alist
         ((wl-draft-mode (encrypt . mc-encrypt-message)
            (sign . mc-sign-message))
          (wl-summary-mode (decrypt . mc-wl-decrypt-message)
            (verify . mc-wl-verify-signature))))

; flowed text

 ;; Reading f=f
 (autoload 'fill-flowed "flow-fill")
 (add-hook 'mime-display-text/plain-hook
          (lambda ()
            (when (string= "flowed"
                           (cdr (assoc "format"
                                        (mime-entity-content-type entity)))))
; writing f=f
;(mime-edit-insert-tag "text" "plain" "; format=flowed")

; prevent WL from splitting large attachments into many messages
(setq mime-edit-split-message nil)

;;; Configure BBDB to manage Email addresses

(require 'bbdb-wl)

(setq bbdb-use-pop-up t ;; Allow pop-ups
      bbdb-pop-up-target-lines 2
      bbdb/mail-auto-create-p t ;; auto collection
      bbdb-wl-ignore-folder-regexp "^@" ;; folders without auto collection
      bbdb-north-american-phone-numbers-p nil
      bbdb-auto-notes-alist '(("X-ML-Name" (".*$" ML 0)))
      bbdb-dwim-net-address-allow-redundancy t

      ;; shows the name of bbdb in the summary

      ;; Not with wl-summary-showto-folder-regexp
      ;;wl-summary-from-function 'bbdb-wl-from-func
      ;; Use the default:
      wl-summary-from-function 'wl-summary-default-from

      ;; Using BBDB for pet names is OK
      wl-summary-get-petname-function 'bbdb-wl-get-petname

      ;; cope with big folders
      elmo-multi-divide-number 1000000

; bbdb complete with C-TAB: M-TAB. M-TAB is in use by many graphical
(add-hook 'wl-draft-mode-hook
               '(lambda ()
                  (define-key wl-draft-mode-map [?\C-\t] 'bbdb-complete-name)
                  (local-set-key (kbd "<C-tab>") 'bbdb-complete-name)

(defun wl-draft-clean-mail-address (address)
  (replace-regexp-in-string "," "" address))

(defun wl-draft-send-to-multiple-receivers (addresses)
  (loop for address in addresses do
          (wl-user-agent-insert-header "To" 
                                       (wl-draft-clean-mail-address address))
          (let ((wl-interactive-send nil))
          (sleep-for (random 10))

(defun wl-draft-send-to-multiple-receivers-from-buffer (&optional addresses-buffer-name)
  "Send a mail to multiple recipients - one recipient at a time"
  (interactive "BBuffer with one address per line")
  (let ((addresses nil))
    (with-current-buffer addresses-buffer-name
      (setq addresses (split-string (buffer-string) "\n")))
    (if (y-or-n-p (concat "Send this mail to " 
                          (mapconcat 'identity addresses ", ")))
        (wl-draft-send-to-multiple-receivers addresses))))

(require 'private-wanderlust)

(provide 'activate-wanderlust)