searching e-mails with wanderlust and mu






I have discussed the Wanderlust e-mail client a couple of times already. I'm
still using it, so I keep on learning new tricks. Even though there has been
quite a bit of action in the competing gnus e-mail client, for my particular
use-case, Wanderlust is still the best option.



'My particular use-case' consists of storing my mail in Maildirs, which I fill
with either offlineimap (which has fortunately found a new maintainer) or
fetchmail.






mu






When dealing with e-mail, one particularly important feature for me is the
ability to search my messages. In fact, it's so important for me that I
wrote some software to do this for me; the software is called mu; it indexes
the messages in my Maildirs, and then allows for searching them using
queries, based on message contents, headers, or other message properties.



mu works through a command-line interface, although there is an
experimental GUI available as well. The command-line interface makes it
possible to hook mu up with various mail-clients, such as mutt, or
Wanderlust. Some Linux distributions ship mu, but since the versions they
ship are often a bit outdated, I recommend building it yourself from the
sources linked on the mu website. The process is fairly straightforward;
and there is plenty of documentation in the form of man pages.







mu and wanderlust






I've been combining mu and wanderlust for a while (see mu and wanderlust - the old way, below), but this week Sam B. on the mu mailing
list showed a way to do so in a much more elegant way - using virtual or
query folders.



How does this work? Well, after installing mu, add the following to your
Wanderlust setup file (~/.wl or it's moral equivalent – see the older
Wanderlust posts for the details):





