Last edit
Summary: xref back to main page, plus category tag
Added:
> == See Also ==
> WanderLust
> ----
> CategoryMail
Please also read the FAQ at the home page.
Check your distributions package repository for package named “wl” or “wl-beta”. Alternatively install it through el-get (an emacs package repository), which will give you the latest version.
In the folder manager, close the access group, then use C-u <RET> to open it again. Wanderlust will scan the access group for new folders.
In your .wl:
;; Use ~/.mailrc (setq wl-address-init-function 'my-wl-address-init) (defun my-wl-address-init () (wl-local-address-init) (setq wl-address-completion-list (append wl-address-completion-list (build-mail-aliases))))
First:
(setq wl-summary-incorporate-marks '("N" "U" "!" "A" "F" "$"))
Now, from the Folder buffer, use the command wl-folder-prefetch-current-entity (bound to I) on any entity that you wish to prefetch all messages of.
Even when using IMAP, wl caches the messages (by default it caches the message being read, and the following one), and stores them in elmo-cache-directory i.e. ~/.elmo. This cache can get quite large. Especially if you tend to run online most of the time, you may want to purge it periodically, which can be done by either doing “M-x elmo-cache-expire-by-size” or putting something similar in .wl:
;;days since last access, i.e atime. (default: 50) (elmo-cache-expire-by-age 14) ;;kilobytes (default 30000) (elmo-cache-expire-by-size 1024)
Integration with offlineimap is simple and easy since wanderlust understands the MailDir format. Storing emails locally improves the speed of reading messages significantly even compared to using Wanderlusts native facility for caching messages. You can run offlineimap from emacs by using offlineimap.el.
Using the MailDir format also has the advantage of being able to use native text-based search for all messages. By default wanderlust is designed to use Namazu, but you can easily replace it with mu search. Once you have mu setup you can integrate it into wanderlust with the following in either your init.el or .wl :
(elmo-search-register-engine 'mu 'local-file :prog "mu" :args '("find" pattern "-o" "plain" "-f" "l") :charset 'utf-8) (setq elmo-search-default-engine 'mu)
If you configured Wanderlust to use a ‘smarthost’ then, instead, configure a MTA (e.g., exim4) to talk to the smarthost. Then configure Wanderlust to use the local MTA: in your .wl file, set wl-smtp-posting-server to nil and wl-local-domain to gmail.com (or whatever domain name is appropriate given the MTA configuration…).
If you only use Wanderlust to access a mailbox, you can set wl-summary-auto-sync-marks to nil in your .wl file.
Create a filter folder,
/since:yesterday/%INBOX
Release 2.14 was created before emacs23 was released. As a consequence, there may occur some problems with unicode support. They can be fixed by using a snapshot from the CVS repository. For a working variant, please see [1] .
There is no ‘wl-attach-file’.
Try M-x mime-edit-insert-file RET and answer some questions (file name, content type and subtype and transfer encoding). Encoding base64 seems to work. Then don’t touch the text that is added to your message. When you send the mail, the file will be included.
If you find a simpler, sane version (e.g. choose just a file and then you’re sure it will work) please describe it here.
No need to M-x: mime-edit-insert-file is bound to C-c C-x TAB. At least for me the three prompts for MIME media type, subtype and encoding normally are just fine (RET RET RET). If this is not the case try to customize ‘mime-file-types’.
~~dmaus
Add the following to your .wl file:
(setq mime-edit-split-message nil)
This code will allow you to include multiple files, like “~/images*.png” or similar:
;;Cobbled together from posts by Erik Hetzner & Harald Judt to ;; wl-en@lists.airs.net by Jonathan Groll (msg 4128) (defun mime-edit-insert-multiple-files () "Insert MIME parts from multiple files." (interactive) (let ((dir default-directory)) (let ((next-file (expand-file-name (read-file-name "Insert file as MIME message: " dir)))) (setq file-list (file-expand-wildcards next-file)) (while (car file-list) (mime-edit-insert-file (car file-list)) (setq file-list (cdr file-list)))))) (global-set-key "\C-c\C-x\C-a" 'mime-edit-insert-multiple-files)
TODO probably don’t want this as a global key-binding.
Maybe another useful tip for somebody… I added this to my .emacs:
(add-hook 'mime-view-mode-hook '(lambda () "Disable 'v' for mime-play." ;; Key bindings (local-set-key [?v] () ) ))
Because ‘v’, in the summary window, hides the message-reading window, but if you hit ‘v’ without realizing that the cursor is in the message window, wl launches an external process which (on my machine) never produces any output and never terminates. If I get an attachment, I only want to extract it anyway by ‘e’ so it’s no loss to me.
James
Press the ‘s’ key (wl-summary-sync), then it asks you the update method (allowed: no-sync first last cache-status mark rescan rescan-noscore rescan-thread update update-entirely all all-entirely). Having that many choices has always baffled me. I tend to use all and it works as you would expect in any other mail program.
I expected to find a simpler method, which is safe, fast and can be invoked with one key. What would you use?
Provided you sent folder has the word “Sent” somewhere use:
(setq wl-summary-showto-folder-regexp ".*Sent.*)
And also add your email-addresses to wl-user-mail-address-list.
;; You should set this variable if you use multiple e-mail addresses. (setq wl-user-mail-address-list '("my.name@gmail.com" "myname@gmail.com" "myname@company.com"))
Ty adding something like the following to your .wl (note: not sure it works):
(defun wl-summary-overview-entity-compare-by-rdate (x y) (not (wl-summary-overview-entity-compare-by-date x y))) (add-to-list 'wl-summary-sort-specs 'rdate) ;; Or the infinitesimally more efficient: ;; (wl-summary-overview-entity-compare-by-size y x) ;;http://osdir.com/ml/mail.wanderlust.general/2004-06/msg00052.html ;;You could define yourself a sort helper function: (defun wl-summary-sort-by-rdate () (interactive) (wl-summary-rescan "rdate") (goto-char (point-min))) ;;and bind that to a key, or (kludgier) define an after advice for ;;wl-summary-rescan that moves the cursor if the sort argument begins ;;with "r". I haven't tested this, but it would go something like: (defadvice wl-summary-rescan (after wl-summary-rescan-move-cursor activate) (if (string-match "^r" (ad-get-arg 0)) (goto-char (point-min))))
This has been reported for when getting email with offlineimap, they can appear unsorted in the summary buffer, if so this will help:
;; sort the summary (defun my-wl-summary-sort-hook () (wl-summary-rescan "date")) (add-hook 'wl-summary-prepared-hook 'my-wl-summary-sort-hook)
When marking a message in the summary buffer for deletion the default behavior is to move in the last direction, that being “n” or “p”. To disable this, and have it always move to next “n”, put:
;;don't remember "n"/"p" direction when flagging messages:
(setq wl-summary-move-direction-toggle nil)
Add this to your .wl (or .emacs):
(require 'w3m) (require 'mime-w3m)
You should also have w3m installed and the mime-w3m.el in your load path.
If you are not used to w3m key-bindings, and don’t intend on using it on its own put this in your configuration file:
(eval-after-load "w3m" '(progn (define-key w3m-mode-map [left] 'backward-char) (define-key w3m-mode-map [right] 'forward-char) (define-key w3m-mode-map [up] 'previous-line) (define-key w3m-mode-map [down] 'next-line) (define-key w3m-minor-mode-map [left] 'backward-char) (define-key w3m-minor-mode-map [right] 'forward-char) (define-key w3m-minor-mode-map [up] 'previous-line) (define-key w3m-minor-mode-map [down] 'next-line) ))
In default settings, mime-w3m shows only images embedded in a message. Please check URLs of images and the value of mime-w3m-safe-url-regexp.
If you have to or it is appropriate: Yes, code below does the trick of converting the message body into html before sending. It requires [2] to be installed because the conversion is done by Org mode’s html export function.
Org is shipped with Emacs since 22.1 (iirc); you might also profit of the minor modes orgstruc-mode, orgstruc++-mode and orgtbl-mode for editing messages even if you don’t want to send html messages: these minor modes give the power of Org’s outlining features (headlines, bullet lists) and the table editor. For information on these minor modes see here and here.
Back to sending html messages: Putting code below in your startup file adds following four functions:
- dmj/wl-send-html-message
Function that does the job: Convert everything between "--text follows this line--" and first mime entity (read: attachment) or end of buffer into html markup using `org-export-region-as-html' and replaces original body with a multipart MIME entity with the plain text version of body and the html markup version. Thus a recipient that prefers html messages can see the html markup, recipients that prefer or depend on plain text can see the plain text.
Line breaks in the signature are preserved.
Cannot be called interactively: It is hooked into SEMI's
`mime-edit-translate-hook' if message should be html message.- dmj/wl-send-html-message-draft-init
Cannot be called interactively: It is hooked into WL's
`wl-mail-setup-hook' and `wl-draft-reedit-hook' and provides a
buffer local variable to toggle.- dmj/wl-send-html-message-draft-maybe
Cannot be called interactively: It is hooked into WL's
`wl-draft-send-hook' and hooks `dmj/wl-send-html-message' into
`mime-edit-translate-hook' depending on whether html message is
toggled on or off- dmj/wl-send-html-message-toggle
Toggles sending of html message. If toggled on, the letters
"HTML" appear in the mode line. Call it interactively! Or bind it to a key in `wl-draft-mode'.Everything besides a keybinding of ‘dmj/wl-send-html-message-toggle’ is done upon loading the code. If you have to send html messages regularily you can set a global variable ‘dmj/wl-send-html-message-toggled-p’ to the string “HTML” to enable html messages by default.
(defun dmj/wl-send-html-message () "Send message as html message. Convert body of message to html using `org-export-region-as-html'." (require 'org) (save-excursion (let (beg end html text) (goto-char (point-min)) (re-search-forward "^--text follows this line--$") ;; move to beginning of next line (beginning-of-line 2) (setq beg (point)) (if (not (re-search-forward "^--\\[\\[" nil t)) (setq end (point-max)) ;; line up (end-of-line 0) (setq end (point))) ;; grab body (setq text (buffer-substring-no-properties beg end)) ;; convert to html (with-temp-buffer (org-mode) (insert text) ;; handle signature (when (re-search-backward "^-- \n" nil t) ;; preserve link breaks in signature (insert "\n#+BEGIN_VERSE\n") (goto-char (point-max)) (insert "\n#+END_VERSE\n") ;; grab html (setq html (org-export-region-as-html (point-min) (point-max) t 'string)))) (delete-region beg end) (insert (concat "--" "<<alternative>>-{\n" "--" "[[text/plain]]\n" text "--" "[[text/html]]\n" html "--" "}-<<alternative>>\n"))))) (defun dmj/wl-send-html-message-toggle () "Toggle sending of html message." (interactive) (setq dmj/wl-send-html-message-toggled-p (if dmj/wl-send-html-message-toggled-p nil "HTML")) (message "Sending html message toggled %s" (if dmj/wl-send-html-message-toggled-p "on" "off"))) (defun dmj/wl-send-html-message-draft-init () "Create buffer local settings for maybe sending html message." (unless (boundp 'dmj/wl-send-html-message-toggled-p) (setq dmj/wl-send-html-message-toggled-p nil)) (make-variable-buffer-local 'dmj/wl-send-html-message-toggled-p) (add-to-list 'global-mode-string '(:eval (if (eq major-mode 'wl-draft-mode) dmj/wl-send-html-message-toggled-p)))) (defun dmj/wl-send-html-message-maybe () "Maybe send this message as html message. If buffer local variable `dmj/wl-send-html-message-toggled-p' is non-nil, add `dmj/wl-send-html-message' to `mime-edit-translate-hook'." (if dmj/wl-send-html-message-toggled-p (add-hook 'mime-edit-translate-hook 'dmj/wl-send-html-message) (remove-hook 'mime-edit-translate-hook 'dmj/wl-send-html-message))) (add-hook 'wl-draft-reedit-hook dmj/wl-send-html-message-draft-init) (add-hook 'wl-mail-setup-hook 'dmj/wl-send-html-message-draft-init) (add-hook 'wl-draft-send-hook 'dmj/wl-send-html-message-maybe)
The headers wl displays when viewing and editing a message are controlled by two variables: ‘wl-message-ignored-field-list’ and ‘wl-message-visible-field-list’. Both are lists whose elements are regular expressions that are used to determine which headers are displayed and which are not.
If you for instance only want a basic set of headers like From:, To:, Cc:, Subject: and Date: to be displayed you could set these variables as followed:
;; ignore all fields (setq wl-message-ignored-field-list '("^.*:")) ;; ..but these five (setq wl-message-visible-field-list '("^To:" "^Cc:" "^From:" "^Subject:" "^Date:"))
In addition you can control the order of these headers using the variable ‘wl-message-sort-field-list’:
(setq wl-message-sort-field-list '("^From:" "^Subject:" "^Date:" "^To:" "^Cc:"))
Finally, you can toggle to full header view with “H” key. Do note, that if you have mime-buttons turned off, you probably want to include "^Content-Disposition:" in the above lists, so that you can see if there’s an attachment in the message.
If two unrelated emails share the same subject, wl might/will group them together as being part of the same thread, to disable this set wl-summary-search-parent-by-subject-regexp to nil.
Default behavior is to give the path when completing a folder. Set (setq wl-use-folder-petname '(modeline read-folder)), to have it autocomplete also on folder petname when doing refiling, for instance.
It might be that you’ve hit the default limit of messages in a multifolder that WL will handle properly. The current limit is 100000 Messages – you might have to adjust this limit by setting the variable ‘elmo-multi-divide-number’ to an appropriate value.
(setq elmo-multi-divide-number 1000000)
The problem seems to be that elmo doesn’t realize that the connection its IMAP or other connection has timed out on the other side, and so keeps trying it. You can work around it if you use emacs-server by issuing an emacsclient command approximately like this before hibernation:
/usr/bin/emacsclient --socket-name /tmp/emacs1000/server --eval "(wl-toggle-plugged 'off)"
and then toggle back on after resume.
Since hibernation/suspend-to-ram sometiems happen in ways you can’t control – e.g., if you leave your laptop on somewhere and run out of battery power – it’s best to havethis doen automatically.
If you use the hibernate script for hibernation/suspend, you can add a scriptlet /etc/hibernate/scriptlets.d/wanderlust that will do this for you automatically; here’s a very simple example:
AddConfigHandler WanderlustOptions
WanderlustSuspend() {
/usr/bin/emacsclient --socket-name /tmp/emacs1000/server --eval "(wl-toggle-plugged 'off)"
}
WanderlustResume() {
/usr/bin/emacsclient --socket-name /tmp/emacs1000/server --eval "(wl-toggle-plugged 'on)"
}
WanderlustOptions() {
case $1 in
*)
return 1
esac
if [ -z "$WANDERLUST_HOOKED" ] ; then
AddSuspendHook 01 WanderlustSuspend
AddResumeHook 01 WanderlustResume
WANDERLUST_HOOKED=1
fi
return 0
}
A better way to do this would be to check each running emacsserver instance. In any case I found this didn’t always solve the problem, possibly because plugging back in after resume may occur before your new internet connection has been negotiated, which would give you the same issue.
I now use pm-utils instead, and have this in /etc/pm/sleep.d/09_wl_fix:
. "${PM_FUNCTIONS}" suspend_wl() { # Get WL to go offline /usr/bin/emacsclient --socket-name /tmp/emacs1000/server --eval "(wl-toggle-plugged 'off)" } resume_wl() { # Wake up NetworkManager and make it do a new connection echo "waking up -- wl is plugged off" } case "$1" in hibernate|suspend) suspend_wl ;; thaw|resume) resume_wl ;; *) exit $NA ;; esac
for now it’s doing the trick!
By default BBDB checks for possible mismatches of a message’s author name and the corresponding BBDB entry. To disable this feature you have to remove the responsible function form WL’s message redisplay hook:
(remove-hook 'wl-message-redisplay-hook 'bbdb-wl-get-update-record)
Simply tell SEMI to accept encoded sequences in header fields.
(setq mime-header-accept-quoted-encoded-words t)
Try setting this: (setq elmo-network-session-idle-timeout 300)
Wanderlust automatically saves the draft every second there’s a change. If your draft folder is an IMAP, this gets tiresome fast.
;;Only save draft when I tell it to (C-x C-s or C-c C-s):
(setq wl-auto-save-drafts-interval nil)
For English mail list, send an email to wl-en-ctl@ml.gentei.org with “unsubscribe” in body.
Patches, modifications, or suggestions can be sent to the mail list. To learn Luna, the tiny OOP core that powers WL, reading Peter Seibel’s “Practical Common Lisp”, Chapter 16 and 17 is highly recommended link. This book is worth reading not just for understanding WL.
The mime buttons is what shows up in the beginning and end of your messages as [1 <text/plain; iso-8859-1 (quoted-printable)>]. You can toggle on/off with C-c m (in summary buffer), or set (setq mime-view-buttons-visible nil)
Basically, Wanderlust’s mime-encoding does not play nice with Emacs 23. A workaround is to outsource the mime-encoding; add the following to your Wanderlust init file:
(setq mel-b-ccl-module nil) (setq mel-q-ccl-module nil) (setq base64-external-encoder '("mimencode")) (setq base64-external-decoder '("mimencode" "-u")) (setq base64-external-decoder-option-to-specify-file '("-o")) (setq quoted-printable-external-encoder '("mimencode" "-q")) (setq quoted-printable-external-decoder '("mimencode" "-q" "-u")) (setq quoted-printable-external-decoder-option-to-specify-file '("-o")) (setq base64-internal-decoding-limit 0) (setq base64-internal-encoding-limit 0) (setq quoted-printable-internal-decoding-limit 0) (setq quoted-printable-internal-encoding-limit 0) (setq-default mime-transfer-level 8) (setq mime-header-accept-quoted-encoded-words t)