<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/assets/rss.xsl" type="text/xsl"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"

>
<channel>
	<title>Sacha Chua - tag - wickedcoolemacs</title>
	<atom:link href="https://sachachua.com/blog/tag/wickedcoolemacs/feed/index.xml" rel="self" type="application/rss+xml" />
	<atom:link href="https://sachachua.com/blog/tag/wickedcoolemacs" rel="alternate" type="text/html" />
	<link>https://sachachua.com/blog/tag/wickedcoolemacs/feed/index.xml</link>
	<description>Emacs, sketches, and life</description>
  
	<lastBuildDate>Tue, 09 Jun 2026 02:51:39 GMT</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>daily</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>11ty</generator>
  <item>
		<title>Emacs w3m: Open pages in external browsers</title>
		<link>https://sachachua.com/blog/2008/09/emacs-w3m-open-pages-in-external-browsers/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Sat, 13 Sep 2008 13:26:51 GMT</pubDate>
    <category>emacs</category>
<category>wickedcoolemacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=5138</guid>
		<description><![CDATA[<p>Sometimes w3m is not enough. To make it easier to open the current page in a browser such as Mozilla Firefox, add the following to your <em>~/.emacs</em>:</p>
<pre>
(defun wicked/w3m-open-current-page-in-firefox ()
  "Open the current URL in Mozilla Firefox."
  (interactive)
  (browse-url-firefox w3m-current-url)) ;; (1)

(defun wicked/w3m-open-link-or-image-in-firefox ()
  "Open the current link or image in Firefox."
  (interactive)
  (browse-url-firefox (or (w3m-anchor) ;; (2)
                          (w3m-image)))) ;; (3)
</pre>
<p>This defines a function that uses the current URL being browsed(1) and another function that takes the URL of the link at point(2). If no link is found, it takes the URL of the image at point(3). </p>
<p>You can use other browse-url functions instead of <code>browse-url-firefox</code>. For example, replacing <code>browse-url-firefox</code> with <code>browse-url-kde</code> will open the page, link, or image in Konqueror, KDE&#8217;s web browser.</p>
<p>I like binding <kbd>f</kbd> to the function that opens the current URL in Mozilla Firefox and <kbd>F</kbd> to the function that opens the current link or image in Mozilla Firefox. To do the same, add the following to your <em>~/.emacs</em>:</p>
<pre>
(eval-after-load 'w3m
  (progn 
    (define-key w3m-mode-map "f" 'wicked/w3m-open-current-page-in-firefox)
    (define-key w3m-mode-map "F" 'wicked/w3m-open-link-or-image-in-firefox)))
</pre>
<p>&#8212;<br>
This is part of the <a href="https://sachachua.com/blog/category/wickedcoolemacs">book that I&#8217;m writing about Emacs</a>, which will be published by No Starch Press if I manage to get it together in time.</p>

<p>You can <a href="https://sachachua.com/blog/2008/09/emacs-w3m-open-pages-in-external-browsers/#comment">view 5 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F09%2Femacs-w3m-open-pages-in-external-browsers%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Emacs and w3m: Making tabbed browsing easier</title>
		<link>https://sachachua.com/blog/2008/09/emacs-and-w3m-making-tabbed-browsing-easier/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Fri, 12 Sep 2008 12:43:41 GMT</pubDate>
    <category>emacs</category>
<category>wickedcoolemacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=5137</guid>
		<description><![CDATA[<p>If you browse with a lot of open tabs, like I do, w3m will be much easier to use once you remap <code>w3m-next-buffer</code> and <code>w3m-previous-buffer</code> onto single-key shortcuts, allowing you to press a key to quickly flip between tabs.</p>
<p>By default, <code>w3m-previous-buffer</code> is mapped to <kbd>C-c C-p</kbd> and <code>w3m-next-buffer</code> is mapped to <kbd>C-c C-n</kbd>. On a QWERTY keyboard, you may want to remap <code>w3m-previous-buffer</code> to <kbd>q</kbd> and <code>w3m-next-buffer</code> to <kbd>w</kbd>. You&#8217;ll probably also want to remap <code>w3m-close-window</code> (which had been bound to <kbd>q</kbd>), and <kbd>x</kbd> is a good keybinding for that. To make all these changes, add the following to your <em>~/.emacs</em>:</p>
<pre>
(eval-after-load 'w3m
  '(progn
     (define-key w3m-mode-map "q" 'w3m-previous-buffer)
     (define-key w3m-mode-map "w" 'w3m-next-buffer)
     (define-key w3m-mode-map "x" 'w3m-close-window)))
</pre>
<p>If you use a Dvorak keyboard layout, you can bind <kbd>.</kbd> to <code>w3m-previous-buffer</code> and <kbd>,</kbd> to <code>w3m-next-buffer</code> instead. Just add the following code to your <em>~/.emacs</em>:</p>
<pre>
(eval-after-load 'w3m
  '(progn
     (define-key w3m-mode-map "." 'w3m-previous-buffer)
     (define-key w3m-mode-map "," 'w3m-next-buffer)))
</pre>
<p>(This is part of the draft for my <a href="https://sachachua.com/blog/category/wickedcoolemacs">book on Emacs</a>, to be published by No Starch Press if I&#8217;m not too late.)</p>

<p>You can <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F09%2Femacs-and-w3m-making-tabbed-browsing-easier%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Emacs and W3M: Toggling between work and the Web</title>
		<link>https://sachachua.com/blog/2008/08/emacs-and-w3m-toggling-between-work-and-the-web/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Wed, 27 Aug 2008 12:24:12 GMT</pubDate>
    <category>emacs</category>
<category>wickedcoolemacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=5088</guid>
		<description><![CDATA[<p>Here&#8217;s a handy shortcut that toggles between the W3M web browser and other buffers you&#8217;re working on. I use it to quickly switch between code and documentation (or your favorite timewasting site, as it also makes a handy boss key).</p>
<p>Define the function by adding the following code to your ~/.emacs:</p>
<pre>
(defun wicked/toggle-w3m ()
  "Switch to a w3m buffer or return to the previous buffer."
  (interactive)
  (if (derived-mode-p 'w3m-mode)
      ;; Currently in a w3m buffer
      ;; Bury buffers until you reach a non-w3m one
      (while (derived-mode-p 'w3m-mode)
	(bury-buffer))
    ;; Not in w3m
    ;; Find the first w3m buffer
    (let ((list (buffer-list)))
      (while list
	(if (with-current-buffer (car list)
	      (derived-mode-p 'w3m-mode))
	    (progn
	      (switch-to-buffer (car list))
	      (setq list nil))
	  (setq list (cdr list))))
      (unless (derived-mode-p 'w3m-mode)
	(call-interactively 'w3m)))))
</pre>
<p>Then bind it to a shortcut key sequence (F7 F7 in this example) by adding the following code to your ~/.emacs:</p>
<pre>
(global-set-key (kbd "<f7> </f7><f7>") 'wicked/toggle-w3m)
</f7></pre>
<p>You can then use F7 F7 to switch back and forth between your web browser and whatever else you&#8217;re working on.</p>

<p>You can <a href="https://sachachua.com/blog/2008/08/emacs-and-w3m-toggling-between-work-and-the-web/#comment">view 6 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F08%2Femacs-and-w3m-toggling-between-work-and-the-web%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Why browse the Web in Emacs?</title>
		<link>https://sachachua.com/blog/2008/08/why-browse-the-web-in-emacs/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Wed, 13 Aug 2008 00:57:20 GMT</pubDate>
    <category>emacs</category>
<category>wickedcoolemacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=5064</guid>
		<description><![CDATA[<div class="update">2014-11-27: Hi, <a href="https://sachachua.com/blog/2008/08/why-browse-the-web-in-emacs/">Hacker News!</a> Remember, this post is from 2008 and predates Emacs 24.4. I hear <a href="http://lars.ingebrigtsen.no/2013/06/16/eww/">EWW</a> (Emacs Web Wowser?) is pretty cool and have been meaning to try it out. Anyway, on with the show!</div>
<p>&#8220;Are you browsing Slashdot in Emacs?&#8221;, W- asked me after he glanced at my screen.</p>
<p>With Emacs&#8217; reputation for including everything _and_ the kitchen sink, you probably won&#8217;t be surprised to hear that there&#8217;s more than one way to surf the Internet using your text editor. With today&#8217;s Javascript- and image-heavy websites, it can be hard to believe that anyone would use a text-based browser with limited support for many of the things we take for granted. Still, a Web browser in your text editor can be surprisingly useful. Here are some of the reasons why you might like it:</p>
<ul>
<li><b>Browsing is faster and less distracting.</b> Forget flashing ads, garish colors, and large images. When you surf the Web in Emacs, you can focus on reading, and you can use all the typical Emacs shortcuts for navigating around. You can view images when you want to. If you need to see something that Emacs doesn&#8217;t support, you can easily open the current page in an external Web browser.</li>
<li><b>You can integrate it into your work.</b> With a little bit of Emacs Lisp, you can quickly look up information on the Web based on what you&#8217;re currently working on. For example, PHP mode comes with a shortcut that lets you look up the current function&#8217;s documentation in the PHP manual. You can look up bug report details, dictionary definitions, and Wikipedia pages with minimal typing, too. If you use Emacspeak, you can set up the web browser to speech-synthesize more than what&#8217;s displayed on screen. The more you use Emacs, the more benefits you get from the integration.</li>
<li><b>You can customize everything.</b> You can customize your Emacs experience quickly and easily, and if you spend a lot of time on the Net, you&#8217;ll appreciate having your own shortcuts and functions. For example, I&#8217;ve completely remapped my keyboard shortcuts to support tabbed browsing on a Dvorak keyboard, and I&#8217;ve defined a few functions to make frequently-used commands much easier. You can even use functions to process Web pages and either summarize the information you&#8217;re interested in or make pages more navigable. It&#8217;s all just Emacs Lisp.</li>
<li><b>You&#8217;re safe from browser exploits.</b> No Javascript pop-ups, no image bugs, no browser-based malware that can take over your comuter or steal data. Just content.</li>
<li><b>You need less memory.</b> Why open up a memory-intensive graphical Web-based browser when you&#8217;ve got Emacs open anyway?</li>
</ul>
<p>There&#8217;s more than one way to browse the Web in Emacs, of course. Browse-url is a package that makes it easy to open URLs in your preferred browser or browsers. For example, you can use it to browse the Web in Mozilla Firefox, and (of course) you can use it to browse the Web within Emacs itself. For browsing within Emacs, you can use w3m.el, an interface to the external W3M browser, or w3, a Web browser written entirely in Emacs Lisp. Of the two, I prefer w3m.el, which is much faster and more featureful than w3. Both can display graphics, tables, and frames, and w3 supports stylesheets.</p>
<p>More about Emacs and browsing the Web soon! Planned projects for this chapter of <a href="https://sachachua.com/category/wp/wickedcoolemacs">Wicked Cool Emacs</a>:</p>
<pre>*** Project XXX: Browse the Web
*** Project XXX: Open the current webpage in an external browser
*** Project XXX: Different browsers for different pages
*** Project XXX: Toggle between Web and work
*** Project XXX: Quick search
*** Project XXX: Customize your keymap
*** Project XXX: Download files
*** Project XXX: Add access keys
*** Project XXX: Use social bookmarking
*** Project XXX: Typeahead
*** Project XXX: Preview HTML
*** Project XXX: Read Web pages as news
</pre>
<div class="update">2014-11-27: You can find more comments on <a href="https://sachachua.com/blog/2008/08/why-browse-the-web-in-emacs/">Hacker News</a>.</div>

<p>You can <a href="https://sachachua.com/blog/2008/08/why-browse-the-web-in-emacs/#comment">view 1 comment</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F08%2Fwhy-browse-the-web-in-emacs%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Emacs Gnus: Organize Your Mail</title>
		<link>https://sachachua.com/blog/2008/05/emacs-gnus-organize-your-mail/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Sat, 31 May 2008 20:47:17 GMT</pubDate>
    <category>emacs</category>
<category>wickedcoolemacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=4905</guid>
		<description><![CDATA[<p>
People handle large volumes of mail in different ways. Keeping<br>
everything in one mailbox can quickly become unmanageable because<br>
messages you need to read get lost among messages you don&#8217;t need to<br>
read.
</p>
<p>
You can move mail manually by selecting them in the summary buffer and<br>
typing B m (gnus-summary-move-article). Then type the name of the<br>
group to which you would like to move the message. The group will be<br>
created if it doesn&#8217;t exist.
</p>
<p>
To move multiple messages, mark them with #<br>
(gnus-summary-mark-as-processable) and then type B m<br>
(gnus-summary-move-article). To unmark a message, type M-#<br>
(gnus-summary-unmark-as-processable). To unmark all messages, type M P<br>
U (gnus-summary-unmark-all-processable).
</p>
<h3>Automatically filing mail</h3>
<p>
Moving messages by hand is tedious and time-consuming. One way to deal<br>
with this is to set up rules that automatically file mail into<br>
different groups (or folders, as they&#8217;re called in other mail<br>
clients). Gnus calls this &#8220;splitting&#8221; mail, and you can split mail on<br>
IMAP servers as well as mail downloaded from POP3 servers to your<br>
computer.
</p>
<p>
For example, if you&#8217;re using Gnus to read mail from an IMAP server,<br>
you can split your messages by adding this to your ~/.gnus:
</p>
<p></p><pre>
 (setq nnimap-split-inbox "INBOX") ;; (1)
 (setq nnimap-split-predicate "UNDELETED") ;; (2)
 (setq nnimap-split-rule
       '(
         ("INBOX.emacs" "^Subject:.*emacs")
         ("INBOX.work" "^To:.*you@work.example.com")    
         ("INBOX.personal" "^To:.*you@personal.example.com")    
         ("INBOX.errors" "^From:.*\\(mailer.daemon\\|postmaster\\)")   
        )) 
</pre>
<p></p>
<p>
If you use a different inbox, change the value of<br>
nnimap-split-inbox(1). Any messages in the inbox will be split<br>
according to nnimap-split-rule(2), which is a list where each element<br>
is a list containing the group&#8217;s name and a regular expression<br>
matching the header of messages that should be filed in the group.  In<br>
this example, Gnus will move mail with subjects containing the word<br>
&#8220;emacs&#8221; to INBOX.emacs, mail directed to you@work.example.com to the<br>
INBOX.work group, mail directed to you@personal.example.com to the<br>
INBOX.personal group, and mail error messages to INBOX.errors. All<br>
other messages will be stored in INBOX.
</p>
<p>
If you&#8217;re downloading your mail from a POP3 server and storing it in<br>
nnml, add this to your ~/.gnus instead:
</p>
<p></p><pre>
 (setq nnmail-split-methods
      '(
        ("mail.emacs" "^Subject:.*emacs")
        ("mail.work" "^To:.*you@work.example.com")    
        ("mail.personal" "^To:.*you@personal.example.com")    
        ("mail.errors" "^From:.*\\(mailer.daemon\\|postmaster\\)")   
       )) 
</pre>
<p></p>
<p>
All other messages will be stored in mail.misc.
</p>
<p>
Start M-x gnus again, and your mail will be split into the different<br>
groups.
</p>
<h3>Where are my groups?</h3>
<p>
If you don&#8217;t see your new groups in the group buffer displayed by M-x<br>
gnus, type A A (gnus-group-list-active) to see all the groups. Go to<br>
the group that you would like to add to the group buffer, then type u<br>
(gnus-group-unsubscribe-current-group) to toggle its subscription. In<br>
this example, INBOX.automated is not subscribed to, but INBOX is.
</p>
<p></p><pre>
 U    13: INBOX.automated 
      76: INBOX 
</pre>
<p></p>
<p>
When you type M-x gnus again, you&#8217;ll see your subscribed groups if<br>
they have unread messages.
</p>
<p>
nnimap-split-rule and nnmail-split-methods allow you to filter<br>
interesting or uninteresting mail into different groups based on their<br>
headers. Gnus comes with an even more powerful mail splitting engine.<br>
In fact, Gnus comes with &#8220;fancy mail splitting.&#8221;
</p>
<h3>Fancy mail splitting</h3>
<p>
With fancy mail splitting and some configuration, you can split mail<br>
based on a combination of criteria. You can even manually file a<br>
message and have Gnus automatically file incoming replies in the same<br>
group.
</p>
<p>
To configure an IMAP connection to use fancy mail splitting, add the<br>
following to your ~/.gnus:
</p>
<p></p><pre>
 (setq nnimap-split-inbox "INBOX")
 (setq nnimap-split-predicate "UNDELETED")
 (setq nnmail-split-fancy ;; (1)
       '(|                                ;; (2)
         (: gnus-registry-split-fancy-with-parent) ;; (3)
         ;; splitting rules go here       ;; (4)
         "INBOX"                          ;; (5)
        ))
 (setq nnimap-split-rule 'nnmail-split-fancy)
 (setq nnmail-split-methods 'nnimap-split-fancy) ;; (6)
 (gnus-registry-initialize) ;; (7)
</pre>
<p></p>
<p>
This configures IMAP to use the nnmail-split-fancy function to<br>
determine the group for messages. Note that we&#8217;re setting the<br>
nnmail-split-fancy variable here. If you want to process your IMAP<br>
mail separately from your other mail, you can set the<br>
nnimap-split-fancy variable instead. If so, also set nnimap-split-rule<br>
to &#8216;nnimap-split-fancy. Using nnmail-split-fancy here makes the other<br>
examples easier to understand, though.
</p>
<p>
The nnmail-split-fancy variable controls the splitting behavior(1). The<br>
&#8220;|&#8221; symbol means that that the first matching rule is used(2). For<br>
example, if the message being processed is a reply to a message that<br>
Gnus knows about, then the gnus-registry-split-fancy-with-parent<br>
function will return the name of the group, and nnmail-split-fancy<br>
will file the message there(3).  You can add other splitting rules as<br>
well(4). If messages don&#8217;t match any of these rules, the last rule<br>
specifies that the messages will be filed in INBOX(5). Set<br>
nnmail-split-methods to nnimap-split-fancy as well in order to work<br>
around some assumptions in other parts of the code(6). After that,<br>
initialize the Gnus registry(7), which is responsible for tracking<br>
moved and deleted messages. This allows you to automatically split<br>
replies into the same folders as the original messages.
</p>
<p>
To configure fancy mail splitting with an nnml backend (suggested<br>
configuration for POP3), add the following to your ~/.gnus instead:
</p>
<p></p><pre>
 (gnus-registry-initialize)
 (setq nnmail-split-fancy                 
       '(|                                
         (: gnus-registry-split-fancy-with-parent)
         ;; splitting rules go here       
         "mail.misc"                          ;; (1)
        ))
 (setq nnmail-split-methods 'nnmail-split-fancy)    
</pre>
<p></p>
<p>
This code is similar to the IMAP example, except that the default<br>
mailbox name for nnml is mail.misc(1).
</p>
<p>
Here&#8217;s how the previous rules in nnmail-split-methods would be<br>
translated to nnmail-split-fancy rules for an IMAP configuration:
</p>
<p></p><pre>
 (setq nnmail-split-fancy
      '(|
        (: gnus-registry-split-fancy-with-parent)
         ;; splitting rules go here       
        (from mail "INBOX.errors")   ;; (1)
        (any "you@work.example.com" "INBOX.work")   ;; (2)
        (any "you@personal.example.com" "INBOX.personal") ;; 
        ("subject" "emacs" "INBOX.emacs") ;; (3)
        "INBOX"    ;; or "mail.misc" for nnml/POP3
       )) 
</pre>
<p></p>
<p>
The <code>from</code> keyword matches against the &#8220;From&#8221;, &#8220;Sender&#8221;, and<br>
&#8220;Resent-From&#8221; fields, while the mail keyword matches common mail<br>
system addresses(1). The corresponding <code>to</code> keyword matches against<br>
the &#8220;To&#8221;, &#8220;Cc&#8221;, &#8220;Apparently-To&#8221;, &#8220;Resent-To&#8221; and &#8220;Resent-Cc&#8221; headers,<br>
while <code>any</code> matches the fields checked by the <code>from</code> and <code>to</code><br>
keywords(2). You can also compare against the subject<br>
and other headers(3).
</p>
<p>
You can use logic in splitting rules, too. For example, if you like<br>
reading the jokes on joke-mailing-list@example.com, but you don&#8217;t like<br>
the ones sent by vi-guy@example.com (he not only has a bad sense of<br>
humor, but also likes picking on Emacs!), you can use a rule like<br>
this in your nnmail-split-fancy:
</p>
<p></p><pre>
         ;; ... other splitting rules go here...
         (any "joke-mailing-list@example.com"   ;; (1)
              (| (from "vi-guy@example.com" "INBOX.junk") ;; (2)
                 "INBOX.jokes")) ;; (3)
         ;; ... other splitting rules go here
</pre>
<p></p>
<p>
The first rule matches all messages with<br>
&#8220;joke-mailing-list@example.com&#8221; in from- or to-related headers.<br>
Matching messages are processed with another split rule, which moves<br>
messages from vi-guy@example.com to a separate group(2) and files the<br>
other messages in INBOX.jokes(3). To learn more about creating complex<br>
rules, read the Gnus Info manual for &#8220;Fancy Mail Splitting&#8221;.</p>

<p>You can <a href="https://sachachua.com/blog/2008/05/emacs-gnus-organize-your-mail/#comment">view 1 comment</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F05%2Femacs-gnus-organize-your-mail%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Emacs Gnus: Searching Mail</title>
		<link>https://sachachua.com/blog/2008/05/emacs-gnus-searching-mail/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Sat, 31 May 2008 12:49:37 GMT</pubDate>
    <category>emacs</category>
<category>wickedcoolemacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=4902</guid>
		<description><![CDATA[<p>
There are several ways to find messages in Emacs. From the summary<br>
buffer, you can use / o (gnus-summary-insert-old-articles) to display<br>
all or some old messages. You can then scan through the headers in the<br>
summary buffer by using C-s (isearch-forward), or you can limit the<br>
displayed messages with these commands:
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<col align="left">
<col align="left">
<col align="left">
<tbody>
<tr>
<td>Messages from a given author</td>
<td width="50">/&nbsp;a</td>
<td>gnus-summary-limit-to-author</td>
</tr>
<tr>
<td>Messages whose subjects matching a given regular expression</td>
<td>/ /</td>
<td>gnus-summary-limit-to-subject</td>
</tr>
<tr>
<td>Messages that match a given extra header</td>
<td>/ x</td>
<td>gnus-summary-limit-to-extra-headers</td>
</tr>
<tr>
<td>Messages at least N days old</td>
<td>/ t</td>
<td>gnus-summary-limit-to-age</td>
</tr>
</tbody>
</table>
<p>
Limits work on the messages that are currently displayed, so you can<br>
apply multiple limits. If you make a mistake, use / w<br>
(gnus-summary-pop-limit) to remove the previous limit. You can repeat<br>
/ w (gnus-summary-pop-limit) until satisfied. To remove all the<br>
limits, type C-u / w (gnus-summary-popl-limit).
</p>
<p>
If you specify a prefix, the limit&#8217;s meaning is reversed.  For<br>
example, C-u / a (gnus-summary-limit-to-author) will remove the<br>
messages from the matching author or authors.
</p>
<p>
You can use Gnus to search the currently-displayed messages by using<br>
M-s (gnus-summary-search-article-forward) and M-r<br>
(gnus-summary-search-article-backward).
</p>
<p>
If you want to search a lot of mail, you&#8217;ll find NNIR handy. NNIR is a<br>
front-end to mail search engines which can index your mail and return<br>
search results quickly. If you want to use NNIR with a local or remote<br>
IMAP server, you will need to use nnir.el and imap.el. If you download<br>
your mail using fetchmail or connect to a POP3 server and use an nnml<br>
backend, you can use NNIR with a search engine such as swish-e to<br>
search your ~/Mail directory efficiently.
</p>
<div class="outline-5">
<h5 id="sec-17">1.6.7.1 Setting up IMAP and NNIR</h5>
<p>
If you use IMAP, then your mail is stored on the mail server and<br>
you&#8217;ll need to use the IMAP search interface to search through<br>
it. Download nnir.el from<br>
<a href="http://www.emacswiki.org/cgi-bin/wiki/download/nnir.el">http://www.emacswiki.org/cgi-bin/wiki/download/nnir.el</a> and save it to<br>
your ~/elisp directory. You will also need an imap.el that is newer<br>
than the one that comes with Emacs 22. Download imap.el from<br>
<a href="http://www.emacswiki.org/cgi-bin/wiki/download/imap.el">http://www.emacswiki.org/cgi-bin/wiki/download/imap.el</a> and save it to<br>
your ~/elisp directory as well. Because Gnus comes with an older<br>
version of imap.el, you will need to make sure that the new version of<br>
imap.el is loaded. Add the following to your ~/.gnus:
</p>
<pre>
(add-to-list 'load-path "~/elisp")
(load-file "~/elisp/imap.el")
(require 'nnir)
</pre>
<p>
Restart your Emacs. You can check if the correct version of imap.el<br>
has been loaded by typing M-x locate-library and specifying<br>
imap.el. If Emacs reports &#8220;~/elisp/imap.el&#8221;, then Gnus is configured<br>
to use the updated imap.el.
</p>
</div>
<div class="outline-5">
<h5 id="sec-18">1.6.7.2 Setting up POP3 and NNIR</h5>
<p>
If you use the configuration for POP3 that is suggested in this<br>
chapter, then your mail is stored in the nnml backend, which uses one<br>
file per message. To search this using NNIR, to install nnir.el and an<br>
external search mail engine. The Namazu search engine runs on Linux,<br>
UNIX, and Microsoft Windows, so that&#8217;s what we&#8217;ll talk about here. To<br>
find and configure other mail search engines supported by NNIR, check<br>
out the comments in nnir.el.
</p>
<p>
First, you&#8217;ll need to download and install Namazu. If Namazu is<br>
available as a package for your distribution, install it that way, as<br>
it depends on a number of other programs. An installer for Microsoft<br>
Windows can be found at <a href="http://www.namazu.org/windows/">http://www.namazu.org/windows/</a> . If you need<br>
to build Namazu from source, you can get the source code and instructions<br>
from <a href="http://www.namazu.org">http://www.namazu.org</a> .
</p>
<p>
After you&#8217;ve installed Namazu, create a directory for Namazu&#8217;s index<br>
files, such as ~/.namazu-mail. Then index your mail by typing this at<br>
the command-line:
</p>
<pre>
mknmz &#45;&#45;mailnews -O ~/.namazu-mail ~/Mail
</pre>
<p>
and add the following to your ~/.gnus:
</p>
<pre>
(add-to-list 'load-path "~/elisp")
(require 'nnir)
(setq nnir-search-engine 'namazu)
(setq nnir-namazu-index-directory (expand-file-name "~/.namazu-mail"))
(setq nnir-namazu-remove-prefix (expand-file-name "~/Mail"))
(setq nnir-mail-backend gnus-select-method)
</pre>
</div>
<div class="outline-5">
<h5 id="sec-19">1.6.7.3 Searching your mail with NNIR</h5>
<p>
From the group buffer displayed by M-x gnus, you can type G G<br>
(gnus-group-make-nnir-group) to search your mail for a keyword.</p>
<p>
If you&#8217;re using the Namazu search engine, then you can use more<br>
sophisticated search queries such as:
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<col align="left">
<col align="left">
<tbody>
<tr>
<td>Linux Emacs</td>
<td>messages that contain both &#8220;Linux&#8221; and &#8220;Emacs&#8221;</td>
</tr>
<tr>
<td>Linux or Emacs</td>
<td>messages that contain either &#8220;Linux&#8221; or &#8220;Emacs&#8221;</td>
</tr>
<tr>
<td>Emacs not Linux</td>
<td>messages that contain &#8220;Emacs&#8221; but not &#8220;Linux&#8221;</td>
</tr>
<tr>
<td>Emacs and (Linux or Windows)</td>
<td>messages that contain &#8220;Emacs&#8221; and either &#8220;Linux&#8221; or &#8220;Windows&#8221;</td>
</tr>
<tr>
<td>&#8220;apple pie&#8221;</td>
<td>messages that contain the phrase &#8220;apple pie&#8221;</td>
</tr>
<tr>
<td>{apple pie}</td>
<td>messages that contain the phrase &#8220;apple pie&#8221;</td>
</tr>
<tr>
<td>+from:example@example.com</td>
<td>messages with example@example.com in the From: header</td>
</tr>
<tr>
<td>+subject:&#8221;apple pie&#8221;</td>
<td>messages with the phrase &#8220;apple pie&#8221; in the Subject: header</td>
</tr>
<tr>
<td>+subject:apple +subject:pie</td>
<td>messages whose Subject: headers contain both &#8220;apple&#8221; and &#8220;pie&#8221;</td>
</tr>
</tbody>
</table>
<p> If<br>
matching messages are found, then you will see a temporary group with<br>
the results. Although you can&#8217;t delete messages from this view,<br>
reading and replying to these messages is the same as reading and<br>
replying to regular messages.
</p>
<p>
To see a message in its original context, type G T<br>
(gnus-summary-nnir-goto-thread) from the summary buffer. This opens<br>
the message&#8217;s original group. If Gnus asks you how many articles to<br>
load, press RET to accept the default of all the articles.
</p>
</div>
<hr size="1">
This is a draft for the <a href="https://sachachua.com/blog/category/wickedcoolemacs">Wicked Cool Emacs</a> book I&#8217;m working on. =) Hope it helps!<p></p>

<p>You can <a href="https://sachachua.com/blog/2008/05/emacs-gnus-searching-mail/#comment">view 1 comment</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F05%2Femacs-gnus-searching-mail%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Faster mail with Emacs</title>
		<link>https://sachachua.com/blog/2008/04/faster-mail-with-emacs/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Sun, 13 Apr 2008 00:57:36 GMT</pubDate>
    <category>emacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=4835</guid>
		<description><![CDATA[<p>I spent a few minutes getting offlineimap to synchronize my Gmail messages with dovecot, an IMAP server on my laptop. I also set up Gnus to work with the messages. Now I&#8217;m having <i>fun</i> speeding through my inbox. I don&#8217;t know why, but my text-based terminal seems a lot zippier and a lot easier to work with than Gmail&#8230; =)</p>
<p>I&#8217;m glad I&#8217;m back to doing my mail in Emacs!</p>

<p>You can <a href="https://sachachua.com/blog/2008/04/faster-mail-with-emacs/#comment">view 1 comment</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F04%2Ffaster-mail-with-emacs%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item>
	</channel>
</rss>