(require 'elmo-search)
(elmo-search-register-engine
'mu 'local-file
:prog "/usr/local/bin/mu" ;; or wherever you've installed it
:args '("find" pattern "--fields" "l") :charset 'utf-8)

(setq elmo-search-default-engine 'mu)
;; for when you type "g" in folder or summary.
(setq wl-default-spec "[")






So, to start with the last part, whenever you type g in folder or summary,
in the mode-line you will get something like Folder name (.inbox): [. Now
simply type your mu search expression and press Enter, and wanderlust
opens a (temporary) folder with the search results. Brilliant!



Next, to add virtual folders for searches you do often, simply add some
folder specifications like the following to your .folders file (again,
check the older Wanderlust posts if you're not familiar with folders-file):





VFolders {
# message I received today
[date:today..now]!mu "Today"

# messages bigger than 1Mb
[size:1m..100m]!mu "Big"

# signed messages i got in 2010 related to emacs
[date:2010..2011 flag:signed emacs]!mu "Signed-Emacs2010"

# unread messages
[not flag:seen]!mu "Unread"
# or (for mu >= 0.9.4):
# [flag:unread]! mu "Unread"
}





After this, restart Wanderlust, and there you go! Wanderlust will display
your brand new virtual folders with an icon that looks like a little whale.



You can put arbitrary mu search expressions between the [], matching
whatever is useful in a certain case. Check the mu documentation to see how
to do this.



Note, the messages you get in these virtual folders are links to the
original messages. In practice, this means that changes you make to the links
do no affect the originals – if you delete a link you're not deleting the
message.







mu and wanderlust - the old way






This discussion would not complete without a description of the old way I
used search. This method may still be useful for integrating mu with other
clients such as mutt.



What I've been using for a while is a (in retrospect) rather clumsy way to
integrate message searches with Wanderlust: based on the results of a query,
I would create some special Maildir and fill it with symbolic links to the
matched messages, and the visit this special Maildir with Wanderlust. I'll
include the code here to contrast it with the more elegant solution that we
saw before, but also because the approach taken might be easily adapted for
other mail-clients.





;; search using mutt
(defvar mu-wl-mu-program "/usr/local/bin/mu")
(defvar mu-wl-search-folder "search")

(defun mu-wl-search ()
"search for messages with `mu', and jump to the results"
(let* ((muexpr (read-string "Find messages matching: "))
(sfldr (concat elmo-maildir-folder-path "/"
mu-wl-search-folder))
(cmdline (concat mu-wl-mu-program " find "
"--clearlinks --format=links --linksdir='" sfldr "' "
muexpr))
(rv (shell-command cmdline)))
(cond
((= rv 0) (message "Query succeeded"))
((= rv 2) (message "No matches found"))
(t (message "Error running query")))
(= rv 0)))

(defun mu-wl-search-and-goto ()
"search and jump to the folder with the results"
(interactive)
(when (mu-wl-search)
(wl-summary-goto-folder-subr
(concat "." mu-wl-search-folder)
'force-update nil nil t)
(wl-summary-sort-by-date)))

;; search by pressing 'Q'
(define-key wl-summary-mode-map (kbd "Q") ;; => query
'(lambda()(interactive)(mu-wl-search-and-goto)))
(define-key wl-folder-mode-map (kbd "Q") ;; => query
'(lambda()(interactive)(mu-wl-search-and-goto)))





After installing mu and putting the above in your wanderlust startup
file, you should be able to search by pressing Q. The mu documentation
has an example for mutt as well.







conclusion






It's straightforward to integrate advanced searching capabilities to
Wanderlust using mu, and thanks to Sam B., it's gotten a lot easier! The
second (old) approach may be useful as 'inspiration' for use in other e-mail
clients as well, if they do not provide the kind of hooks that the first
solution needs.







U-kiss New alBum..

haha..finally..U-kiss make a comeback-stage with their song, 0330, along with their new members Hoon and AJ (which I really don't like) but I can't do anything(because I'm not their boss)..and kevin's part is........... really just a little, the cutie-pie Dong-ho raps..ahah~and those 2 new members....well, their "so-so" to me though.. still can't beat Xander and Ki-bum of course..they're the coolest...!

i'll miss these guys..they're superb..cannot be replaced.,
he knows 7 languages..that's what i like about him...he's genius..I envy him..




uhuh..my darling----luv ya..lol~

their MV is okay though..it's a ballad song..really different from their songs before..but I'm hoping they could do well in selling their albums..
and to be honest, the MV is kinda freak..ahah....Dong Ho is hallucinating.. and he seems to look like a maniac..creepy..but a good actor indeed..nice!and my darling kevin totally looks HANDSOME there.. lol~
frankly..it's kinda weird hearing those boys sang a ballad song..I miss they wild, catchy songs which  makes me wanna dance all day long though..whatever it is..they're still the best..Daebak!

what the...........


WHAT THE HELL IS GOING ON HERE..???STOP THIS FUCKIN ANNOYING THINGS..!IT'S HURTING ME AND IT MAKES ME SICK...FEELS LIKE REALLY WANT TO THROW OUT RIGHT NOW!

okay. now I'm depressed because of HIM..he is my beloved fuckin uncle..LMFAO~
we're in the same age , but since he was my grandpa's lil bro, so he's considered as my uncle..
last year, he cant take the big exam for entering good university because of some family problem...so I took it earlier before him and i got some super fucking shit result..LOL..I'm swearing to myself because I didn't study it well,,,so,I kinda regret getting that super mega extremely worst result..but at least,at the end I can enter a dental college so, I considered myself as lucky.. .
so, my darling  uncle took the exam this year..and he's even worser than me,,that i've never seen him study for my whole entire life,and it's just like some dumbass miracle, that his result comes in super fuckin flying colours,,,and this just not so fair.. i got so depressed by it..how come such a lazybump boy like him could get such a bombastic result ...?and there, all my witch-like-aunt starts comparing my result to him and that just feel so sucks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
why?why?why?????????????????????????????????????????????????????????????????????/????
urgh!!!!this is really fuckin shit.. seriously!

IELM: a REPL for emacs





Emacs-lisp (elisp) is a nice language to play around with code and try things as
you develop them – explorative programming. I often use the *scratch*
buffer for that, but sometimes it's nice to use a so-called 'REPL' (
Read-Eval-Print-Loop) instead. A REPL is a sort-of command-line interface
where your expressions are evaluated as soon as they are considered 'complete'
and you press Enter.



So, enter Emacs's built-in repl: IELM. You can activate it with M-x ielm,
and the interaction looks something like the following:





*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> 123
123
ELISP> (+ 1 2)
3
ELISP> ;; comment
ELISP> (defun fac (n)
(if (= 0 n)
1
(* n (fac (- n 1)))))
fac
ELISP> (fac 5)
120
ELISP>





By default, IELM evaluates complete expressions automatically as soon you as
you press Enter. So one thing to remember is that if you want to have
multi-line expression (like above), you must make sure that after each line
the expression is not complete (i.e., the brackets are not balanced) --
otherwise the expression will be evaluated too early. That makes modes like
autopair or paredit a bit inconvenient for this.



If you don't like that behavior, you can do:



(setq ielm-dynamic-return nil)



which will allow you to Enter as much as you want and only evaluate things when
you press C-j. But then you might as well use *scratch* I
suppose. Personally, I use IELM mostly as a calculator.


currently is so in love yaw~

i dont like them..
i even don't know about their existence before..but now~~~

at first, I think this boy band was just like those annoying super juniors with some lame song..urgh...damn it.. but when I heard some of their songs like "man man ha ni" and "what did u say" i fell in love with them in an instant.....=P
gawd..their rocks..and their songs is really catchy and wild..and their dance is superb..I love it..and I love Kevin..seriously his voice is good..and he's pretty..prettier than me.. (T,T)..i Hate it when boys look prettier than girls but he's an exception..damn..his hot....I'm in love yaw~








and this one is my baby..lol..kidding...but if there's any chance a boy like him asked me to go out..I'll go super crazy..haha~

he's not gay..he's HANDSOME...





being crazy..and crazy again~



I'm so bored..and this hella fellow asked me to makeover them..lol, of course we're doing it just for fun .. we're bored as hell that we're doing anything stupid and crazy...lol, my friends told me she wanna be a model for a day..so I gave her a touch for this stupid photoshoot..lol~my art is not beautiful..grr~


before

i'm busy..lol~

before



now, who da hell is dis monster????LOL~

tadaa!!

she said she looks like a total whore.. =P







me also is forced to join...=P lol~



grr..damn that eyebags~


it's been a while~~~~

LOLOLOLOL..it's been a while since I didn't write anything here....well, yeaa...I'm so freaking busy for the whole February and I think I might Be crazy from that stupid dumbass assignment and project  that the stupid lecturer give me.. curse them....lol..
well, I think I'm gonna Have a Nice and Peaceful March since i'll be having some stupid semester break so I think I'm gonna enjoy it till death.... =P
and yeah..I'm gonna upload some silly pics of mine acting like dumbass..errr..whatever.....and guess what, I'm bored now...urgh!!!

Followers

Popular Posts