<?xml version="1.0" encoding="UTF-8"?>
<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 :: enterprise 2.0 consultant, storyteller, geek &#187; emacs</title>
	<atom:link href="http://sachachua.com/wp/category/emacs/feed/" rel="self" type="application/rss+xml" />
	<link>http://sachachua.com/wp</link>
	<description>I help organizations and people learn how to connect and collaborate more effectively using Web 2.0 tools.</description>
	<lastBuildDate>Sun, 05 Jul 2009 17:09:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Thoughts on Toodledo versus Emacs Org</title>
		<link>http://sachachua.com/wp/2009/06/10/thoughts-on-toodledo-versus-emacs-org/</link>
		<comments>http://sachachua.com/wp/2009/06/10/thoughts-on-toodledo-versus-emacs-org/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 01:44:53 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/2009/06/10/thoughts-on-toodledo-versus-emacs-org/</guid>
		<description><![CDATA[
It&#039;s been a couple of months since I switched to using the Toodledo instead of Emacs Org to manage my tasks. I decided to use Toodledo because I wanted a to-do list that I could access on any computer and on my iPod Touch, so that I could capture tasks from anywhere. I liked Toodledo [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=6350"><!-- &nbsp; --></abbr>
<p>It&#039;s been a couple of months since I switched to using the Toodledo instead of Emacs Org to manage my tasks. I decided to use Toodledo because I wanted a to-do list that I could access on any computer and on my iPod Touch, so that I could capture tasks from anywhere. I liked Toodledo more than I liked Remember the Milk because Toodledo&#039;s tagging and time-tracking features fit the way I work. I also liked how I could ask my virtual assistant to fill in templates&#8211;for example, preparation tasks for upcoming presentations&#8211;based on certain dates.</p>
<p>I still like Toodledo, but I feel an unsatisfied itch. Toodle-do is a great Getting Things Done system for capturing and tracking tasks, but even though it has some support for defining short-, medium-, and long-term goals, I wasn&#039;t using them because they were split up on multiple screens. I missed the outlines of Org where I could define my higher-level goals, easily add new ones, and create tasks and subtasks. I missed the close integration with my schedule and the ability to easily see my historical task information. I missed the distinction between scheduled dates and deadlines, and the calculation of days until something is due.</p>
<p>So I think it&#039;s time to switch back, at least temporarily. Maybe I can find a way to seamlessly synchronize my Org files so that changes are reflected on the different computers I&#039;m on, and maybe I can find a way to easily capture or review tasks while I&#039;m on the go. Perhaps I&#039;ll continue working on org-toodledo so that I can export tasks from Org to the web-based interface. That way, I can quickly review today&#039;s tasks while I&#039;m out and about.</p>
<p>Hmm&#8230;
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2009/06/10/thoughts-on-toodledo-versus-emacs-org/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Nothing quite like Org for Emacs</title>
		<link>http://sachachua.com/wp/2009/04/06/nothing-quite-like-org-for-emacs/</link>
		<comments>http://sachachua.com/wp/2009/04/06/nothing-quite-like-org-for-emacs/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 14:32:05 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/2009/04/06/nothing-quite-like-org-for-emacs/</guid>
		<description><![CDATA[
I&#039;ve been trying lots of different Web-based GTD task managers like Remember the Milk, Toodledo, and GTDAgenda. I&#039;m slowly coming to the conclusion that there&#039;s nothing quite like Org for Emacs. 
Here&#039;s what I like about the other services:

Both Remember the Milk and Toodledo have iPhone/iPod Touch interfaces, so I can review, check off, and [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=6078"><!-- &nbsp; --></abbr>
<p>I&#039;ve been trying lots of different Web-based GTD task managers like <a href="http://www.rememberthemilk.com">Remember the Milk</a>, <a href="http://www.toodledo.com">Toodledo</a>, and <a href="http://www.gtdagenda.com">GTDAgenda</a>. I&#039;m slowly coming to the conclusion that there&#039;s nothing quite like <a href="http://orgmode.org/">Org for Emacs</a>. </p>
<p>Here&#039;s what I like about the other services:
<ul>
<li>Both Remember the Milk and Toodledo have iPhone/iPod Touch interfaces, so I can review, check off, and create tasks anywhere.</li>
<li>All those services allow me to e-mail tasks to an address.</li>
<li>It&#039;s easy to filter tasks by context.</li>
<li>I can share my tasks with my assistant so that he or she can remind me of the tasks I&#039;ve scheduled for the day.</li>
</ul>
<p>Here&#039;s what I like about Org:
<ul>
<li>I can use templates and outlines to organize my tasks however I want.</li>
<li>I can set deadlines, scheduled tasks, and prior notice easily.</li>
<li>I can track time more finely than Toodledo can.</li>
<li>I can use Org as an activity log.</li>
<li>I can schedule tasks onto specific timeslots.</li>
</ul>
<p>Of all the options I&#039;ve tried, Toodledo is closest to where I am with Org, although it still doesn&#039;t do everything. </p>
<p>Some options are:
<ul>
<li>Use worg or develop a web-based interface for displaying tasks based on my Org file</li>
<li>Write code for synchronizing Org with Toodledo or RememberTheMilk, making lots of geeks happy in the process =)</li>
</ul>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=91fba46e-ed29-8637-a258-ee7f1942881a" /></div>
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2009/04/06/nothing-quite-like-org-for-emacs/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Planning meetings, get-togethers, and interviews with AgreeADate</title>
		<link>http://sachachua.com/wp/2009/02/09/planning-meetings-get-togethers-and-interviews-with-agreeadate/</link>
		<comments>http://sachachua.com/wp/2009/02/09/planning-meetings-get-togethers-and-interviews-with-agreeadate/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 03:59:17 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5723</guid>
		<description><![CDATA[
One of the reasons why I love thinking of ways to help people rock even more is that I often end up learning a lot in the process.
For example, last week, I needed to coordinate schedules with Katie Bartlett, Jeff Widman&#039;s assistant, for a chat with Jeff about networking. I thought about how much e-mail [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5723"><!-- &nbsp; --></abbr>
<p>One of the reasons why I love thinking of ways to help people rock even more is that I often end up learning a lot in the process.</p>
<p>For example, last week, I needed to<strong> coordinate schedules</strong> with Katie Bartlett, Jeff Widman&#039;s assistant, for a chat with Jeff about networking. I thought about how much e-mail was sent back-and-forth figuring out <strong>times and timezones</strong>, and I multiplied that by the number of appointments Katie probably needed to arrange. <strong>That sounded like a lot of work.</strong> If I could find a tool to make that easier for our appointment, and she used that tool to organize lots of other appointments, then that would be great!</p>
<p>I checked out a couple of tools such as <a href="http://timetomeet.com">TimeToMeet</a>, <a href="http://scheduleonce.com">ScheduleOnce</a>, and <a href="http://www.agreeadate.com">AgreeADate</a>. Of the tools I tried, I liked AgreeADate the most because it made it easy to create different kinds of schedules and it supported timezones. I sent Katie a few potential timeslots for my chat with Jeff. After she replied, I confirmed the time that was mutually convenient. <strong>That wasn&#039;t hard at all.</strong></p>
<p>Then I explored the other features. I found out that I could create a schedule where people could pick a slot. AgreeADate allowed me to specify <strong>how many people each timeslot was limited to, and how many slots people could choose.</strong> This opened up all sorts of possibilities, and has become my favorite feature!</p>
<p>Things that I&#039;d formerly had been worried about scheduling became so much easier to schedule because I could create all the slots in parallel and then let people choose the slots that hadn&#039;t been taken yet. For example, I&#039;d been meaning to try outsourcing some technical and personal tasks, but <strong>scheduling interview times sounded like a hassle.</strong> With this system, I just had to <strong>set all the slots up and invite people to choose</strong> the timeslot most convenient for them. Yay!</p>
<p>AgreeADate isn&#039;t perfect, but it makes scheduling things so much easier for me, and it <strong>lowers the barrier</strong> enough for me to go and make things happen. In the past week that I&#039;ve been trying it out, I&#039;ve:</p>
<ul>
<li>scheduled a capoeira trial</li>
<li>scheduled a conference call</li>
<li>set up interviews for a system administrator and a virtual assistant, and</li>
<li>set up lunch with a poll on where to eat.</li>
</ul>
<p>You know, stuff that would&#039;ve taken way too much e-mail if I had to do it by hand. =)</p>
<p>I&#039;d like to see it integrated with my Google Calendar, and one of the AgreeADate folks told me that that&#039;s the next thing on their roadmap. I found myself wondering which slots I&#039;d tentatively offered for other events, and being able to see all the tentative slots overlaid on my calendar would be fantastic.</p>
<p>In the meantime, I read the confirmation e-mails in Emacs Gnus, use Remember and Org to create an appointment hyperlinked to that mail, and then use my own code, the twit.el library, and the <a href="http://www.twittercal.com">Twittercal</a> service to create an appointment on my Google Calendar (on google.com), which is then shared with my Google Calendar on sachachua.com thanks to the joys of Google Apps. It&#039;s quite Rube Goldberg-esque (as many of my bubblegum-and-string tricks are), but so far, it works. Maybe this&#039;ll be something I&#039;ll outsource (except perhaps without the Gnus + Remember + Org part) once I&#039;ve gotten that virtual assistance thing sorted out. =)</p>
<p>For the geeks, some Emacs Lisp to mash together with Org, TwitterCal, Google Calendar, and twit.el (some wizardry required):</p>
<pre>(defun sacha/org-as-gcal-quick-add ()
  "Convert the current SCHEDULED: timestamp and header into a GCal quick add item."
  (save-excursion
    (org-back-to-heading t)
    (setq end (save-excursion (outline-next-heading) (point)))
    (when (re-search-forward org-scheduled-time-regexp
			     end t)
      (let (ts default-time stamp plain s0 srp s1 s2)
	(setq ts (match-string 1)
	      default-time (apply 'encode-time (org-parse-time-string ts)))
	(when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts))
		  (setq plain (string-match org-plain-time-of-day-regexp ts)))
	  (setq s0 (match-string 0 ts)
		srp (and stamp (match-end 3))
		s1 (match-string (if plain 1 2) ts)
		s2 (match-string (if plain 8 (if srp 4 6)) ts)))
	(cond
	 (s2
	  (concat (org-no-properties (org-get-heading t)) " on "
		  (format-time-string "%x" default-time) " from "
		  (org-get-time-of-day s1 'string t) " to "
		  (org-get-time-of-day s2 'string t)
		  ))
	 (s1

	  (concat (org-no-properties (org-get-heading t)) " on "
		  (format-time-string "%x" default-time) " from "
		  (org-get-time-of-day s1 'string t)
		  ))
	 (t
	  (concat (org-no-properties (org-get-heading t)) " on "
		  (format-time-string "%x" default-time)
		  )
	  ))))))

(defun sacha/org-to-twittercal (string)
  "Post STRING to TwitterCal. See http://www.twittercal.com for details."
  (interactive (list (read-string "Event: " (sacha/org-as-gcal-quick-add))))
  (twit-post-function twit-update-url (concat "d gcal " string)))</pre>
<p>I&#039;ll keep you posted on my experiments! =)
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2009/02/09/planning-meetings-get-togethers-and-interviews-with-agreeadate/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Upcoming talk: Totally Rocking Your Drupal Development Environment</title>
		<link>http://sachachua.com/wp/2009/01/21/upcoming-talk-totally-rocking-your-drupal-development-environment/</link>
		<comments>http://sachachua.com/wp/2009/01/21/upcoming-talk-totally-rocking-your-drupal-development-environment/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 20:08:23 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[talk]]></category>
		<category><![CDATA[abstract]]></category>
		<category><![CDATA[bio]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5649</guid>
		<description><![CDATA[
On February 12, at 12 EST, I&#039;ll be giving a teleconference presentation to the IBM Drupal Users Group. =) It&#039;s internal-only, but I wanted to post it here because I often need to look up my abstracts and bios. The abstract is the same as the talk I submitted to DrupalCon09 (Totally Rocking Your Development [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5649"><!-- &nbsp; --></abbr>
<p>On February 12, at 12 EST, I&#039;ll be giving a teleconference presentation to the IBM Drupal Users Group. =) It&#039;s internal-only, but I wanted to post it here because I often need to look up my abstracts and bios. The abstract is the same as the talk I submitted to <a href="http://dc2009.drupalcon.org/session/totally-rocking-your-development-environment">DrupalCon09 (Totally Rocking Your Development Environment)</a>, but I&#039;ll add some more IBM-specific tips.</p>
<p><strong>Abstract:</strong></p>
<blockquote><p>Are you a lazy developer? If you aren&#039;t, you should be! Find out about editor tricks that can save you hours and hours of effort and frustration. Learn about browser tips that make it easy to test your sites with different users, track down elusive bugs, and test. Develop the virtue of laziness by automating as much as you can with makefiles, the Drupal Shell, regression tests, and other goodies. Share your best tips during this interactive session. Use your new free time to rock even more!
</p></blockquote>
<p><strong>Bio</strong></p>
<p>
<blockquote>Sacha Chua has an unshakable belief that life is too short to waste doing repetitive tasks that can be automated, an irrational love for tweaking her development environment, and an irresistible urge to share whatever she&#039;s learned along the way. To learn more about her and Web 2.0, Drupal, Emacs, and other things she&#039;s interested, visit [INTERNAL IBM URL] or <a href="http://livinganawesomelife.com">http://LivingAnAwesomeLife.com</a> (personal blog).</p></blockquote>
<p>Inside IBM and want to get a copy of the calendar invite? Contact William Shaouy.
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/abstract' rel='tag' target='_self'>abstract</a>, <a class='technorati-link' href='http://technorati.com/tag/bio' rel='tag' target='_self'>bio</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2009/01/21/upcoming-talk-totally-rocking-your-drupal-development-environment/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Emacs basics: Changing the background color</title>
		<link>http://sachachua.com/wp/2009/01/18/emacs-basics-changing-the-background-color/</link>
		<comments>http://sachachua.com/wp/2009/01/18/emacs-basics-changing-the-background-color/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 21:22:09 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[wickedcoolemacs]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5635</guid>
		<description><![CDATA[
One of the first things you&#039;ll probably want to change about Emacs is the default face. This controls the foreground color, the background color, the font, and other attributes. For example, many graphical environments give Emacs a background of white. If you prefer a black background (which can be less tiring during long periods of [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5635"><!-- &nbsp; --></abbr>
<p>One of the first things you&#039;ll probably want to change about Emacs is the default face. This controls the foreground color, the background color, the font, and other attributes. For example, many graphical environments give Emacs a background of white. If you prefer a black background (which can be less tiring during long periods of use), you can change the background to black my customizing the default face.</p>
<p>To change the background color and other attributes, use the command <code>M-x customize-face</code>, and specify <code>default</code> as the face to customize. Change the attributes and the sample text will reflect your settings. When you are satisfied, select <b>Save for future sessions</b>. Your changes will be saved to ~/.emacs and reloaded the next time you start the editor.</p>
<hr size="1"/>
<p>This is a draft for <a href="http://sachachua.com/wp/category/wickedcoolemacs">Wicked Cool Emacs</a>, a book that will be published by <a href="http://www.nsp.com">No Starch Press</a>. (if we manage to get it all together! =)</p>
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2009/01/18/emacs-basics-changing-the-background-color/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Emacs, file-cache, and ido</title>
		<link>http://sachachua.com/wp/2009/01/06/emacs-file-cache-and-ido/</link>
		<comments>http://sachachua.com/wp/2009/01/06/emacs-file-cache-and-ido/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 00:56:12 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5572</guid>
		<description><![CDATA[

(require 'filecache)
(require 'ido)
(defun file-cache-ido-find-file (file)
  "Using ido, interactively open file from file cache'.
First select a file, matched using ido-switch-buffer against the contents
in `file-cache-alist'. If the file exist in more than one
directory, select directory. Lastly the file is opened."
  (interactive (list (file-cache-ido-read "File: "
           [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5572"><!-- &nbsp; --></abbr>
<pre>
(require 'filecache)
(require 'ido)
(defun file-cache-ido-find-file (file)
  "Using ido, interactively open file from file cache'.
First select a file, matched using ido-switch-buffer against the contents
in `file-cache-alist'. If the file exist in more than one
directory, select directory. Lastly the file is opened."
  (interactive (list (file-cache-ido-read "File: "
                                          (mapcar
                                           (lambda (x)
                                             (car x))
                                           file-cache-alist))))
  (let* ((record (assoc file file-cache-alist)))
    (find-file
     (expand-file-name
      file
      (if (= (length record) 2)
          (car (cdr record))
        (file-cache-ido-read
         (format "Find %s in dir: " file) (cdr record)))))))

(defun file-cache-ido-read (prompt choices)
  (let ((ido-make-buffer-list-hook
	 (lambda ()
	   (setq ido-temp-list choices))))
    (ido-read-buffer prompt)))
(add-to-list 'file-cache-filter-regexps "docs/html")
(add-to-list 'file-cache-filter-regexps "\\.svn-base$")
(add-to-list 'file-cache-filter-regexps "\\.dump$")
(defmacro sacha/file-cache-setup-tree (prefix shortcut directories)
  "Set up the file-cache tree for PREFIX using the keyboard SHORTCUT.
DIRECTORIES should be a list of directory names."
  `(let ((file-cache-alist nil)
	 (directories ,directories))
     (file-cache-clear-cache)
     (while directories
       (file-cache-add-directory-using-find (car directories))
       (setq directories (cdr directories)))
     (setq ,(intern (concat "sacha/file-cache-" prefix "-alist")) file-cache-alist)
     (defun ,(intern (concat "sacha/file-cache-ido-find-" prefix)) ()
       (interactive)
       (let ((file-cache-alist ,(intern (concat "sacha/file-cache-" prefix "-alist"))))
	 (call-interactively 'file-cache-ido-find-file)))
     (global-set-key (kbd ,shortcut)
		     (quote ,(intern (concat "sacha/file-cache-ido-find-" prefix))))))
</pre>
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2009/01/06/emacs-file-cache-and-ido/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Emacs: Working with multiple source trees</title>
		<link>http://sachachua.com/wp/2008/12/19/emacs-working-with-multiple-source-trees/</link>
		<comments>http://sachachua.com/wp/2008/12/19/emacs-working-with-multiple-source-trees/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 20:00:33 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[elisp]]></category>
		<category><![CDATA[emacs-lisp]]></category>
		<category><![CDATA[file-cache]]></category>
		<category><![CDATA[ido]]></category>
		<category><![CDATA[macro]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5463</guid>
		<description><![CDATA[
As a developer, I often find myself working with multiple trees of source code. Sometimes, I&#039;m comparing the trunk and the branches. Sometimes, I&#039;m copying ideas from one place to another. Sometimes, I&#039;m working on one project and an urgent defect comes in for a different project. With good development environments such as Eclipse, I&#039;d [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5463"><!-- &nbsp; --></abbr>
<p>As a developer, I often find myself working with multiple trees of source code. Sometimes, I&#039;m comparing the trunk and the branches. Sometimes, I&#039;m copying ideas from one place to another. Sometimes, I&#039;m working on one project and an urgent defect comes in for a different project. With good development environments such as Eclipse, I&#039;d still need to click on the project or directory in order to change my context, and then use a keyboard shortcut to find the resource in that tree. </p>
<p>With an awesome development environment like my customized Emacs, however, I can easily juggle multiple source trees. Here&#039;s the macro I wrote to make setting this up much easier:</p>
<pre>
(defmacro sacha/file-cache-setup-tree (prefix shortcut directories)
  "Set up the file-cache tree for PREFIX using the keyboard SHORTCUT.
DIRECTORIES should be a list of directory names."
  `(let ((file-cache-alist nil)
	 (directories ,directories))
     (file-cache-clear-cache)
     (while directories
       (file-cache-add-directory-using-find (car directories))
       (setq directories (cdr directories)))
     (setq ,(intern (concat "sacha/file-cache-" prefix "-alist")) file-cache-alist)
     (defun ,(intern (concat "sacha/file-cache-ido-find-" prefix)) ()
       (interactive)
       (let ((file-cache-alist ,(intern (concat "sacha/file-cache-" prefix "-alist"))))
	 (call-interactively 'file-cache-ido-find-file)))
     (global-set-key (kbd ,shortcut)
		     (quote ,(intern (concat "sacha/file-cache-ido-find-" prefix))))))
</pre>
<p>With that, I can use the following to map C-c p to finding files in my personal directories:</p>
<pre>
(sacha/file-cache-setup-tree
 "personal"
 "C-c p"
 '("/var/www/html/drupal"
   "~/elisp"
   "~/personal"))
</pre>
<p>I&#039;ve also set up keyboard shortcuts for the other trees I&#039;m working on.</p>
<p>You&#039;ll need file-cache, ido, and probably something like this:</p>
<pre>
(require 'filecache)
(require 'ido)
(defun file-cache-ido-find-file (file)
  "Using ido, interactively open file from file cache'.
First select a file, matched using ido-switch-buffer against the contents
in `file-cache-alist'. If the file exist in more than one
directory, select directory. Lastly the file is opened."
  (interactive (list (file-cache-ido-read "File: "
                                          (mapcar
                                           (lambda (x)
                                             (car x))
                                           file-cache-alist))))
  (let* ((record (assoc file file-cache-alist)))
    (find-file
     (expand-file-name
      file
      (if (= (length record) 2)
          (car (cdr record))
        (file-cache-ido-read
         (format "Find %s in dir: " file) (cdr record)))))))

(defun file-cache-ido-read (prompt choices)
  (let ((ido-make-buffer-list-hook
	 (lambda ()
	   (setq ido-temp-list choices))))
    (ido-read-buffer prompt)))
(add-to-list 'file-cache-filter-regexps "docs/html")
(add-to-list 'file-cache-filter-regexps "\\.svn-base$")
(add-to-list 'file-cache-filter-regexps "\\.dump$")
</pre>
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/elisp' rel='tag' target='_self'>elisp</a>, <a class='technorati-link' href='http://technorati.com/tag/emacs' rel='tag' target='_self'>emacs</a>, <a class='technorati-link' href='http://technorati.com/tag/emacs-lisp' rel='tag' target='_self'>emacs-lisp</a>, <a class='technorati-link' href='http://technorati.com/tag/file-cache' rel='tag' target='_self'>file-cache</a>, <a class='technorati-link' href='http://technorati.com/tag/ido' rel='tag' target='_self'>ido</a>, <a class='technorati-link' href='http://technorati.com/tag/macro' rel='tag' target='_self'>macro</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/12/19/emacs-working-with-multiple-source-trees/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Emacs, Org, and BBDB: Hyperlinking names to blogs</title>
		<link>http://sachachua.com/wp/2008/12/18/emacs-org-and-bbdb-hyperlinking-names-to-blogs/</link>
		<comments>http://sachachua.com/wp/2008/12/18/emacs-org-and-bbdb-hyperlinking-names-to-blogs/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 02:48:44 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[bbdb]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[org]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5461</guid>
		<description><![CDATA[
Back when I used Planner for Emacs, I coded some shortcuts to make it easier to write about the people I met and the conversations I had. I used the hippie-expand module to complete names from my Big Brother Database addressbook, and I wrote a function that converted those names into links to people&#039;s blogs [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5461"><!-- &nbsp; --></abbr>
<p>Back when I used Planner for Emacs, I coded some shortcuts to make it easier to write about the people I met and the conversations I had. I used the hippie-expand module to complete names from my Big Brother Database addressbook, and I wrote a function that converted those names into links to people&#039;s blogs or websites whenever I published my blog posts as HTML.</p>
<p>I switched to Wordpress for my blog because I got tired of trying to figure out a way to enable comments without getting mired in spam-fighting. That meant I could explore other Emacs personal information managers like Org, which I turned into my main task manager. I often used the Wordpress interface to write blog posts. I sometimes used Windows Live Writer to write posts about books (there&#039;s a good book review plugin that makes this easy). I also sometimes used Emacs and Org to draft blog posts using Org&#039;s friendlier markup, exporting snippets to HTML that I then pasted into my blog posts.</p>
<p>Reading the posts on <a href="http://planet.emacsen.org">Planet Emacsen</a> reminded me that my customized configuration was pretty darn sweet. That and the conversation notes I&#039;ve been blogging lately encouraged me to dust off my configuration files and get them to work under Org. So here&#039;s the code:</p>
<pre>
 (defun sacha/org-bbdb-get (path)
   "Return BBDB record for PATH."
   (car (bbdb-search (bbdb-records) path path path)))

 (defun sacha/org-bbdb-export (path desc format)
   "Create the export version of a BBDB link specified by PATH or DESC.
 If exporting to HTML, it will be linked to the person's blog,
 www, or web address. If exporting to LaTeX FORMAT the link will be
 italicised. In all other cases, it is left unchanged."
     (cond
      ((eq format 'html)
       (let* ((record
             (sacha/org-bbdb-get path))
            url)
       (setq url (and record
                      (or (bbdb-record-getprop record 'blog)
                          (bbdb-record-getprop record 'www)
                          (bbdb-record-getprop record 'web))))
       (if url
           (format "&lt;a href=\"%s\"&gt;%s&lt;/a&gt;"
                   url (or desc path))
         (format "&lt;em&gt;%s&lt;/em&gt;"
                 (or desc path)))))
      ((eq format 'latex) (format "\\textit{%s}" (or desc path)))
      (t (or desc path))))

 (defadvice org-bbdb-export (around sacha activate)
   "Override org-bbdb-export."
   (setq ad-return-value (sacha/org-bbdb-export path desc format)))

 ;;;_+ Hippie expansion for BBDB; map M-/ to hippie-expand for most fun
 (add-to-list 'hippie-expand-try-functions-list 'sacha/try-expand-bbdb-annotation)
 (defun sacha/try-expand-bbdb-annotation (old)
   "Expand from BBDB. If OLD is non-nil, cycle through other possibilities."
   (unless old
     ;; First time, so search through BBDB records for the name
     (he-init-string (he-dabbrev-beg) (point))
     (when (&gt; (length he-search-string) 0)
       (setq he-expand-list nil)
       (mapcar
        (lambda (item)
        (let ((name (bbdb-record-name item)))
          (when name
            (setq he-expand-list
                  (cons (org-make-link-string
                       (org-make-link "bbdb:" name)
                       name)
                        he-expand-list)))))
        (bbdb-search (bbdb-records)
                     he-search-string
                     he-search-string
                     he-search-string
                     nil nil))))
   (while (and he-expand-list
               (or (not (car he-expand-list))
                   (he-string-member (car he-expand-list) he-tried-table t)))
     (setq he-expand-list (cdr he-expand-list)))
   (if (null he-expand-list)
       (progn
         (if old (he-reset-string))
         nil)
     (progn
       (he-substitute-string (car he-expand-list) t)
       (setq he-expand-list (cdr he-expand-list))
       t)))
</pre>
<p>If you&#039;ve got Org and BBDB, drop this into your ~/.emacs and fiddle with it. =)
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/12/18/emacs-org-and-bbdb-hyperlinking-names-to-blogs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Emacs w3m: Open pages in external browsers</title>
		<link>http://sachachua.com/wp/2008/09/13/emacs-w3m-open-pages-in-external-browsers/</link>
		<comments>http://sachachua.com/wp/2008/09/13/emacs-w3m-open-pages-in-external-browsers/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 13:26:51 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[wickedcoolemacs]]></category>
		<category><![CDATA[w3m]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5138</guid>
		<description><![CDATA[
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 ~/.emacs:

(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."
 [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5138"><!-- &nbsp; --></abbr>
<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&#039;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="http://sachachua.com/wp/category/wickedcoolemacs">book that I&#039;m writing about Emacs</a>, which will be published by No Starch Press if I manage to get it together in time.
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/emacs' rel='tag' target='_self'>emacs</a>, <a class='technorati-link' href='http://technorati.com/tag/w3m' rel='tag' target='_self'>w3m</a>, <a class='technorati-link' href='http://technorati.com/tag/wickedcoolemacs' rel='tag' target='_self'>wickedcoolemacs</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/09/13/emacs-w3m-open-pages-in-external-browsers/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Emacs and w3m: Making tabbed browsing easier</title>
		<link>http://sachachua.com/wp/2008/09/12/emacs-and-w3m-making-tabbed-browsing-easier/</link>
		<comments>http://sachachua.com/wp/2008/09/12/emacs-and-w3m-making-tabbed-browsing-easier/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 12:43:41 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[wickedcoolemacs]]></category>
		<category><![CDATA[w3m]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/2008/09/12/emacs-and-w3m-making-tabbed-browsing-easier/</guid>
		<description><![CDATA[
If you browse with a lot of open tabs, like I do, w3m will be much easier to use once you remap w3m-next-buffer and w3m-previous-buffer onto single-key shortcuts, allowing you to press a key to quickly flip between tabs.
By default, w3m-previous-buffer is mapped to C-c C-p and w3m-next-buffer is mapped to C-c C-n. On a [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5137"><!-- &nbsp; --></abbr>
<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&#039;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="http://sachachua.com/wp/category/wickedcoolemacs">book on Emacs</a>, to be published by No Starch Press if I&#039;m not too late.)
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/emacs' rel='tag' target='_self'>emacs</a>, <a class='technorati-link' href='http://technorati.com/tag/w3m' rel='tag' target='_self'>w3m</a>, <a class='technorati-link' href='http://technorati.com/tag/wickedcoolemacs' rel='tag' target='_self'>wickedcoolemacs</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/09/12/emacs-and-w3m-making-tabbed-browsing-easier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Emacs: Jump to anything</title>
		<link>http://sachachua.com/wp/2008/09/05/emacs-jump-to-anything/</link>
		<comments>http://sachachua.com/wp/2008/09/05/emacs-jump-to-anything/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 13:51:52 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/2008/09/05/emacs-jump-to-anything/</guid>
		<description><![CDATA[
I just came across the Anything extension for Emacs. After you load anything.el, you can type M-x anything RET and a substring of, well, anything. Looks like a handy shortcut. It&#039;s like Quicksilver, but for Emacs. Grab anything-config.el for a bunch of useful functions.
Here&#039;s my current configuration:

(require 'anything)
(require 'anything-config)
(setq anything-sources
      [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5117"><!-- &nbsp; --></abbr>
<p>I just came across the <a href="http://www.emacswiki.org/cgi-bin/wiki/Anything">Anything</a> extension for Emacs. After you load anything.el, you can type M-x anything RET and a substring of, well, anything. Looks like a handy shortcut. It&#039;s like Quicksilver, but for Emacs. Grab <a href="http://www.emacswiki.org/cgi-bin/wiki/download/anything-config.el">anything-config.el</a> for a bunch of useful functions.</p>
<p>Here&#039;s my current configuration:</p>
<pre>
(require 'anything)
(require 'anything-config)
(setq anything-sources
      (list anything-c-source-buffers
            anything-c-source-file-name-history
            anything-c-source-info-pages
            anything-c-source-man-pages
	    anything-c-source-file-cache
            anything-c-source-emacs-commands))
(global-set-key (kbd "M-X") 'anything)
</pre>
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/09/05/emacs-jump-to-anything/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Emacs and W3M: Toggling between work and the Web</title>
		<link>http://sachachua.com/wp/2008/08/27/emacs-and-w3m-toggling-between-work-and-the-web/</link>
		<comments>http://sachachua.com/wp/2008/08/27/emacs-and-w3m-toggling-between-work-and-the-web/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 12:24:12 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[wickedcoolemacs]]></category>
		<category><![CDATA[w3m]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5088</guid>
		<description><![CDATA[
Here&#039;s a handy shortcut that toggles between the W3M web browser and other buffers you&#039;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).
Define the function by adding the following code to your ~/.emacs:

(defun wicked/toggle-w3m ()
  "Switch to [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5088"><!-- &nbsp; --></abbr>
<p>Here&#039;s a handy shortcut that toggles between the W3M web browser and other buffers you&#039;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&#039;re working on.
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/emacs' rel='tag' target='_self'>emacs</a>, <a class='technorati-link' href='http://technorati.com/tag/w3m' rel='tag' target='_self'>w3m</a>, <a class='technorati-link' href='http://technorati.com/tag/wickedcoolemacs' rel='tag' target='_self'>wickedcoolemacs</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/08/27/emacs-and-w3m-toggling-between-work-and-the-web/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Emacs and w3m: Fake your user agent</title>
		<link>http://sachachua.com/wp/2008/08/19/emacs-and-w3m-fake-your-user-agent/</link>
		<comments>http://sachachua.com/wp/2008/08/19/emacs-and-w3m-fake-your-user-agent/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 23:49:14 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[wickedcoolemacs]]></category>
		<category><![CDATA[emacs-lisp]]></category>
		<category><![CDATA[user-agent]]></category>
		<category><![CDATA[w3m]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5076</guid>
		<description><![CDATA[

In an ideal world, you would never need to make your browser pretend to be a different browser. In reality, a number of websites check for specific browsers such as Mozilla or Internet Explorer, or even specific versions of those browsers. Other websites check for popular search engine crawlers such as the Googlebot in order [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5076"><!-- &nbsp; --></abbr>
<p>
In an ideal world, you would never need to make your browser pretend to be a different browser. In reality, a number of websites check for specific browsers such as Mozilla or Internet Explorer, or even specific versions of those browsers. Other websites check for popular search engine crawlers such as the Googlebot in order to display content optimized for that search engine. You may want to change your user agent to work around such limitations, or you might want to change your user agent string just for fun.
</p>
<p>
The following code allows you to set your user agent (wicked/w3m-set-user-agent), reload the current page using a specified user agent (wicked/w3m-reload-this-page-with-user-agent), and define regular expression matches for URLs to control user agent strings (wicked/w3m-fake-user-agent-sites). To use this, add the following to your ~/.emacs:
</p>
<p><pre class="example">
 (defvar wicked/w3m-fake-user-agents ;; (1)
   `(("w3m" . ,(concat "Emacs-w3m/" emacs-w3m-version " " w3m-version))
     ("ie6" . "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)")
     ("ff3" . "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1")
     ("ff2" . "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080208 Firefox/2.0.0.13")
     ("ie7" . "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)")
     ("ie5.5" . "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)")
     ("iphone" . "Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_0 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5A347 Safari/525.20")
     ("safari" . "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; en-us) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13")
     ("google" . "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"))
   "*Associative list of user agent names and strings.")

 (defvar wicked/w3m-fake-user-agent-sites ;; (2)
   '(("^https?://www\\.useragentstring\\.com" . "ff2"))
   "*Associative list of regular expressions matching URLs and the agent keyword or value.
 The first matching entry will be used.")

 (defun wicked/w3m-set-user-agent (agent)
   "Set the user agent to AGENT based on `wicked/w3m-fake-user-agents'.
 If AGENT is not defined in `wicked/w3m-fake-user-agents', it is used as the user agent.
 If AGENT is empty, the default w3m user agent will be used."
   (interactive
    (list
     (completing-read "User-agent [w3m]: "
                    (mapcar 'car wicked/w3m-fake-user-agents)
                    nil nil nil nil "w3m"))) ;; (3)
   (if agent
       (progn
        (setq w3m-user-agent
              (or
               (and (string= agent "") (assoc "w3m" wicked/w3m-fake-user-agents)) ;; (4)
               (cdr (assoc agent wicked/w3m-fake-user-agents)) ;; (5)
               agent)) ;; (6)
        (setq w3m-add-user-agent t))
     (setq w3m-add-user-agent nil)))

 (defun wicked/w3m-reload-this-page-with-user-agent (agent)
   "Browse this page using AGENT based on `wicked/w3m-fake-user-agents'.
 If AGENT is not defined in `wicked/w3m-fake-user-agents', it is used as the user agent.
 If AGENT is empty, the default w3m user agent will be used."
   (interactive (list (completing-read "User-agent [w3m]: "
                    (mapcar 'car wicked/w3m-fake-user-agents)
                    nil nil nil nil "w3m")))
   (let ((w3m-user-agent w3m-user-agent)
       (w3m-add-user-agent w3m-add-user-agent))
     (wicked/w3m-set-user-agent agent) ;; (7)
     (w3m-reload-this-page)))

 (defadvice w3m-header-arguments (around wicked activate) ;; (8)
   "Check `wicked/w3m-fake-user-agent-sites' for fake user agent definitions."
   (let ((w3m-user-agent w3m-user-agent)
         (w3m-add-user-agent w3m-add-user-agent)
         (sites wicked/w3m-fake-user-agent-sites))
     (while sites
       (if (string-match (caar sites) (ad-get-arg 1))
         (progn
           (wicked/w3m-set-user-agent (cdar sites))
           (setq sites nil))
       (setq sites (cdr sites))))
     ad-do-it))
</pre>
</p>
<p>
wicked/w3m-fake-user-agents sets up a number of common user agents(1) using examples from <a href="http://www.useragentstring.com">http://www.useragentstring.com</a>. If you frequently use other user agents, add them to this associative list. wicked/w3m-fake-user-agent-sites sets up some rules for URLs so that you can work around specific websites(2). The first matching rule will be used.
</p>
<p>
wicked/w3m-set-user-agent can be called from a w3m browser session to set the user agent for all new pages visited. By default, it uses the w3m user agent(3). It will also use the w3m user agent if the agent is blank(4). If the user agent is one of the frequently-used agents defined in wicked/w3m-fake-user-agents, then the corresponding user agent string will be used(5). If not, the string will be used as-is(6). If the agent is nil, the user agent string will be disabled.(7)
</p>
<p>
You can check a single page using a different user agent by using M-x wicked/w3m-reload-this-page-with-user-agent. It temporarily sets the user agent and then reloads the current page.(7)
</p>
<p>
The last segment of code modifies the behavior of w3m-header-arguments(8), matching wicked/w3m-fake-user-agents against the URL. This temporarily sets the user agent for matching sites.
</p>
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/emacs-lisp' rel='tag' target='_self'>emacs-lisp</a>, <a class='technorati-link' href='http://technorati.com/tag/user-agent' rel='tag' target='_self'>user-agent</a>, <a class='technorati-link' href='http://technorati.com/tag/w3m' rel='tag' target='_self'>w3m</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/08/19/emacs-and-w3m-fake-your-user-agent/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Emacs and w3m: Quick searches</title>
		<link>http://sachachua.com/wp/2008/08/18/emacs-and-w3m-quick-searches/</link>
		<comments>http://sachachua.com/wp/2008/08/18/emacs-and-w3m-quick-searches/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 02:14:59 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5072</guid>
		<description><![CDATA[
A number of browsers allow you to define quick searches so that you can type keywords into your address bar in order to search predetermined sites. With a little bit of code, you can do this in Emacs, too. In this project, you&#039;ll learn how to set up your own keywords to work with w3m [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5072"><!-- &nbsp; --></abbr>
<p>A number of browsers allow you to define quick searches so that you can type keywords into your address bar in order to search predetermined sites. With a little bit of code, you can do this in Emacs, too. In this project, you&#039;ll learn how to set up your own keywords to work with w3m and browse-url, so you can use your keywords for browsing both inside and outside Emacs.</p>
<p>First, set up keywords by adding the following lines to your ~/.emacs. We&#039;ll use an associative list of regular expressions and substitutions, like this:</p>
<pre>
(setq wicked/quick-search-alist
      '((&quot;^g?:? +\\(.*\\)&quot; . ;; Google Web
         &quot;http://www.google.com/search?q=\\1&quot;)

        (&quot;^g!:? +\\(.*\\)&quot; . ;; Google Lucky
         &quot;http://www.google.com/search?btnI=I%27m+Feeling+Lucky&amp;q=\\1&quot;)

	(&quot;^dict:? +\\(.*\\)&quot; . ;; Dictionary
	 &quot;http://dictionary.reference.com/search?q=\\1&quot;)))
</pre>
<p>This will turn &quot;g keyword1 keyword2&quot; into a Google search for keyword1 and keyword2.</p>
<p>Next, define advice for the functions that open URLs. Before-type advice allows you to modify arguments before the function is run, and we&#039;ll use that to change the URLs. To modify the URL behavior of w3m, add the following to your ~/.emacs:</p>
<pre>
(require 'cl-seq)
(defadvice w3m-goto-url (before wicked activate)
  &quot;Use the quick searches defined in `wicked/quick-search-alist'.&quot;
  (let* ((my-url (replace-regexp-in-string
		  &quot;^ *\\| *$&quot; &quot;&quot;
		  (replace-regexp-in-string &quot;[ \t\n]+&quot; &quot; &quot; (ad-get-arg 0))))
	 (match (assoc-if
		 (lambda (a) (string-match a my-url))
		 wicked/quick-search-alist)))
    (if match
	(ad-set-arg 0 (replace-regexp-in-string
		       (car match) (cdr match) my-url)))))
</pre>
<p>This sets up your quick searches for use within w3m. To set up quick searches for use with browse-url and external browsers, add the following to your ~/.emacs:</p>
<pre>
(defadvice browse-url (before wicked activate)
  &quot;Use the quick searches defined in `wicked/quick-search-alist'.&quot;
  (let* ((my-url (replace-regexp-in-string
		  &quot;^ *\\| *$&quot; &quot;&quot;
		  (replace-regexp-in-string &quot;[ \t\n]+&quot; &quot; &quot; (ad-get-arg 0))))
	 (match (assoc-if
		 (lambda (a) (string-match a my-url))
		 wicked/quick-search-alist)))
    (if match
	(ad-set-arg 0 (replace-regexp-in-string
		       (car match) (cdr match) my-url)))))
</pre>
<p>To try out your searches, use M-x browse-url RET g emacs RET to do a Google search for all things Emacs, and use M-x w3m-goto-url (usually bound to g) inside w3m to use the quick searches.</p>
<p>You can define more quick searches like this:</p>
<pre>
(add-to-list 'wicked/quick-search-alist
          '(&quot;^ew:? *?\\(.*\\)&quot; . ;; Emacs Wiki Search
            &quot;http://www.emacswiki.org/cgi-bin/wiki?search=\\1&quot;))
</pre>
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/08/18/emacs-and-w3m-quick-searches/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sweet! Facebook in Emacs!</title>
		<link>http://sachachua.com/wp/2008/08/12/sweet-facebook-in-emacs/</link>
		<comments>http://sachachua.com/wp/2008/08/12/sweet-facebook-in-emacs/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 01:18:50 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5066</guid>
		<description><![CDATA[
So here&#039;s how to access Facebook from w3m, one of the web browsers in
Emacs:
1. Enable cookies by setting w3m-use-cookies to t.
2. Go to http://m.facebook.com .
3. Choose the HTTP login.
4. Log in with your username and password.
Hooray for mobile interfaces that don&#039;t require Javascript! =D
So far, it seems to work. I can update my status! Sweet!
Next [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5066"><!-- &nbsp; --></abbr>
<p>So here&#039;s how to access Facebook from w3m, one of the web browsers in<br />
Emacs:</p>
<p>1. Enable cookies by setting w3m-use-cookies to t.<br />
2. Go to http://m.facebook.com .<br />
3. Choose the HTTP login.<br />
4. Log in with your username and password.</p>
<p>Hooray for mobile interfaces that don&#039;t require Javascript! =D</p>
<p>So far, it seems to work. I can update my status! Sweet!</p>
<p>Next step: Figure out how to set up shimbun for Facebook mail so that I can read my Facebook mail like a newsgroup&#8230;</p>
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/facebook' rel='tag' target='_self'>facebook</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/08/12/sweet-facebook-in-emacs/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Why browse the Web in Emacs?</title>
		<link>http://sachachua.com/wp/2008/08/12/why-browse-the-web-in-emacs/</link>
		<comments>http://sachachua.com/wp/2008/08/12/why-browse-the-web-in-emacs/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 00:57:20 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[wickedcoolemacs]]></category>
		<category><![CDATA[browsing]]></category>
		<category><![CDATA[w3]]></category>
		<category><![CDATA[w3m]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5064</guid>
		<description><![CDATA[
&#034;Are you browsing Slashdot in Emacs?&#034;, W- asked me after he glanced at my screen.
With Emacs&#039; reputation for including everything _and_ the kitchen sink, you probably won&#039;t be surprised to hear that there&#039;s more than one way to surf the Internet using your text editor. With today&#039;s Javascript- and image-heavy websites, it can be hard [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5064"><!-- &nbsp; --></abbr>
<p>&#034;Are you browsing Slashdot in Emacs?&#034;, W- asked me after he glanced at my screen.</p>
<p>With Emacs&#039; reputation for including everything _and_ the kitchen sink, you probably won&#039;t be surprised to hear that there&#039;s more than one way to surf the Internet using your text editor. With today&#039;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.<br />
 If you need to see something that Emacs doesn&#039;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 qucikly look up information on the Web based on what you&#039;re currently working on. For example, PHP mode comes with a shortcut that lets you look up the current function&#039;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&#039;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&#039;ll appreciate having your own shortcuts and functions. For example, I&#039;ve completely remapped my keyboard shortcuts to support tabbed browsing on a Dvorak keyboard, and I&#039;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&#039;re interested in or make pages more navigable. It&#039;s all just Emacs Lisp.</li>
<li><b>You&#039;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&#039;ve got Emacs open anyway?</li>
</ul>
<p>There&#039;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="http://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>
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/browsing' rel='tag' target='_self'>browsing</a>, <a class='technorati-link' href='http://technorati.com/tag/emacs' rel='tag' target='_self'>emacs</a>, <a class='technorati-link' href='http://technorati.com/tag/w3' rel='tag' target='_self'>w3</a>, <a class='technorati-link' href='http://technorati.com/tag/w3m' rel='tag' target='_self'>w3m</a>, <a class='technorati-link' href='http://technorati.com/tag/wickedcoolemacs' rel='tag' target='_self'>wickedcoolemacs</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/08/12/why-browse-the-web-in-emacs/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Drupal, Emacs, and templates: Module update functions</title>
		<link>http://sachachua.com/wp/2008/08/06/drupal-emacs-and-templates-module-update-functions/</link>
		<comments>http://sachachua.com/wp/2008/08/06/drupal-emacs-and-templates-module-update-functions/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 19:00:46 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[yasnippet]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5044</guid>
		<description><![CDATA[
Drupal&#039;s coding conventions make it easier to hook into system behavior, but they also result in a lot of repetitive typing. For example, you can run code when upgrading a module by putting the code in a function named modulename_update_N() in your module&#039;s install file. I found myself scrolling up and copy-pasting stuff too many [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5044"><!-- &nbsp; --></abbr>
<p>Drupal&#039;s coding conventions make it easier to hook into system behavior, but they also result in a lot of repetitive typing. For example, you can run code when upgrading a module by putting the code in a function named <i>modulename</i>_update_<i>N</i>() in your module&#039;s install file. I found myself scrolling up and copy-pasting stuff too many times, so I decided to automate it instead.</p>
<p>I&#039;ve been using <a href="http://sachachua.com/wp/2008/07/26/yet-another-snippet-mode-for-emacs/">yasnippet</a> for my Emacs templates. All I needed to do to automate that little update bit was to write some code that figured out what the next update number should be. Here&#039;s the snippet file I&#039;ve just added (~/elisp/snippets/php-mode/drupal-mode/_update):</p>
<pre>
function `(sacha/drupal-module-name)`_update_`(sacha/drupal-module-update-number)`() {
  $ret = array();
  $0
  $ret[] = array(
    'success' => true,
    'query' => '$1',
  );
  return $ret;
}
</pre>
<p>The relevant functions from my ~/.emacs:</p>
<pre>
(defun sacha/drupal-module-update-number ()
  "Return the number of the next module update function.
This is one more than the highest number used so far.
This function should be called in a module's .install file."
  (save-excursion
    (save-restriction
      (widen)
      (goto-char (point-min))
      (let ((module-name (sacha/drupal-module-name))
	    (max 0))
	(while (re-search-forward
		(concat "function[ \t\n]+" module-name "_update_\\([0-9]+\\)") nil t)
	  (setq max (max (string-to-number (match-string 1)) max)))
	(number-to-string (1+ max))))))

(defun sacha/drupal-module-name ()
  "Return the Drupal module name for .module and .install files."
  (file-name-sans-extension (file-name-nondirectory (buffer-file-name))))
</pre>
<p>I can&#039;t think of how I&#039;d do that in Eclipse. =) Don&#039;t get me wrong&#8211;I still like Eclipse&#8211;but I heart being able to hack my editor on the fly.
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/template' rel='tag' target='_self'>template</a>, <a class='technorati-link' href='http://technorati.com/tag/yasnippet' rel='tag' target='_self'>yasnippet</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/08/06/drupal-emacs-and-templates-module-update-functions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Emacs and Gnus: zomg, new chapter out the door!</title>
		<link>http://sachachua.com/wp/2008/08/04/emacs-and-gnus-zomg-new-chapter-out-the-door/</link>
		<comments>http://sachachua.com/wp/2008/08/04/emacs-and-gnus-zomg-new-chapter-out-the-door/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 18:25:34 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnus]]></category>
		<category><![CDATA[wickedcoolemacs]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/2008/08/04/emacs-and-gnus-zomg-new-chapter-out-the-door/</guid>
		<description><![CDATA[
So I _finally_ pulled everything together and got my Gnus chapter out the door. Hooray, hooray, hooray!

Reading Mail with Gnus (PDF)
Reading Mail with Gnus (HTML), produced by Org

Disclaimers: It&#039;s rough, it probably makes a few assumptions about whatever version of Emacs I&#039;m running, it&#039;s probably missing your favorite tips (and I&#039;d love to add them!), [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5036"><!-- &nbsp; --></abbr>
<p>So I _finally_ pulled everything together and got my Gnus chapter out the door. Hooray, hooray, hooray!</p>
<ul>
<li><a href="http://sachachua.com/notebook/wickedcool/wc-emacs-05-gnus.pdf">Reading Mail with Gnus (PDF)</a></li>
<li><a href="http://sachachua.com/notebook/wickedcool/wc-emacs-05-gnus.html">Reading Mail with Gnus (HTML)</a>, produced by Org</li>
</ul>
<p>Disclaimers: It&#039;s rough, it probably makes a few assumptions about whatever version of Emacs I&#039;m running, it&#039;s probably missing your favorite tips (and I&#039;d love to add them!), and it probably has typos. Meep. But it&#039;s out there!</p>
<p>Hooray, hooray, hooray!</p>
<p>Next step: write about web-browsing in Emacs&#8230;
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/08/04/emacs-and-gnus-zomg-new-chapter-out-the-door/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Emacs: Caps lock as M-x</title>
		<link>http://sachachua.com/wp/2008/08/04/emacs-caps-lock-as-m-x/</link>
		<comments>http://sachachua.com/wp/2008/08/04/emacs-caps-lock-as-m-x/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 10:59:02 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/2008/08/04/emacs-caps-lock-as-m-x/</guid>
		<description><![CDATA[
Inspired by Lennart Borgman&#039;s recent post on help.gnu.emacs about binding Caps Lock to M-x on Microsoft Windows, I set my system up with the Linux equivalent.
To make Caps Lock a shortcut for M-x, add the following lines to your ~/.emacs:

(if (eq window-system 'x)
    (shell-command "xmodmap -e 'clear Lock' -e 'keycode 66 = [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5034"><!-- &nbsp; --></abbr>
<p>Inspired by Lennart Borgman&#039;s recent post on help.gnu.emacs about <a href="http://groups.google.com/group/gnu.emacs.help/msg/5196ae31694b6052">binding Caps Lock to M-x on Microsoft Windows</a>, I set my system up with the Linux equivalent.</p>
<p>To make Caps Lock a shortcut for M-x, add the following lines to your ~/.emacs:</p>
<pre>
(if (eq window-system 'x)
    (shell-command "xmodmap -e 'clear Lock' -e 'keycode 66 = F13'"))
(global-set-key [f13] 'execute-extended-command)
</pre>
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/08/04/emacs-caps-lock-as-m-x/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Emacs and PHP: On-the-fly syntax checking with Flymake</title>
		<link>http://sachachua.com/wp/2008/07/31/emacs-and-php-on-the-fly-syntax-checking-with-flymake/</link>
		<comments>http://sachachua.com/wp/2008/07/31/emacs-and-php-on-the-fly-syntax-checking-with-flymake/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 10:50:22 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[flymake]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/?p=5021</guid>
		<description><![CDATA[
The dreaded white screen of nothingness usually means that I&#039;ve misplaced a quotation mark or brace somewhere in my PHP code. On-the-fly syntax checking in Eclipse helped me find those errors quickly because I could scan the right scrollbar for areas marked with red. I knew that shifting to Emacs wouldn&#039;t automatically cure me of [...]<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="http://sachachua.com/wp/?p=5021"><!-- &nbsp; --></abbr>
<p>The dreaded white screen of nothingness usually means that I&#039;ve misplaced a quotation mark or brace somewhere in my PHP code. On-the-fly syntax checking in Eclipse helped me find those errors quickly because I could scan the right scrollbar for areas marked with red. I knew that shifting to Emacs wouldn&#039;t automatically cure me of the propensity to mismatch my parentheses. If I could get on-the-fly syntax checking working in Emacs, I&#039;d save myself a lot of time.</p>
<p>It took me a while to sort out various configuration problems. Most were due to the fact that PHP didn&#039;t report parse errors with my original configuration, even though I had uncommented the line after &#034;Show only errors&#034;. As it turned out, the error_reporting option in php.ini needs to include E_PARSE in order for php to report parsing error details. Here&#039;s the value I&#039;m currently using in /etc/php.ini:</p>
<pre>
error_reporting = E_ERROR|E_COMPILE_ERROR|E_CORE_ERROR|E_PARSE
</pre>
<p>Flymake is the package responsible for on-the-fly syntax checking in Emacs. Out of the box, it supports C, C++, XML, XHTML, Perl, Java, TeX, and IDL. To load Flymake and add support for PHP, add the following to your ~/.emacs:</p>
<pre>
(require 'flymake)

(defun flymake-php-init ()
  "Use php to check the syntax of the current file."
  (let* ((temp (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))
	 (local (file-relative-name temp (file-name-directory buffer-file-name))))
    (list "php" (list "-f" local "-l"))))

(add-to-list 'flymake-err-line-patterns
  '("\\(Parse\\|Fatal\\) error: +\\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2))

(add-to-list 'flymake-allowed-file-name-masks '("\\.php$" flymake-php-init))

;; Drupal-type extensions
(add-to-list 'flymake-allowed-file-name-masks '("\\.module$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.install$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.inc$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.engine$" flymake-php-init))

(add-hook 'php-mode-hook (lambda () (flymake-mode 1)))
(define-key php-mode-map '[M-S-up] 'flymake-goto-prev-error)
(define-key php-mode-map '[M-S-down] 'flymake-goto-next-error)
</pre>
<p>Evaluate that code, open one of your PHP files, and intentionally break it. The syntax error should be highlighted. To change the highlighting, move your point to the error and type M-x customize-face. Accept the default (flymake-errline), then customize it as desired. Don&#039;t forget to save your customizations for future sessions.</p>
<p>If your syntax errors are not highlighted and you get a message like this:</p>
<pre>
Configuration error occured while running (php -f test_flymake.php -l). flymake will be switched OFF
</pre>
<p>double-check your /etc/php.ini to make sure that E_PARSE is included as one of the options for error_reporting. You can check the output by running <kbd>php -f <i>yourfile.php</i> -l</kbd>. You should see the line number of the parse error. Make sure that this matches the regular expression added to flymake-err-line-patterns in your ~/.emacs. If your PHP returns a slightly different message, modify your flymake-err-line-patterns accordingly.</p>
<p>Flymake can save you a lot of programmer frustration for the cost of a little CPU time. Use it to check for errors before you save files or commit them to your source code control repository, and you and other developers will be much happier.</p>
<p>(UPDATE: Fixed typo in flymake-php-init)
<p>Post from: <a href="http://sachachua.com/wp">sacha chua :: enterprise 2.0 consultant, storyteller, geek</a>.<br />
Check out my blog for tips on <a href="http://sachachua.com/wp/category/va">managing virtual assistants</a>, <a href="http://sachachua.com/wp/category/drupal">Drupal</a>, and other topics!</p>

<!-- start wp-tags-to-technorati 0.95 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/emacs' rel='tag' target='_self'>emacs</a>, <a class='technorati-link' href='http://technorati.com/tag/flymake' rel='tag' target='_self'>flymake</a>, <a class='technorati-link' href='http://technorati.com/tag/php' rel='tag' target='_self'>php</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/07/31/emacs-and-php-on-the-fly-syntax-checking-with-flymake/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
