<?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>Emacs中文网 &#187; 截图</title>
	<atom:link href="http://emacser.com/t-screenshots.htm/feed" rel="self" type="application/rss+xml" />
	<link>http://emacser.com</link>
	<description>没有我做不到的，只有你想不到的</description>
	<lastBuildDate>Fri, 12 Aug 2011 12:56:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Emacs中的Evernote: evernote-mode</title>
		<link>http://emacser.com/evernote-mode.htm</link>
		<comments>http://emacser.com/evernote-mode.htm#comments</comments>
		<pubDate>Mon, 25 Apr 2011 08:00:00 +0000</pubDate>
		<dc:creator>fangzhzh</dc:creator>
				<category><![CDATA[中级]]></category>
		<category><![CDATA[其他]]></category>
		<category><![CDATA[ann]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[ede]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[emacser]]></category>
		<category><![CDATA[emacser.com]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[erc]]></category>
		<category><![CDATA[evernote]]></category>
		<category><![CDATA[evernote-mode]]></category>
		<category><![CDATA[face]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[notetaking]]></category>
		<category><![CDATA[onenote]]></category>
		<category><![CDATA[org]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[光标]]></category>
		<category><![CDATA[截图]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[浏览器]]></category>
		<category><![CDATA[邮件客户端]]></category>
		<category><![CDATA[配色]]></category>

		<guid isPermaLink="false">http://emacser.com/?p=41831</guid>
		<description><![CDATA[曾经有一段信息摆到我眼前,可是我没有珍惜.直到失去我才后悔莫及.
如果上天能给我一个重来的机会,我希望将那段信息记为笔记,如果非要在这条笔记上加个期限,我希望是一万年.

  

表格修改: @2011/08/05 17:39:59
简单的英文翻译就不会标出，标出内容变动。

 我这人向来不喜欢凑热闹,大家都喜欢的姑娘我从来都不会去追,大家都说好的电影我从来不去看,按现在流行语说,就是zhuangbility. 哈哈. 但是,最近很火1的Evernote  ,我确实很是喜爱,忍不住也来说分享一下自己使用Evernote  的经验. 
 本文会先介绍Evernote  是什么,Evernote  与其它主流笔记软件的比较并说明其优点,然后讨论一些记录Evernote  笔记的方法,然后介绍将Evernote  和Emacs两大神器结合起来的方法,最后介绍Evernote  强大的搜索功能. 
   

Evernote 
   

Evernote  是什么 

Evernote  是一套用来记笔记和查询笔记的软件和服务.Evernote  中的笔记可以是一段文字,一个网页或网页片断,一幅图片,声音,或者手绘墨迹,而且笔记可以有PDF之类的附件. 已有笔记可以支持以下搜索方式:文件夹,标签,是否有附件,是否有图片,是否email发送,是否是todo,据说,搜索还可以支持搜索图片内的文字. 可谓,功能强大,同时,方便易用,实乃是居家旅行,看书学习必备之工具. 
 Evernote  有免费版和专业版.Evernote  免费版每个月提供60M上传流量(即上传的笔记总大小不能超过60M),如果需要更多上传流量可以考虑付费版.不过就我个人经验,对于普通用户来说,60M的流量,内容大都为纯文字和图片的话,足足够用.此外,我认为笔记的内容最好只有文字和图片,不要使用doc和pdf之类的附件:第一,Evernote  比较强大的搜索功能对此类附件无效,使用附件的话既浪费了Evernote  最强大的搜索功能,又占据了大部分的上传流量,所以如果这些文档比较多,我建议此类附件还是放到Dropbox或者Sugarsync;第二个,也是更重要的不要使用附件的原因就是云存储,具体见下节. 
 因为我使用的是Window XP,所以手头只有evernote windows版的尊容,欢迎其它平台的用户截图发给我:) [...]]]></description>
			<content:encoded><![CDATA[<pre class="example">曾经有一段信息摆到我眼前,可是我没有珍惜.直到失去我才后悔莫及.
如果上天能给我一个重来的机会,我希望将那段信息记为笔记,如果非要在这条笔记上加个期限,我希望是一万年.
</pre>
<p> <img src="https://dea.googlecode.com/svn/trunk/screenshots/evernote/evernote-logo.jpg" align="right" alt="https://dea.googlecode.com/svn/trunk/screenshots/evernote/evernote-logo.jpg" /> </p>
<p>
<b>表格修改: @2011/08/05 17:39:59</b><br />
<b>简单的英文翻译就不会标出，标出内容变动。</b>
</p>
<p> 我这人向来不喜欢凑热闹,大家都喜欢的姑娘我从来都不会去追,大家都说好的电影我从来不去看,按现在流行语说,就是zhuangbility. 哈哈. 但是,最近很火<sup><a class="footref" name="fnr.1" href="#fn.1">1</a></sup>的<a href="http://www.evernote.com/" target="_blank">Evernote</a>  ,我确实很是喜爱,忍不住也来说分享一下自己使用<a href="http://www.evernote.com/" target="_blank">Evernote</a>  的经验. </p>
<p> 本文会先介绍<a href="http://www.evernote.com/" target="_blank">Evernote</a>  是什么,<a href="http://www.evernote.com/" target="_blank">Evernote</a>  与其它主流笔记软件的比较并说明其优点,然后讨论一些记录<a href="http://www.evernote.com/" target="_blank">Evernote</a>  笔记的方法,然后介绍将<a href="http://www.evernote.com/" target="_blank">Evernote</a>  和<a href="http://www.gnu.org/software/emacs/" target="_blank">Emacs</a>两大神器结合起来的方法,最后介绍<a href="http://www.evernote.com/" target="_blank">Evernote</a>  强大的搜索功能. </p>
<p>   <span id="more-41831"></span>
<div id="outline-container-1" class="outline-3">
<h3 id="sec-1"><a href="http://www.evernote.com/" target="_blank">Evernote</a> </h3>
<div class="outline-text-3" id="text-1">   </div>
<div id="outline-container-1_1" class="outline-4">
<h4 id="sec-1_1"><a href="http://www.evernote.com/" target="_blank">Evernote</a>  是什么 </h4>
<div class="outline-text-4" id="text-1_1">
<p><a href="http://www.evernote.com/" target="_blank">Evernote</a>  是一套用来记笔记和查询笔记的软件和服务.<a href="http://www.evernote.com/" target="_blank">Evernote</a>  中的笔记可以是一段文字,一个网页或网页片断,一幅图片,声音,或者手绘墨迹,而且笔记可以有PDF之类的附件. 已有笔记可以支持以下搜索方式:文件夹,标签,是否有附件,是否有图片,是否email发送,是否是todo,据说,搜索还可以支持搜索图片内的文字. 可谓,功能强大,同时,方便易用,实乃是居家旅行,看书学习必备之工具. </p>
<p> <a href="http://www.evernote.com/" target="_blank">Evernote</a>  有免费版和专业版.<a href="http://www.evernote.com/" target="_blank">Evernote</a>  免费版每个月提供60M上传流量(即上传的笔记总大小不能超过60M),如果需要更多上传流量可以考虑付费版.不过就我个人经验,对于普通用户来说,60M的流量,内容大都为纯文字和图片的话,足足够用.此外,我认为笔记的内容最好只有文字和图片,不要使用doc和pdf之类的附件:第一,<a href="http://www.evernote.com/" target="_blank">Evernote</a>  比较强大的搜索功能对此类附件无效,使用附件的话既浪费了<a href="http://www.evernote.com/" target="_blank">Evernote</a>  最强大的搜索功能,又占据了大部分的上传流量,所以如果这些文档比较多,我建议此类附件还是放到<a href="http://www.dropbox.com/" target="_blank">Dropbox</a>或者<a href="https://www.sugarsync.com/" target="_blank">Sugarsync</a>;第二个,也是更重要的不要使用附件的原因就是云存储,具体见下节. </p>
<p> 因为我使用的是Window XP,所以手头只有evernote windows版的尊容,欢迎其它平台的用户截图发给我:) <img src="http://emacser.com/uploads/wpid-evernote-notes1.png"  alt="http://emacser.com/uploads/wpid-evernote-notes1.png" /> </p>
</p></div>
</p></div>
<div id="outline-container-1_2" class="outline-4">
<h4 id="sec-1_2">为什么选择<a href="http://www.evernote.com/" target="_blank">Evernote</a> </h4>
<div class="outline-text-4" id="text-1_2">
<p>为什么<a href="http://www.evernote.com/" target="_blank">Evernote</a>  是优秀的?首先,我们先看一组数据<sup><a class="footref" name="fnr.2" href="#fn.2">2</a></sup>.下表是笔记相关的软件们特性的对比. </p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption></caption>
<colgroup>
<col align="left" />
<col align="left" />
<col align="left" />
<col align="left" />
<col align="left" />
<col align="left" />
<col align="left" />
<col align="left" />
</colgroup>
<thead>
<tr>
<th scope="col">名称</th>
<th scope="col">遵循协议</th>
<th scope="col">平台</th>
<th scope="col">同步</th>
<th scope="col">键盘输入</th>
<th scope="col">支持笔和电子墨迹</th>
<th scope="col">打印</th>
<th scope="col">格式</th>
</tr>
</thead>
<tbody>
<tr>
<td>纸笔</td>
<td>无</td>
<td>纸笔,人肉记录</td>
<td>人肉</td>
<td>无</td>
<td>无</td>
<td>无</td>
<td>纸张</td>
</tr>
<tr>
<td>A.nnotate</td>
<td>免费和收费版本</td>
<td>基于网页</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>PDF, .doc, .docx, images, web pages</td>
</tr>
<tr>
<td>Adobe Reader</td>
<td>免费软件, <del>需要600法郎买一个专业版才能记笔记</del> 免费版Adobe Reader X已经可以记笔记和高亮</td>
<td>Linux, Windows, and Mac OS X</td>
<td>?</td>
<td>是</td>
<td>是, 但是需要插件： AutoInk plugin</td>
<td>是</td>
<td>PDF</td>
</tr>
<tr>
<td>AllMyNotes Organizer</td>
<td>免费版和收费版</td>
<td>Windows 2000/XP/Vista/Windows 7</td>
<td>?</td>
<td>是</td>
<td>否</td>
<td>是</td>
<td>专利，加密，支持从文本格式，RTF，图片的导入，支持导出为文本，html，rtf.</td>
</tr>
<tr>
<td>BasKet Note Pads</td>
<td>遵循GPL协议</td>
<td>Linux</td>
<td>否</td>
<td>是</td>
<td>否</td>
<td>否</td>
<td>富文本，可以到处为html</td>
</tr>
<tr>
<td>Bluebeam PDF Revu</td>
<td>proprietary (专利)</td>
<td>Windows XP, Windows Vista</td>
<td>?</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>保存为 PDF, 导出为 BMP, PNG, JPEG, GIF, TIFF, 文本</td>
</tr>
<tr>
<td>DéjàClick</td>
<td>专利</td>
<td>Linux, Unix, Windows, and Mac OS X</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>XML</td>
</tr>
<tr>
<td>emacs org-mode</td>
<td>遵循GPL协议</td>
<td>Linux, Windows, Mac OS X, Unix</td>
<td>是, Andorid和Iphone存在第三方程序</td>
<td>是</td>
<td>否                            &lt;</td>
<td>是</td>
<td>LaTeX, HTML, DocBook, Taskjuggler, PDF, Freemind, XOXO, iCalendar</td>
</tr>
<tr>
<td>eNoteFile</td>
<td>免费使用，付费注册</td>
<td>Windows XP/Vista/Windows 7</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>一键同步，分享， 密码保护，自动备份，远程访问，可视化搜索</td>
</tr>
<tr>
<td>Evernote</td>
<td>免费和付费版</td>
<td>Android, Mac OS X, iPhone OS, Windows XP, Windows Vista, Windows 7, Windows Mobile, Palm Pre, IMAP (read-only), WWW.</td>
<td>是</td>
<td>是</td>
<td>也行。mac的桌面版不支持不支持。文本和电子墨迹不允许混合。</td>
<td>是</td>
<td>XML保存，买南非版可以导入和显示 HTML, PDF, JPG, WAV, PNG, MP3, GIF, AMR. 付费版可以加入任何文件类型为附件.</td>
</tr>
<tr>
<td>Exstora organiser</td>
<td>免费和付费版</td>
<td>Windows 2000 &#8211; Vista</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>文本</td>
</tr>
<tr>
<td>FileIt.in</td>
<td>免费+广告</td>
<td>基于网页</td>
<td>否</td>
<td>是</td>
<td>否</td>
<td>是</td>
<td>Html</td>
</tr>
<tr>
<td>Gnote</td>
<td>遵循GPL协议 3</td>
<td>Linux</td>
<td>是</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>NoteXmlFormat, HTML, PDF</td>
</tr>
<tr>
<td>Google Notebook</td>
<td>web service</td>
<td>基于网页</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>基于网页; 导出为 ODF, Microsoft Word, PDF etc.</td>
</tr>
<tr>
<td>Gournal</td>
<td>遵循GPL协议</td>
<td>Linux</td>
<td>?</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>SVG</td>
</tr>
<tr>
<td>iAnnotate PDF</td>
<td>专利</td>
<td>iPad, iPod, iPhone</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>PDF</td>
</tr>
<tr>
<td>Idea Rover</td>
<td>免费试用</td>
<td>Windows</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>导入 HTM, HTML, PDF, and TXT, 到处为 RTF, DOC</td>
</tr>
<tr>
<td>Jarnal</td>
<td>遵循GPL协议</td>
<td>Any Java capable platform, including Linux, Windows, and Mac OS X</td>
<td>?</td>
<td>是</td>
<td>是,但是没有压力感应</td>
<td>是</td>
<td>ad-hoc 能够导出为 txt, html, jpg, pdf.</td>
</tr>
<tr>
<td>KNote</td>
<td>免费</td>
<td>Windows</td>
<td>是,</td>
<td>是</td>
<td>否</td>
<td>是</td>
<td>xml, 可以添加任何文件或文件夹为附件。 支持从 tiddlywiki 导入，也支持从浏览器保留格式的复制粘贴</td>
</tr>
<tr>
<td>Knowledge NoteBook</td>
<td>商业版，30天使用.</td>
<td>Window XP / Vista / 7</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>Text, image, pdf 或其他的多媒体文件</td>
</tr>
<tr>
<td>KeepNote</td>
<td>遵循GPL协议</td>
<td>Windows, Linux, Mac OS X</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>XHTML, XML, PNG, JPG, GIF</td>
</tr>
<tr>
<td>Linked Notes Basic</td>
<td>免费</td>
<td>Windows XP, Windows Vista</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>专利，导出为 RTF and TXT</td>
</tr>
<tr>
<td>MagicView</td>
<td>专利</td>
<td>Windows</td>
<td>是</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>HTML, RTF, TXT, HTA, XHTML, XML, PNG, JPG, GIF, BMP, MHT, PDF, DjVu (到处为HTML，导入微软的WORD (DOC))</td>
</tr>
<tr>
<td>Microsoft Windows Journal</td>
<td>专利</td>
<td>Windows XP Tablet PC edition</td>
<td>?</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>专利</td>
</tr>
<tr>
<td>Microsoft Office OneNote</td>
<td>专利</td>
<td>Windows XP, Windows Vista, Windows 7, Windows Phone 7, Windows Mobile, web;</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>专利</td>
</tr>
<tr>
<td>MyNotex</td>
<td>遵循GPL协议</td>
<td>Linux</td>
<td>是</td>
<td>是</td>
<td>否</td>
<td>否</td>
<td>基于Sqlite, 压缩附件，到处为HTML</td>
</tr>
<tr>
<td>My Yellow Notepad</td>
<td>专利</td>
<td>Windows</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>XML, 专利 compressed</td>
</tr>
<tr>
<td>Circus Ponies NoteBook</td>
<td>专利</td>
<td>Mac OS X</td>
<td>?</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>专利, 导出: html, opml, rtf, txt, doc, pdf</td>
</tr>
<tr>
<td>NoteCase Pro</td>
<td>免费和收费版本</td>
<td>跨平台</td>
<td>是</td>
<td>是</td>
<td>否</td>
<td>是</td>
<td>基于html和sqlite</td>
</tr>
<tr>
<td>NoteLab</td>
<td>遵循GPL协议</td>
<td>Linux, Windows, and Mac OS X</td>
<td>?</td>
<td>?</td>
<td>?</td>
<td>是</td>
<td>另存为SVG, 到处为 PNG, JPG, BMP</td>
</tr>
<tr>
<td>NotePub</td>
<td>免费的web 服务</td>
<td>基于网页</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>基于网页, HTML</td>
</tr>
<tr>
<td>NoteScribe</td>
<td>专利</td>
<td>Windows</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>保存为 .NSE (NoteScribe), 到处为 .rtf</td>
</tr>
<tr>
<td>Okular</td>
<td>遵循GPL协议</td>
<td>Linux/Unix</td>
<td>否</td>
<td>是</td>
<td>否</td>
<td>是</td>
<td>PDF, PS, TIFF, CHM, DjVu, DVI, XPS, ODF, various others</td>
</tr>
<tr>
<td>PDF Annotator</td>
<td>专利, 基本协议50刀（^_^!）</td>
<td>Windows</td>
<td>?</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>只能保存在pdf，不能导出</td>
</tr>
<tr>
<td>PDF Studio</td>
<td>专利</td>
<td>Windows, Linux, Mac OS X. Also available 基于网页.</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>PDF</td>
</tr>
<tr>
<td>Personal Knowbase</td>
<td>专利</td>
<td>Windows</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>导出为 RTF, HTML, TXT, CSV</td>
</tr>
<tr>
<td>RightNote</td>
<td>专利，免费试用</td>
<td>Windows (2K/XP/2K3/Vista)</td>
<td>否</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>专利 (sqlite);可以导入和导出以下文件格式： txt, csv, html (webclips) &amp; xls</td>
</tr>
<tr>
<td>Springnote</td>
<td>web服务</td>
<td>基于网页</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>基于网页; 导入word， OpenDocument text (ODT), Text files (TXT), HTML;导出为blog.</td>
</tr>
<tr>
<td>Swarm Doc</td>
<td>基于网页, 遵循GPL协议</td>
<td>基于网页, Linux, Windows, Mac OSX</td>
<td>是</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>基于网页; Html, wiki, local storage in sqlite database</td>
</tr>
<tr>
<td>threetags.com</td>
<td>web service</td>
<td>基于网页, iPhone app</td>
<td>是</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>HTML</td>
</tr>
<tr>
<td>TiddlyWeb</td>
<td>BSD</td>
<td>cross-platform (Python / 基于网页)</td>
<td>是</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>TiddlyWiki, HTML, TXT, JSON etc.</td>
</tr>
<tr>
<td>TiddlyWiki</td>
<td>BSD</td>
<td>cross-platform (browser-/ 基于网页)</td>
<td>是</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>HTML</td>
</tr>
<tr>
<td>Tomboy</td>
<td>L遵循GPL协议</td>
<td>cross-platform</td>
<td>是</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>NoteXmlFormat, HTML, PDF, wiki-formats</td>
</tr>
<tr>
<td>TreeDBNotes</td>
<td>免费软件，共享软件</td>
<td>Windows</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>文件格式 .treedb ，到处为 html, doc, txt, rtf, rvf.</td>
</tr>
<tr>
<td>WhizFolders</td>
<td>专利</td>
<td>Windows</td>
<td>否</td>
<td>是</td>
<td>否</td>
<td>是</td>
<td>Database, 专利 compressed</td>
</tr>
<tr>
<td>Typhoeus Stickies</td>
<td>免费</td>
<td>Windows XP, Vista and 7</td>
<td>?</td>
<td>是</td>
<td>否</td>
<td>是</td>
<td>.RTF and .TXT</td>
</tr>
<tr>
<td>xl Notes</td>
<td>免费和收费版本</td>
<td>Windows</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>xls, xlsx formats</td>
</tr>
<tr>
<td>Xournal</td>
<td>遵循GPL协议</td>
<td>Linux, Windows</td>
<td>?</td>
<td>是</td>
<td>是</td>
<td>是</td>
<td>XML, export to PDF</td>
</tr>
<tr>
<td>Zim</td>
<td>Artistic, 遵循GPL协议</td>
<td>Linux, Windows</td>
<td>?</td>
<td>是</td>
<td>?</td>
<td>是</td>
<td>wiki-format, export to HTML and Txt2Tags</td>
</tr>
</tbody>
</table>
<p> 下面根据数据来说明为什么应该选用<a href="http://www.evernote.com/" target="_blank">Evernote</a>  ： </p>
<p> 第一,<a href="http://www.evernote.com/" target="_blank">Evernote</a>  有免费版本,免费,功能受限,但是是足够用. 附合it just works原则. </p>
<p> 第二,跨平台绝对给力,秒杀所有同类软件.大部份同类软件能够支持到linux,mac,windows三个已经能够给人惊喜了,<a href="http://www.evernote.com/" target="_blank">Evernote</a>  呢,支持的平台包括：Android, Mac OS X, iPhone OS, Windows XP, Windows Vista, Windows 7, Windows Mobile, Palm Pre, IMAP (read-only), WWW,这意味着什么：首先,<a href="http://www.evernote.com/" target="_blank">Evernote</a>  的笔记才是真正的 <a href="http://en.wikipedia.org/wiki/Write_once,_run_anywhere" target="_blank">write once,run everwhere</a>,身为一个程序猿,对这种特性简直爱到死;其次,<a href="http://www.evernote.com/" target="_blank">Evernote</a>  彻底重新定义了记笔记这个活动：纸笔,电脑,几乎所有智能手机：iphone,windows mobile, palm, android,都有客户端,feature phone只要支持imap的mail客户端,或者拥有一个浏览器,就都可以完成记笔记这个行为.移动设备,可以让记笔记无处不在. </p>
<p> 第三,支持的笔记类型：键盘输入,语音输入,照片,手写的电子墨迹,等等,从此笔记不再是冷电脑前,书前冷冰冰的文字知识,而可以是任意的领悟,待办事项,绝妙主意,路过的一个美女(是的,支持照片),帐本,钱的花销,记录时间花销,等等.<a href="http://www.evernote.com/" target="_blank">Evernote</a>  让记笔记成为了艺术. </p>
<p> 第四,强大的搜索功能<sup><a class="footref" name="fnr.3" href="#fn.3">3</a></sup>：<a href="http://www.evernote.com/" target="_blank">Evernote</a>  的搜索按照关键字搜索文本,标题,图片中文字内容,等等,关键字支持正则表达式.但是,这并不是<a href="http://www.evernote.com/" target="_blank">Evernote</a>  搜索的全部,<a href="http://www.evernote.com/" target="_blank">Evernote</a>  的搜索强大还在于其支持以下搜索标准：tag,创建日期,修改日期,是否有附件,是否发自email,notebook,作者,经度,纬度,todo.笔记不但找得到,而且找的准. </p>
<p> 简要说明了<a href="http://www.evernote.com/" target="_blank">Evernote</a>  的强大,下面来介绍什么时候应该使用<a href="http://www.evernote.com/" target="_blank">Evernote</a>  和如何使用<a href="http://www.evernote.com/" target="_blank">Evernote</a>  来记笔记. </p>
</div></div>
</p></div>
<div id="outline-container-2" class="outline-3">
<h3 id="sec-2"><a href="http://www.evernote.com/" target="_blank">Evernote</a>  记笔记的一些方法 </h3>
<div class="outline-text-3" id="text-2">    </div>
<div id="outline-container-2_1" class="outline-4">
<h4 id="sec-2_1">读书笔记 &#8211; Kindle + twitter + evernote </h4>
<div class="outline-text-4" id="text-2_1">
<p>对于传统的读书笔记,一般是发生在看书时,而现在更多的发生在电脑旁,下面我们介绍下读书笔记和<a href="http://www.evernote.com/" target="_blank">Evernote</a>  结合的方法. </p>
<ul>
<li> 看书时
<p> 对于传统纸书,一般还是记在纸上,然后输入电脑,或者就在笔记本上.可惜,这种纸质方法记下的笔记有两个很严重的问题：书和笔记本的存放,书籍,纸质笔记本的丢失是经常发生的事情;二,笔记的搜索：好像读过某本书,记过什么想法,但是需要的时候,翻遍所有笔记本偏偏找不到更是经常遇到的情况. </p>
<p> 所以,读书我推荐<a href="https://kindle.amazon.com/" target="_blank">Kindle</a> <sup><a class="footref" name="fnr.4" href="#fn.4">4</a></sup>,<a href="https://kindle.amazon.com/" target="_blank">Kindle</a> 可以完美克服这两个缺点：便携,<a href="https://kindle.amazon.com/" target="_blank">Kindle</a> 6寸屏幕,可以放到一般衣服的兜里:易搜索,将<a href="https://kindle.amazon.com/" target="_blank">Kindle</a> 和<a href="http://www.evernote.com/" target="_blank">Evernote</a>  进行绑定,将<a href="https://kindle.amazon.com/" target="_blank">Kindle</a> 记录下的读书笔记交给<a href="http://www.evernote.com/" target="_blank">Evernote</a>  来保存,得以充分利用<a href="http://www.evernote.com/" target="_blank">Evernote</a>  的强大搜索功能,LOL～～～～.绑定方法是<a href="https://kindle.amazon.com/" target="_blank">Kindle</a> 绑定<a href="http://twitter.com/" target="_blank">Twitter</a>,<a href="http://twitter.com/" target="_blank">Twitter</a>绑定<a href="http://www.evernote.com/" target="_blank">Evernote</a>  :  (kindle+twit)+(twit+evernote)=kindle -&gt; evernote,具体方法见 <a href="http://blog.evernote.com/2009/04/14/evernote_twitter/" target="_blank">http://blog.evernote.com/2009/04/14/evernote\_twitter/</a>. </p>
<p> 绑定后,在<a href="https://kindle.amazon.com/" target="_blank">Kindle</a> 上记笔记时,使用以下语法,即可将笔记传送到<a href="http://www.evernote.com/" target="_blank">Evernote</a>  数据库中,下面是我建议的一种记笔记的方式： </p>
<p> @myen 110122  my kindle example notes for <a href="http://www.evernote.com/" target="_blank">Evernote</a>   #aat. </p>
<p> @myen是evernote的<a href="http://twitter.com/" target="_blank">Twitter</a>帐号,在绑定<a href="http://twitter.com/" target="_blank">Twitter</a>和<a href="http://www.evernote.com/" target="_blank">Evernote</a>  后,所有@myen的内容都会记录到你的<a href="http://www.evernote.com/" target="_blank">Evernote</a>  数据库,100122是记笔记的日期,供日后查询用,my kindle example notes for <a href="http://www.evernote.com/" target="_blank">Evernote</a>  是笔记内容,#notes是标签,标记了是看哪本书,也是为了查询时能够单独查询出看某一本书时的笔记,比如我现在看的一本书是&lt;American Accent Trainning&gt;<sup><a class="footref" name="fnr.5" href="#fn.5">5</a></sup>,我给所有这本书的笔记用的标签#aat,这个标签起名全在个人品味,只要保持前后一致,并且好记即可. </p>
</li>
<li> 电脑旁
<p> 电脑旁看书的话,Windows和Mac有相应的Evernote版本,Linux有一个移植Nevernote<sup><a class="footref" name="fnr.6" href="#fn.6">6</a></sup>,客户端功能强大,使用方法可以参考<sup><a class="footref" name="fnr.1.2" href="#fn.1">1</a></sup>中各种介绍. </p>
</li>
</ul></div>
</p></div>
<div id="outline-container-2_2" class="outline-4">
<h4 id="sec-2_2">浏览网页,保存雄文 &ndash; evernote for firefox and chrome </h4>
<div class="outline-text-4" id="text-2_2">
<p> 浏览网页时,难免会有些雄文,看过一遍不爽,于是会想保存下来日后阅读.一般可以选择保存为google bookmark, google reader中共享, google reader中标记星号. </p>
<p> 那么<a href="http://www.evernote.com/" target="_blank">Evernote</a>  提供一种新的,我认为更好的方法,将雄文保存为自己的笔记.毕竟内容再好,网上的内容属于网上的,即使在google reader中标记为了星号,google reader上从来没有下1000的未阅读也会让阅读星号文章成为一种美好的愿望.但是,保存为笔记,闲暇时分,自然而然的打开evernote,看一下tag为todo,同时tag为algortithm的文章,那是多么的惬意.笔记,随着时时温习让知识纳入自己的知识网络那才是王道. </p>
<p> <a href="http://www.evernote.com/" target="_blank">Evernote</a>  提供<a href="http://www.mozilla.com/firefox/fx/" target="_blank">Firefox</a>和<a href="http://google.com/chrome/" target="_blank">Chrome</a>r两个浏览器的插件<sup><a class="footref" name="fnr.7" href="#fn.7">7</a></sup>,如果是安装了Windows的客户端,默认的会在IE上安装<a href="http://www.evernote.com/" target="_blank">Evernote</a>  插件.插件的作用是抓取网页内容,简单易用,功能强大,谁用谁知道. </p>
</p></div>
</p></div>
<div id="outline-container-2_3" class="outline-4">
<h4 id="sec-2_3">时间,任务管理,想法,绝妙主意: email + mobile phone 客户端 </h4>
<div class="outline-text-4" id="text-2_3">
<p> 记得当时听李敖讲当年刚上大学军训的时候,用塑料布将笔和笔记本绑到腰上,有什么想法赶紧用纸笔记下来,塑料布绑着也不怕笔记本被汗水浸湿. </p>
<p> 二十一世纪的我们,如果再有如此强大的求知欲,需要记笔记时当然不再用如此虐待自己了.手机,社会人的标配,在借助了<a href="http://www.evernote.com/" target="_blank">Evernote</a>  的东风后,也能够在加强沟通以外的领域开花结果. </p>
<p> <a href="http://www.evernote.com/" target="_blank">Evernote</a>  提供以下平台的客户端,iPhone / iPod Touch,iPad, Android, BlackBerry, Palm Pre / Palm Pixi, Windows Mobile, 下载地址：    <a href="http://www.evernote.com/about/download/?btn=grey" target="_blank">http://www.evernote.com/about/download/?btn=grey</a>. </p>
<p> 如果手机不是以上几种,不是智能手机,也没有问题,只要支持email,通过email记笔记也很是方便,方法见： <a href="http://blog.evernote.com/2010/03/16/emailing-into-evernote-just-got-better/" target="_blank">http://blog.evernote.com/2010/03/16/emailing-into-evernote-just-got-better/</a>. </p>
<p> 好吧,如果手机连email都不支持,最后的办法就是web.现在的feture phone全部都支持java,安装一个opera,用opera访问<a href="http://www.evernote.com/" target="_blank">Evernote</a>  的主页,在其主页上进行记笔记的操作即可.只是,如果记笔记需要如此繁琐的步骤：1.打开浏览器,2.登陆<a href="http://www.evernote.com/" target="_blank">Evernote</a>  主页,3.新建,4.写内容,5.提交,6,记笔记完成.这繁琐的步骤让手机失去了记笔记的方便快捷性,那么失去了快捷性的手机记笔记也就没有必要了.这种情况下,使用纸笔也许是更好的方法. </p>
<p> 如果你是一位潮人,果粉,那么恭喜,苹果的所有产品都有相应的app,而且据说是最好用的<a href="http://www.evernote.com/" target="_blank">Evernote</a>  app,羡慕妒嫉啊. </p>
</p></div>
</p></div>
</p></div>
<div id="outline-container-3" class="outline-3">
<h3 id="sec-3">evernote-mode </h3>
<div class="outline-text-3" id="text-3">
<p>作为一个emacser,总是会有一种狂热,那就是看到任何好软件,都会下意识的去问,这个功能emacs中能有吗？对于<a href="http://www.evernote.com/" target="_blank">Evernote</a>  ,答案是也是YES. </p>
<p> emacs中evernote的名字叫evernote-你懂的-mode,项目地址：<a href="http://code.google.com/p/emacs-evernote-mode/" target="_blank">http://code.google.com/p/emacs-evernote-mode/</a>. evernote-mode是用ruby写的,截止2011.4.14,最新的版本是0.30. </p>
<p> evernote-mode的功能包括：打开笔记,创建笔记,支持对已有笔记的内容、标题、标签的修改,支持为<a href="http://www.gnu.org/software/emacs/" target="_blank">Emacs</a>中选中区域内容创建笔记,搜索笔记.最新版的支持本地的笔记内容Cache,读写笔记和标签速度比当时我用的0.10版本变快了不少. </p>
<p> 下面简要介绍下evernote-mode的安装,设置,使用流程. </p>
</p></div>
<div id="outline-container-3_1" class="outline-4">
<h4 id="sec-3_1">evernote-mode的安装 </h4>
<div class="outline-text-4" id="text-3_1">
<ul>
<li> download代码到本地
<p> svn checkout <a href="http://emacs-evernote-mode.googlecode.com/svn/trunk/" target="_blank">http://emacs-evernote-mode.googlecode.com/svn/trunk/</a> emacs-evernote-mode-read-only </p>
</li>
<li> 安装ruby脚本   </li>
</ul>
<pre class="src src-bash">cd evernote-mode/ruby
ruby setup.rb
</pre>
<ul>
<li> 将evernote-mode.el加入到load path  </li>
<li> 为evernote-enml-formatter-command 安装w3m（可选） 如果你的linux/Unix用户,从这里取<a href="http://w3m.sourceforge.net/index.en.html" target="_blank">w3m</a> 或者使用你发行版的包管理工具安装;如果你是Windows用户,安装<a href="http://www.cygwin.com/" target="_blank">cygwin</a>并在安装过程中选中w3m包.  </li>
<li> 将evernote-mode的配置文件加入.emacs  </li>
</ul>
<pre class="src src-elisp">(setq evernote-enml-formatter-command '(<span style="color: #cd8162;">"w3m"</span> <span style="color: #cd8162;">"-dump"</span> <span style="color: #cd8162;">"-I"</span> <span style="color: #cd8162;">"UTF8"</span> <span style="color: #cd8162;">"-O"</span> <span style="color: #cd8162;">"UTF8"</span>)) <span style="color: #cd4f39;">; </span><span style="color: #cd4f39;">option
</span>(add-to-list 'load-path <span style="color: #cd8162;">"&lt;your load path&gt;"</span>)
(require 'evernote-mode)
(global-set-key <span style="color: #cd8162;">"\C-cec"</span> 'evernote-create-note)
(global-set-key <span style="color: #cd8162;">"\C-ceo"</span> 'evernote-open-note)
(global-set-key <span style="color: #cd8162;">"\C-ces"</span> 'evernote-search-notes)
(global-set-key <span style="color: #cd8162;">"\C-ceS"</span> 'evernote-do-saved-search)
(global-set-key <span style="color: #cd8162;">"\C-cew"</span> 'evernote-write-note)
(global-set-key <span style="color: #cd8162;">"\C-cep"</span> 'evernote-post-region)
(global-set-key <span style="color: #cd8162;">"\C-ceb"</span> 'evernote-browser)
</pre>
<p> 如果使用cygwin来安装的ruby的话,需要cygwin-mount.el(<a href="http://www.emacswiki.org/cgi-bin/wiki/cygwin-mount.el" target="_blank">http://www.emacswiki.org/cgi-bin/wiki/cygwin-mount.el</a>). </p>
<p> 将cygwin-mount.el放至load path中,并在.emacs中加入以下代码 </p>
<pre class="src src-elisp">(require 'cygwin-mount)
(cygwin-mount-activate)
</pre>
<p> 安装完毕. </p>
</p></div>
</p></div>
<div id="outline-container-3_2" class="outline-4">
<h4 id="sec-3_2">evernote-mode的使用 </h4>
<div class="outline-text-4" id="text-3_2">
<p>简要介绍evernote-mode提供的命令和功能. </p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption></caption>
<colgroup>
<col align="left" />
<col align="left" /> </colgroup>
<thead>
<tr>
<th scope="col">命令</th>
<th scope="col">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>evernote-open-note</td>
<td>在Emacs的一个Buffer中打开一个已存在的笔记</td>
</tr>
<tr>
<td>evernote-save-note(\C-x\C-s)</td>
<td>保存修改过的笔记</td>
</tr>
<tr>
<td>evernote-create-note</td>
<td>创建一个笔记</td>
</tr>
<tr>
<td>evernote-write-note</td>
<td>从当前buffer创建新笔记</td>
</tr>
<tr>
<td>evernote-post-region</td>
<td>使用当前选中的区域的内容创建笔记</td>
</tr>
<tr>
<td>evernote-edit-tags(\C-cet)</td>
<td>修改当前笔记的标签</td>
</tr>
<tr>
<td>evernote-change-edit-mode(\C-cee)</td>
<td>改变编辑模式 (TEXT,XHTML可选)</td>
</tr>
<tr>
<td>evernote-rename-note(\C-cer)</td>
<td>重命名当前笔记</td>
</tr>
<tr>
<td>evernote-delete-note (\C-ced)</td>
<td>删除当前笔记</td>
</tr>
<tr>
<td>evernote-search-notes</td>
<td>搜索</td>
</tr>
<tr>
<td>evernote-do-saved-search</td>
<td>使用已保存的搜索条件进行笔记搜索</td>
</tr>
<tr>
<td>evernote-create-search</td>
<td>为一个搜索分配一个名字,以备后用</td>
</tr>
<tr>
<td>evernote-edit-search</td>
<td>编辑已保存搜索的搜索条件</td>
</tr>
<tr>
<td>evernote-toggle-read-only (\C-x\C-q)</td>
<td>设置笔记的只读属性</td>
</tr>
<tr>
<td>evernote-enml-formatter-command</td>
<td>格式化XHTML笔记</td>
</tr>
<tr>
<td>evernote-browser</td>
<td>打开evernote-browser,evernote browser提供强大的功能</td>
</tr>
</tbody>
</table>
<ul>
<li> everntoe-broswer
<p> Evernote Browser可以打开以下四种页面：标签列表页面,已保存搜索列表页面,笔记列表页面,笔记本列表页面. </p>
<p> 标签列表页面以层次图的形式列出Evernote服务中的标签列表,在标签名字上\C-m会打开符合此tag的笔记列表页. </p>
<p> <img src="https://dea.googlecode.com/svn/trunk/screenshots/evernote/broswer.png"  alt="https://dea.googlecode.com/svn/trunk/screenshots/evernote/broswer.png" /> </p>
<p> 已保存搜索是在Evernote中已创建的一系列搜索条件,在某个搜索上按键\C-m会打开符合相应的搜索结果的笔记. </p>
<p> <img src="https://dea.googlecode.com/svn/trunk/screenshots/evernote/single.png"  alt="https://dea.googlecode.com/svn/trunk/screenshots/evernote/single.png" /> </p>
<p> 笔记列表页面,符合某个搜索条件的笔记. </p>
<p> <img src="https://dea.googlecode.com/svn/trunk/screenshots/evernote/tagcourse.png"  alt="https://dea.googlecode.com/svn/trunk/screenshots/evernote/tagcourse.png" /> </p>
<p> 笔记本列表页面是Evernote上创建的所有笔记本的列表. </p>
<p> 下表是所有在Evernote Browser上可用的其它键命令. </p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption></caption>
<colgroup>
<col align="left" />
<col align="left" /> </colgroup>
<thead>
<tr>
<th scope="col">按键</th>
<th scope="col">动作</th>
</tr>
</thead>
<tbody>
<tr>
<td>b</td>
<td>移动到前一页</td>
</tr>
<tr>
<td>f</td>
<td>移动到后一页</td>
</tr>
<tr>
<td>t</td>
<td>创建一个标签列表页面并显示.如果已存在标签页面,直接将其打开.</td>
</tr>
<tr>
<td>S</td>
<td>创建一个搜索列表页面并显示.如果已存在,将其打开.</td>
</tr>
<tr>
<td>s</td>
<td>输入搜索条件,并显示符合搜索结果的笔记列表.</td>
</tr>
<tr>
<td>N</td>
<td>创建一个笔记本列表页面.如果笔记本列表已经存在,将其打开.</td>
</tr>
<tr>
<td>o</td>
<td>等同\C-m,但是光标并不移动到打开的笔记buffer.</td>
</tr>
<tr>
<td>n</td>
<td>如果在笔记列表,打开当前笔记,并移动到下一行.</td>
</tr>
<tr>
<td>p</td>
<td>如果在笔记列表,打开当前笔记,并移动到前一行</td>
</tr>
<tr>
<td>d</td>
<td>从Evernote Browser删除当前页面.</td>
</tr>
</tbody>
</table>
</li>
</ul></div>
</p></div>
</p></div>
<div id="outline-container-4" class="outline-3">
<h3 id="sec-4">org-mode + evernote-mode </h3>
<div class="outline-text-3" id="text-4">
<p> 因为我现在正在使用org-mode+remember来记笔记,org+remember的快捷和org-mode的显示都给我带来很好的使用体验. </p>
<p> org-mode的搜索功能比较不给力,那么是否可以将具有强大的搜索功能的<a href="http://www.evernote.com/" target="_blank">Evernote</a>  结合进来,使org-mode+remember+evernote-mode组成完美笔记三剑客呢？好吧,此处的答案仍然是YES. </p>
<p> 下面是我的解决方案.<b>代码 last edited: [fangzhzh@2011/08/12 20:46:20]</b> </p>
<pre class="src src-elisp"><span style="color: #cd4f39;">;;</span><span style="color: #cd4f39;">+evernote-mode+org-mode
</span><span style="color: #cd4f39;">;;</span><span style="color: #cd4f39;">&#22522;&#26412;&#24819;&#27861;&#26159;&#65306;&#22312;org-remember&#23436;&#25104;&#26102;,&#35843;&#29992;&#19968;&#20989;&#25968;&#26469;&#22788;&#29702;&#27492;remember&#30340;&#20869;&#23481;,&#23558;&#27492;&#20869;&#23481;&#36716;&#21270;&#20026;&#19968;&#20010;evernote&#30340;&#31508;&#35760;.
</span>
<span style="color: #cd4f39;">;;</span><span style="color: #cd4f39;">&#28155;&#21152;&#22788;&#29702;&#20989;&#25968;&#21040;rememer&#30340;hook
</span>(add-hook 'org-remember-before-finalize-hook 'evernote-this-org-note)

<span style="color: #cd4f39;">;;</span><span style="color: #cd4f39;">&#24403;&#35843;&#29992;&#21040;hook&#26102;,&#35843;&#29992;&#27492;&#20989;&#25968;,&#22788;&#29702;remember&#30340;&#20869;&#23481;,
</span>(<span style="color: #00ffff;">defun</span> <span style="color: #63b8ff;">evernote-this-org-note</span>(&amp;optional arg)
  <span style="color: #cd8162;">"select note"</span>
  (interactive <span style="color: #cd8162;">"P"</span>)
  (beginning-of-buffer)
  (re-search-forward <span style="color: #cd8162;">"^\*.*"</span>)
  (backward-word 1)
  (beginning-of-line )
  (copy-line)
  (forward-line)
  (evernote-post-region-4-org-mode (point) (point-max) <span style="color: #cd8162;">"test"</span>)
)

<span style="color: #cd4f39;">;;</span><span style="color: #cd4f39;">&#27492;&#20989;&#25968;&#23558;remember&#30340;&#20869;&#23481;&#20570;&#20026;evernote&#31508;&#35760;&#20869;&#23481;,&#26631;&#39064;&#30340;remember&#26159;&#26631;&#39064;,&#21516;&#26102;,&#20250;&#22312;minibuffer&#20013;&#35810;&#38382;tag,tag&#20197;&#8220;,&#8221;&#38388;&#38548;
</span>(<span style="color: #00ffff;">defun</span> <span style="color: #63b8ff;">evernote-post-region-4-org-mode</span> (begin end arg)
  <span style="color: #cd8162;">"Post the region as a note"</span>
  (interactive <span style="color: #cd8162;">"r\np"</span>)
  (enh-command-with-auth
   (save-excursion
     (save-restriction
       (narrow-to-region begin end)
       (if (and (enutil-neq arg nil) (enutil-neq arg 1))

<span style="color: #cd4f39;">;           </span><span style="color: #cd4f39;">(pop-to-buffer (enh-base-create-note-common (buffer-name) t t t))
</span>         (enh-base-create-note-common (current-kill 0) nil nil
nil t))))))
</pre>
<p> <img src="http://emacser.com/uploads/wpid-evernote-org-overview.png"  alt="http://emacser.com/uploads/wpid-evernote-org-overview.png" /> </p>
</p></div>
</p></div>
<div id="outline-container-5" class="outline-3">
<h3 id="sec-5"><a href="http://www.evernote.com/" target="_blank">Evernote</a>  搜索的一些例子 </h3>
<div class="outline-text-3" id="text-5">
<p> evernote的搜索功能相当强大：搜索条件多样,而且速度相当快. </p>
<p> 可以做为搜索条件的有：笔记本,任意表达式,标签,标题,创建日期,包含音频,包含图片,作者,创建笔记时的经纬度,笔记来源&hellip; </p>
<p> 下面给出一些例子. </p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption></caption>
<colgroup>
<col align="left" />
<col align="left" /> </colgroup>
<tbody>
<tr>
<td>例子</td>
<td>解释</td>
</tr>
<tr>
<td>tag:todo -tag:done created:day-1</td>
<td>今天所有有有标签todo,同时没有标签done的笔记</td>
</tr>
<tr>
<td>tag:money create:month</td>
<td>近一个月内所有有标签money的笔记</td>
</tr>
<tr>
<td>resource:image/*  tag:beauty</td>
<td>所有有标签beauty,同时笔记中有图片的笔记</td>
</tr>
<tr>
<td>tag:time tag:travel</td>
<td>所有符合有标签travel和time的笔记</td>
</tr>
<tr>
<td>tag:english     created:day-1 -created:day</td>
<td>有标签english,同时创建于昨天的不逑</td>
</tr>
<tr>
<td>source:mail.smtp</td>
<td>所有从邮件客户端发表的笔记</td>
</tr>
</tbody>
</table></div>
</p></div>
<div id="outline-container-6" class="outline-3">
<h3 id="sec-6">小结,缺点 </h3>
<div class="outline-text-3" id="text-6">
<p> <a href="http://www.evernote.com/" target="_blank">Evernote</a>  的缺点,就像它的优点一样明显,它的保存方式不是<a href="http://en.wikipedia.org/wiki/Plain_text" target="_blank">Plain text</a>的,尽管<a href="http://www.evernote.com/" target="_blank">Evernote</a>  的笔记可以导出多种格式,但是因为其使用私有格式,使版本管理工具对其不同版本之间内容比较无效,也就是版本管理这种功能失去了其存在的必要性.而没有版本管理的话,一个误操作就是万劫不复啊:一旦笔记内容因某些操作全部消失,那真是辛辛苦苦好多年,一下回到解放前, </p>
<p> <a href="http://www.evernote.com/" target="_blank">Evernote</a>  安全问题 <a href="http://xbeta.info/evernote-04.htm" target="_blank">http://xbeta.info/evernote-04.htm</a>, <a href="http://www.evernote.com/" target="_blank">Evernote</a>  的悲惨事迹 <a href="http://blog.est.im/archives/3723" target="_blank">http://blog.est.im/archives/3723</a>, 话说,其实我也出现过数据全部丢失的状况,幸亏我<a href="http://www.dropbox.com/" target="_blank">Dropbox</a>备份<a href="http://www.evernote.com/" target="_blank">Evernote</a>  数据库文件夹~~~~~,所有使用<a href="http://www.evernote.com/" target="_blank">Evernote</a>  记得备份,备份,备份,人肉备份,<a href="http://www.dropbox.com/" target="_blank">Dropbox</a>,各种方式只要是备份就行. </p>
</p></div>
</p></div>
<div id="outline-container-7" class="outline-3">
<h3 id="sec-7">形而上 </h3>
<div class="outline-text-3" id="text-7">
<p>形而上者谓之道,形而下者谓之器.我们前边说够了器,下边来说一下道:为什么记笔记? </p>
<p> 子曾经曰过:好记性不如烂笔头.李敖童鞋在某集&lt;李敖有话说&gt;中曾提到过自己超变态的记笔记的行为和方法,有兴趣的可以去Google搜一下. </p>
<p> 笑来的&lt;把时间当作朋友&gt;<sup><a class="footref" name="fnr.8" href="#fn.8">8</a></sup>一书中多次提到做笔记的必要性<sup><a class="footref" name="fnr.9" href="#fn.9">9</a></sup>,在此推荐&lt;把时间当作朋友&gt;,并极力推荐书中关于&lt;时间账本&gt;一章.另一本书&lt;每个人都能用英语&gt;中,提到自己的父亲博文强记,每每引经据典,无不精确让人佩服,最后发现原来也是系统记笔记的结果. </p>
<p> <a href="http://book.douban.com/subject/4159753/" target="_blank">&lt;Your brain at works&gt;</a>一书中在提到如何更好的使用大脑有限的能量时说道:努力地长时间将一个突如其来的想法或者todo事项记在大脑中非常的耗费大脑的资源,同时,干扰到大脑当前的工作状态,降低其工作效率.此时,最好的办法就是当想法突然蹦到你的脑海时,用任意方式(录音笔,纸笔,照片等等)将其快速记录下来,有时间来整理,然后马上转回到当前工作状态:此举一来记录下可能转瞬即逝的想法,二来,不打断大脑当前所处的状态,提高大脑的使用效率. </p>
<p> 最后,推荐刘未鹏的博客&lt;为什么你应该（从现在开始就）写博客 &gt; <a href="http://mindhacks.cn/2009/02/15/why-you-should-start-blogging-now/" target="_blank">http://mindhacks.cn/2009/02/15/why-you-should-start-blogging-now/</a>, 将笔记认为是一种未发表的博客,一种发表于博客前的自我反刍.那么,除去社会性功效,此篇博客的道理都适用于记笔记的行为,也就是&lt;为什么你应该(从现在开始就)记笔记&gt;. </p>
<p> Time-stamp: <span class="timestamp-wrapper"> <span class="timestamp">2011-05-06 17:47:28 fangzhzh</span></span> </p>
</p></div>
</p></div>
<div id="footnotes">
<h2 class="footnotes">Footnotes: </h2>
<div id="text-footnotes">
<p class="footnote"><sup><a class="footnum" name="fn.1" href="#fnr.1">1</a></sup> 各种<a href="http://www.evernote.com/" target="_blank">Evernote</a>  使用 <a href="http://linuxtoy.org/archives/%E5%85%A8è%83%BDç%9A%84ç%AC%94è%AE%B0è%BD%AF%E4%BB%B6â%80%94â%80%94evernote-%EF%BC%8830-beta%EF%BC%89.html" target="_blank">http://linuxtoy.org/archives/%E5%85%A8%E8%83%BD%E7%9A%84%E7%AC%94%E8%AE%B0%E8%BD%AF%E4%BB%B6%E2%80%94%E2%80%94evernote-%EF%BC%8830-beta%EF%BC%89.html</a>, <a href="http://www.biaodianfu.com/evernote.html" target="_blank">http://www.biaodianfu.com/evernote.html</a>, <a href="http://www.geekonomics10000.com/437" target="_blank">http://www.geekonomics10000.com/437</a>, <a href="http://www.williamlong.info/archives/2227.html" target="_blank">http://www.williamlong.info/archives/2227.html</a>, <a href="http://xbeta.info/evernote-03.htm" target="_blank">http://xbeta.info/evernote-03.htm</a>, <a href="http://blog.est.im/archives/3226" target="_blank">http://blog.est.im/archives/3226</a> 哈哈,一下子给出这么多链结,可见我的喜欢程度~~~LOL </p>
<p class="footnote"><sup><a class="footnum" name="fn.2" href="#fnr.2">2</a></sup> wordpress的模板可能无法显示完整的表格,完整,原始表格请移步 <a href="http://en.wikipedia.org/wiki/Comparison_of_notetaking_software" target="_blank">http://en.wikipedia.org/wiki/Comparison\_of\_notetaking\_software</a> </p>
<p class="footnote"><sup><a class="footnum" name="fn.3" href="#fnr.3">3</a></sup> 搜索语法介绍 <a href="http://www.evernote.com/about/developer/api/evernote-api.htm#_Toc277181469">http://www.evernote.com/about/developer/api/evernote-api.htm#\_Toc277181469</a> </p>
<p class="footnote"><sup><a class="footnum" name="fn.4" href="#fnr.4">4</a></sup> 大部分<a href="http://www.douban.com/doulist/137839/" target="_blank">经典的计算机的著作</a>基本上都有作者允许的pdf版本流传在外,google下基本可获得,将书传到<a href="https://kindle.amazon.com/" target="_blank">Kindle</a> 上阅读. </p>
<p class="footnote"><sup><a class="footnum" name="fn.5" href="#fnr.5">5</a></sup> American Accent Trainning <a href="http://book.douban.com/subject/1755336/" target="_blank">http://book.douban.com/subject/1755336/</a> </p>
<p class="footnote"><sup><a class="footnum" name="fn.6" href="#fnr.6">6</a></sup> NeverNote主页 <a href="http://nevernote.sourceforge.net/" target="_blank">http://nevernote.sourceforge.net/</a> </p>
<p class="footnote"><sup><a class="footnum" name="fn.7" href="#fnr.7">7</a></sup> firefox的evernote插件 <a href="https://addons.mozilla.org/zh-CN/firefox/addon/evernote-web-clipper/" target="_blank">https://addons.mozilla.org/zh-CN/firefox/addon/evernote-web-clipper/</a> chrome的evernote插件 <a href="https://chrome.google.com/extensions/detail/pioclpoplcdbaefihamjohnefbikjilc" target="_blank">https://chrome.google.com/extensions/detail/pioclpoplcdbaefihamjohnefbikjilc</a> </p>
<p class="footnote"><sup><a class="footnum" name="fn.8" href="#fnr.8">8</a></sup> &lt;把时间当作朋友&gt;pdf下载地址: <a href="http://www.lixiaolai.com/index.php/archives/9456.html" target="_blank">http://www.lixiaolai.com/index.php/archives/9456.html</a> </p>
<p class="footnote"><sup><a class="footnum" name="fn.9" href="#fnr.9">9</a></sup> &lt;把时间当作朋友&gt;中力推的记笔记工具是纸笔,但是作为一个挨踢从业者,我的经历使我更习惯电子产品,如手机,而且手机具备了&lt;把时间当作朋友&gt;中笑来提到的录音笔和纸笔两个功能. 工具的使用,主要关注点是舒服,哪个工具能够让你更投入到记笔记这个活动中,就应该使用哪个工具,而不要纠结于选择工具这个活动本身,更不要纠结于怎样学习适应一种别人认为好的工具.由此选用的工具一定要附合it just works原则.工具让你记笔记的行为成为一种享受,而不是痛苦. </p>
</p></div>
</p></div>

<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://emacser.com/evernote-mode.htm' t='Emacs中的Evernote: evernote-mode' d='' tag='ann,browser,c++,control,ede,Emacs,emacser,emacser.com,Email,erc,evernote,evernote-mode,face,IDE,irc,notetaking,onenote,org,plugin,python,screenshot,windows,光标,截图,插件,浏览器,邮件客户端,配色' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://emacser.com/wp-content/plugins/addthischina/a1.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://emacser.com/dea.htm" title="我的Emacs配置文件 － DEA (2009年11月11日)">我的Emacs配置文件 － DEA</a> (345)</li>
	<li><a href="http://emacser.com/from-vi-to-emacs.htm" title="我是如何从vim转向Emacs的 (2010年04月27日)">我是如何从vim转向Emacs的</a> (54)</li>
	<li><a href="http://emacser.com/emacs-cpp-dev.htm" title="在Emacs下用C/C++编程 (2010年10月25日)">在Emacs下用C/C++编程</a> (33)</li>
	<li><a href="http://emacser.com/w3m.htm" title="Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页 (2009年11月23日)">Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页</a> (39)</li>
	<li><a href="http://emacser.com/cedet.htm" title="用CEDET浏览和编辑C++代码 (2010年03月18日)">用CEDET浏览和编辑C++代码</a> (185)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://emacser.com/evernote-mode.htm/feed</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>自定义Emacs工具栏</title>
		<link>http://emacser.com/emacs-toolbar.htm</link>
		<comments>http://emacser.com/emacs-toolbar.htm#comments</comments>
		<pubDate>Tue, 08 Jun 2010 17:03:34 +0000</pubDate>
		<dc:creator>Meteor Liu</dc:creator>
				<category><![CDATA[Elisp]]></category>
		<category><![CDATA[中级]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[emacser]]></category>
		<category><![CDATA[emacser.com]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[gud]]></category>
		<category><![CDATA[keymap]]></category>
		<category><![CDATA[meteor]]></category>
		<category><![CDATA[meteor1113]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[semantic]]></category>
		<category><![CDATA[工具栏]]></category>
		<category><![CDATA[截图]]></category>
		<category><![CDATA[配色]]></category>
		<category><![CDATA[鼠标]]></category>

		<guid isPermaLink="false">http://emacser.com/?p=41416</guid>
		<description><![CDATA[作者: Meteor Liu

前几天，emacs@newsmth上jcjbrian发了张他用emacs开发c++的截图，对他的工具栏挺感兴趣，所以向他请教了一下，同时也阅读了相关的info，在我的emacs上加了些自定义的工具栏（下图），在这记录一下以备忘。 

emacs的工具栏配置都存放在tool-bar-map这个keymap里，这个keymap跟我们平时用于键绑定的keymap是一样的1，emacs会根据tool-bar-map的内容自动生成工具栏，如果执行一下下面这段代码，工具栏就没了：


?View Code LISP&#40;setq tool-bar-map &#40;make-sparse-keymap&#41;&#41;


要自定义工具栏，只需要修改tool-bar-map这个变量就可以了，一般我们可以用tool-bar-add-item这个函数来往tool-bar-map里添加工具项。


tool-bar-add-item的原型是这样的：


?View Code LISP&#40;tool-bar-add-item icon def key &#38;rest props&#41;


参数icon设置工具图标，emacs的工具栏可以使用XPM和PBM格式的图标，当emacs 有libxmp支持时会使用XPM格式，没有libxmp库时会寻找PBM格式的图标(Info上还说有XBM格式，我没搞清楚什么情况下使用XBM)。


在etc/images目录下可以看到emacs自带的图标一般都同时有XPM和PBM两种格式，就是为了在没有libxmp库时也能显示工具栏，因为如果我们只有xpm格式的图标而没有libxmp库时，emacs就不在工具栏上显示这个项了。所以我们自己做图标时最好XPM和PBM都准备一份。


icon参数的类型是字符串，只需要传主文件名就可以，扩展名emacs会自己加，比如对图标文件semantic.xpm写成&#8221;semantic&#8221;。


emacs会在image-load-path下查找图标文件，这个变量的值默认为(&#8220;&#8230;/etc/images/&#8221; data-directory load-path)，就是说它除了查找image目录外还会查找所有的load-path，所以如果我们有自己的图标目录，把它加到image-load-path或者load-path都可以。


图标的大小好像没有限制，emacs本身使用的图标是24&#215;24像素的，如果使用了比它大的图标，整个工具栏会自动扩大。


参数def设置这个工具项被按下的执行什么命令，它的格式跟global-set-key里的command格式是一样的。


参数key用来给这个工具项指定一个key，这个key用于唯一标识这个工具项，所以在同一个keymap里key不能重复。


剩下的参数可以设置一些属性项，具体可以设置哪些属性可以看Info &#62; elisp &#62; Keymaps &#62; Menu Keymaps &#62; Defining Menus &#62; Extended Menu Items。常用的几个属性有：



:enable 这个属性的值是一个表达式，emacs对这个表达式求值，如果值为nil时，这个工具项会被禁用。


:visible 这个属性控制这个工具项是否显示，它的类型与:enable是一样的。


:help 这个属性类型是字符串，当鼠标在工具项上停留时会显示这个字符串。


其余的属性我没用过，也没仔细研究它们用来干什么。


举例来说，如果要添加一个工具项用来执行gdb命令，并且只有在c-mode或者c++-mode时才让它有效，可以这样：


?View Code LISP1
2
&#40;tool-bar-add-item &#34;gud/run&#34; 'gdb 'gdb
                [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #0000ff;">作者: </span><a href="http://emacser.com/about.htm#meteor" target="_blank"><span style="color:#0000ff;"><b>Meteor Liu</b></span></a></p>
<p>
前几天，emacs@newsmth上jcjbrian发了张他用emacs开发c++的<a href="http://www.newsmth.net/bbscon.php?bid=573&amp;id=88480" target="_blank">截图</a>，对他的工具栏挺感兴趣，所以向他请教了一下，同时也阅读了相关的info，在我的emacs上加了些自定义的工具栏（下图），在这记录一下以备忘。 <span id="more-41416"></span></p>
<p><img src="screenshots/emacs-custom-toolbar.png" alt="自定义Emacs工具栏"/></p>
<p>emacs的工具栏配置都存放在tool-bar-map这个keymap里，这个keymap跟我们平时用于键绑定的keymap是一样的<sup><a class="footref" name="fnr.1" href="#fn.1">1</a></sup>，emacs会根据tool-bar-map的内容自动生成工具栏，如果执行一下下面这段代码，工具栏就没了：
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p41416code4'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p414164"><td class="code" id="p41416code4"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> tool-bar-map <span style="color: #66cc66;">&#40;</span>make-sparse-keymap<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>
要自定义工具栏，只需要修改tool-bar-map这个变量就可以了，一般我们可以用tool-bar-add-item这个函数来往tool-bar-map里添加工具项。
</p>
<p>
tool-bar-add-item的原型是这样的：
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p41416code5'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p414165"><td class="code" id="p41416code5"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>tool-bar-add-item icon def key <span style="color: #66cc66;">&amp;</span>rest props<span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>
参数icon设置工具图标，emacs的工具栏可以使用XPM和PBM格式的图标，当emacs 有libxmp支持时会使用XPM格式，没有libxmp库时会寻找PBM格式的图标(Info上还说有XBM格式，我没搞清楚什么情况下使用XBM)。
</p>
<p>
在etc/images目录下可以看到emacs自带的图标一般都同时有XPM和PBM两种格式，就是为了在没有libxmp库时也能显示工具栏，因为如果我们只有xpm格式的图标而没有libxmp库时，emacs就不在工具栏上显示这个项了。所以我们自己做图标时最好XPM和PBM都准备一份。
</p>
<p>
icon参数的类型是字符串，只需要传主文件名就可以，扩展名emacs会自己加，比如对图标文件semantic.xpm写成&#8221;semantic&#8221;。
</p>
<p>
emacs会在image-load-path下查找图标文件，这个变量的值默认为(&#8220;&hellip;/etc/images/&#8221; data-directory load-path)，就是说它除了查找image目录外还会查找所有的load-path，所以如果我们有自己的图标目录，把它加到image-load-path或者load-path都可以。
</p>
<p>
图标的大小好像没有限制，emacs本身使用的图标是24&#215;24像素的，如果使用了比它大的图标，整个工具栏会自动扩大。
</p>
<p>
参数def设置这个工具项被按下的执行什么命令，它的格式跟global-set-key里的command格式是一样的。
</p>
<p>
参数key用来给这个工具项指定一个key，这个key用于唯一标识这个工具项，所以在同一个keymap里key不能重复。
</p>
<p>
剩下的参数可以设置一些属性项，具体可以设置哪些属性可以看Info &gt; elisp &gt; Keymaps &gt; Menu Keymaps &gt; Defining Menus &gt; Extended Menu Items。常用的几个属性有：
</p>
<ul>
<li>
:enable 这个属性的值是一个表达式，emacs对这个表达式求值，如果值为nil时，这个工具项会被禁用。</p>
</li>
<li>
:visible 这个属性控制这个工具项是否显示，它的类型与:enable是一样的。</p>
</li>
<li>
:help 这个属性类型是字符串，当鼠标在工具项上停留时会显示这个字符串。</p>
</li>
</ul>
<p>其余的属性我没用过，也没仔细研究它们用来干什么。
</p>
<p>
举例来说，如果要添加一个工具项用来执行gdb命令，并且只有在c-mode或者c++-mode时才让它有效，可以这样：
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p41416code6'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p414166"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p41416code6"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>tool-bar-add-item <span style="color: #ff0000;">&quot;gud/run&quot;</span> 'gdb 'gdb
                   <span style="color: #66cc66;">:</span><span style="color: #555;">enable</span> '<span style="color: #66cc66;">&#40;</span>memq major-mode '<span style="color: #66cc66;">&#40;</span>c++-mode c-mode<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>
这样会把gdb这个工具项添加到默认工具栏的最后，如果不想要emacs默认的工具栏，可以先执行(setq tool-bar-map (make-sparse-keymap))把默认的工具栏清空。
</p>
<p>
我的toolbar配置文件在：<a href="http://github.com/meteor1113/dotemacs/blob/master/init-toolbar.el" target="_blank">http://github.com/meteor1113/dotemacs/blob/master/init-toolbar.el</a>
</p>
<div id="footnotes">
<h2 class="footnotes">Footnotes: </h2>
<div id="text-footnotes">
<p class="footnote"><sup><a class="footnum" name="fn.1" href="#fnr.1">1</a></sup> 我读了半天info才明白，emacs的toolbar, menu和平时用global-set-key设置的按键绑定都是相通的，在emacs里，这些通通都保存在keymap里，只是menu和toolbar会多出一些属性设置。关于这些内容可以看看Info &gt; elisp &gt; Keymaps 以及下面的Menu Keymaps。
</p>
</div>
</div>
<div id="postamble">
</div>

<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://emacser.com/emacs-toolbar.htm' t='自定义Emacs工具栏' d='' tag='C/C++,Emacs,emacser,emacser.com,gdb,gud,keymap,meteor,meteor1113,screenshot,semantic,工具栏,截图,配色,配色,鼠标' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://emacser.com/wp-content/plugins/addthischina/a1.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://emacser.com/cedet.htm" title="用CEDET浏览和编辑C++代码 (2010年03月18日)">用CEDET浏览和编辑C++代码</a> (185)</li>
	<li><a href="http://emacser.com/built-in-cedet.htm" title="用CEDET浏览和编辑C++代码(续) &#8211; 使用Emacs 23.2内置的CEDET (2010年05月10日)">用CEDET浏览和编辑C++代码(续) &#8211; 使用Emacs 23.2内置的CEDET</a> (97)</li>
	<li><a href="http://emacser.com/zjl-c-hl.htm" title="高亮C的所有变量和函数 (2010年05月17日)">高亮C的所有变量和函数</a> (44)</li>
	<li><a href="http://emacser.com/from-vi-to-emacs.htm" title="我是如何从vim转向Emacs的 (2010年04月27日)">我是如何从vim转向Emacs的</a> (54)</li>
	<li><a href="http://emacser.com/emacs-cpp-dev.htm" title="在Emacs下用C/C++编程 (2010年10月25日)">在Emacs下用C/C++编程</a> (33)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://emacser.com/emacs-toolbar.htm/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>用artist-mode画文本图</title>
		<link>http://emacser.com/artist-mode.htm</link>
		<comments>http://emacser.com/artist-mode.htm#comments</comments>
		<pubDate>Tue, 18 May 2010 19:10:02 +0000</pubDate>
		<dc:creator>fangzhzh</dc:creator>
				<category><![CDATA[其他]]></category>
		<category><![CDATA[初级]]></category>
		<category><![CDATA[好玩的]]></category>
		<category><![CDATA[artist-mode]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[emacser]]></category>
		<category><![CDATA[emacser.com]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[org]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[截图]]></category>
		<category><![CDATA[配色]]></category>
		<category><![CDATA[鼠标]]></category>

		<guid isPermaLink="false">http://emacser.com/?p=41374</guid>
		<description><![CDATA[
概述
artist是一个emacs的内置lisp包。
在artist-mode中，你可以使用鼠标或者键盘来画线(可以带箭头)、矩形、正方形、多边形、椭圆、圆和一些类似于水蒸气似的不规则图形，当然可以擦除，填出图形，还可以在其上写字。 
截图
这是一个很不错的绘制单链表的截图flash
这是一个画了一些形状的截图, 这幅图画了一个A.
这是我工作时的一个绘制结果.

为什么使用Artist-mode
我经常在写程序的时候，希望在文档里画一些类的继承关系、包含关系什么的，以帮助读这个文件的人能够更好的理解代码，但是此处不能且不适合放一张jpg（要是h,cpp文件里能插图，那多拉风啊）。
就考虑用plain-text的文本格式来绘图。初始时想用“-&#124;+_”这几个符号来拼凑，但是工作效率太低，而且容易出错，一修改就几乎整个图作废。将有限的时间浪费在如此耗时，且没有技术含量的工作上，那还不就等于浪费生命啊，剩下来的时间多去看看twitter多好！
正如截图中绘制单链表的截图flash所展示，artist-mode来做这件事情，那是最适合不过了。那么来初探一下emacs的artist-mode能够如何完成任务呢。
怎么使用Mouse 绘制
进入artist-mode
M-x artist-mode

离开artist-mode
M-x artist-mode-off

三个mouse
mouse-2（鼠标中键）,shift mouse-2
弹出一个菜单，从菜单里你可以选择要使用左键画什么类型更改一些设定
mouse-1 ( 鼠标左键) , shift-mouse-1
绘制部分由鼠标左键完成，请参考绘制操作。
mouse-3 ( 鼠标右键) , shift mouse-3



mouse-3
删除鼠标下的一个字符


shift mouse-3
画出矩形框，删除框选所有字符




绘制操作（鼠标左键）



操作
无shift
shift


pen
单击，在鼠标点填充一个“填充符号”，默认为&#8221;.&#8221;；按下左键，拖动，抬起，绘制填充符号组成的线
单击，在鼠标点填充一个“o”；按下左键，拖动，抬起，绘制一条从初始点到最终点的直线


Line
任意方向的线
直线


Rectangle
矩形
正方形1


Poly-line
任意方向的多边形
每条线都是直线的多边形


Ellipses
椭圆
圆2


Text
文本
覆盖式文本


Spray-can
喷雾器3
设置喷雾器的大小


Erase
橡皮，擦掉一个字符
擦掉矩形内字符


Vaporize
擦除一行
擦除所有相连的行


Cut
剪切矩形
剪切正方形


copy
复制矩形
复制正方形


paste
粘贴
粘贴


Flood-fill
填充工具，填充
填充



一些说明
直线：只能是垂直，水平，对角线
箭头：绘制线，或多边形时，可以设置箭头，详细见箭头.
设定



设定选项
含义


Set fill
设定用来填充矩形和正方形的字符


Set line
设定绘制线的时候使用的字符


Erase char
设置擦除的时候使用的字符


Trimming
开关修剪行尾的功能（一个图画完，一行行尾的空格会被移除）


Borders
开关在填充图形周围绘制行边界的功能



箭头
在artist-mode中，有下面两个键
&#60; artist-toggle-first-arrow &#62; artist-toggle-second-arrow

就像他们的快捷键所展示，artist-toggle-first-arrow将一条直线的第一个字符变为&#60;，而artist-toggle-second-arrow将一条线的最后一个字符变为&#62;。
命令
基本命令



命令
功能


M-x artist-key-set-point
执行以下功能


M-x artist-select-operation
选择绘制类型


M-x artist-next-line, M-x artist-previous-line, M-x artist-forward-char and M-x artist-backward-char.
移动


M-x artist-select-fill-char
设置填充字符


M-x artist-select-line-char
设置绘制时字符


M-x artist-select-erase-char
设置擦除时使用字符


M-x artist-toggle-rubber-banding
开关  rubber-banding功能（不知道是什么）


M-x artist-toggle-trim-line-endings
开关修剪行尾的功能


M-x artist-toggle-borderless-shapes
开关在填充图形周围绘制行边界的功能



artist-key-set-point 执行的功能



情况
作用


lines/rectangles/squares
设置起始/结束点


poly-lines
设置其中一个点， (使用 C-u M-x artist-key-set-point 设置结束点)


擦除字符时
开关橡皮功能


剪切，复制
设置区域/正方形 的 开始/结束点


粘贴时
粘贴动作



箭头命令



M-x artist-toggle-first-arrow
设置/取消 在线/多线段开头的箭头


M-x artist-toggle-second-arrow
设置/取消 在线/多线段结尾的箭头



选择操作



M-x artist-select-op-line
绘制线


M-x artist-select-op-straight-line
绘制直线


M-x [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" src="screenshots/artist-mode-logo.jpg" alt="" width="120" height="120" /></p>
<h3>概述</h3>
<p class="first">artist是一个emacs的内置lisp包。<br />
在artist-mode中，你可以使用鼠标或者键盘来画线(可以带箭头)、矩形、正方形、多边形、椭圆、圆和一些类似于水蒸气似的不规则图形，当然可以擦除，填出图形，还可以在其上写字。 <span id="more-41374"></span></p>
<h4>截图</h4>
<p class="first">这是一个很不错的<a href="http://www.cinsk.org/emacs/emacs-artist.html" target="_blank">绘制单链表的截图flash</a></p>
<p>这是一个<a href="http://www.lysator.liu.se/~tab/artist/emacs-shapes.html" target="_blank">画了一些形状的截图</a>, 这幅图画了一个<a href="http://www.lysator.liu.se/~tab/artist/emacs-a.html" target="_blank">A</a>.</p>
<p>这是我工作时的一个绘制结果.</p>
<p><a rel="lightbox" href="screenshots/artist-mode.jpg"><img src="screenshots/thumbs/thumbs_artist-mode.jpg" alt="" /></a></p>
<h3>为什么使用Artist-mode</h3>
<p class="first">我经常在写程序的时候，希望在文档里画一些类的继承关系、包含关系什么的，以帮助读这个文件的人能够更好的理解代码，但是此处不能且不适合放一张jpg（要是h,cpp文件里能插图，那多拉风啊）。</p>
<p>就考虑用plain-text的文本格式来绘图。初始时想用“-|+_”这几个符号来拼凑，但是工作效率太低，而且容易出错，一修改就几乎整个图作废。将有限的时间浪费在如此耗时，且没有技术含量的工作上，那还不就等于浪费生命啊，剩下来的时间多去看看twitter多好！</p>
<p>正如截图中<a href="http://www.cinsk.org/emacs/emacs-artist.html" target="_blank">绘制单链表的截图flash</a>所展示，artist-mode来做这件事情，那是最适合不过了。那么来初探一下emacs的artist-mode能够如何完成任务呢。</p>
<h3>怎么使用Mouse 绘制</h3>
<h4>进入artist-mode</h4>
<pre>M-x artist-mode
</pre>
<h4>离开artist-mode</h4>
<pre>M-x artist-mode-off
</pre>
<h4>三个mouse</h4>
<h5>mouse-2（鼠标中键）,shift mouse-2</h5>
<p class="first">弹出一个菜单，从菜单里你可以选择要使用左键画什么<a href="#types">类型</a>更改一些<a href="#setttings">设定</a></p>
<h5>mouse-1 ( 鼠标左键) , shift-mouse-1</h5>
<p class="first">绘制部分由鼠标左键完成，请参考<a href="#operations">绘制操作</a>。</p>
<h5>mouse-3 ( 鼠标右键) , shift mouse-3</h5>
<table class="muse-table" border="2" cellpadding="5">
<tbody>
<tr>
<td>mouse-3</td>
<td>删除鼠标下的一个字符</td>
</tr>
<tr>
<td>shift mouse-3</td>
<td>画出矩形框，删除框选所有字符</td>
</tr>
</tbody>
</table>
<p><a id="operations" name="operations"></a></p>
<h4><a id="types" name="types"></a>绘制操作（鼠标左键）</h4>
<table class="muse-table" border="2" cellpadding="5">
<tbody>
<tr>
<td>操作</td>
<td>无shift</td>
<td>shift</td>
</tr>
<tr>
<td>pen</td>
<td>单击，在鼠标点填充一个“填充符号”，默认为&#8221;.&#8221;；按下左键，拖动，抬起，绘制填充符号组成的线</td>
<td>单击，在鼠标点填充一个“o”；按下左键，拖动，抬起，绘制一条从初始点到最终点的直线</td>
</tr>
<tr>
<td>Line</td>
<td>任意方向的线</td>
<td>直线</td>
</tr>
<tr>
<td>Rectangle</td>
<td>矩形</td>
<td>正方形<sup><a class="footref" name="fnr.1" href="#fn.1">1</a></sup></td>
</tr>
<tr>
<td>Poly-line</td>
<td>任意方向的多边形</td>
<td>每条线都是直线的多边形</td>
</tr>
<tr>
<td>Ellipses</td>
<td>椭圆</td>
<td>圆<sup><a class="footref" name="fnr.2" href="#fn.2">2</a></sup></td>
</tr>
<tr>
<td>Text</td>
<td>文本</td>
<td>覆盖式文本</td>
</tr>
<tr>
<td>Spray-can</td>
<td>喷雾器<sup><a class="footref" name="fnr.3" href="#fn.3">3</a></sup></td>
<td>设置喷雾器的大小</td>
</tr>
<tr>
<td>Erase</td>
<td>橡皮，擦掉一个字符</td>
<td>擦掉矩形内字符</td>
</tr>
<tr>
<td>Vaporize</td>
<td>擦除一行</td>
<td>擦除所有相连的行</td>
</tr>
<tr>
<td>Cut</td>
<td>剪切矩形</td>
<td>剪切正方形</td>
</tr>
<tr>
<td>copy</td>
<td>复制矩形</td>
<td>复制正方形</td>
</tr>
<tr>
<td>paste</td>
<td>粘贴</td>
<td>粘贴</td>
</tr>
<tr>
<td>Flood-fill</td>
<td>填充工具，填充</td>
<td>填充</td>
</tr>
</tbody>
</table>
<h4>一些说明</h4>
<p><em>直线</em>：只能是垂直，水平，对角线</p>
<p>箭头：绘制线，或多边形时，可以设置箭头，详细见<a href="#arrows">箭头</a>.</p>
<h4><a id="setttings" name="setttings"></a>设定</h4>
<table class="muse-table" border="2" cellpadding="5">
<tbody>
<tr>
<td>设定选项</td>
<td>含义</td>
</tr>
<tr>
<td>Set fill</td>
<td>设定用来填充矩形和正方形的字符</td>
</tr>
<tr>
<td>Set line</td>
<td>设定绘制线的时候使用的字符</td>
</tr>
<tr>
<td>Erase char</td>
<td>设置擦除的时候使用的字符</td>
</tr>
<tr>
<td>Trimming</td>
<td>开关修剪行尾的功能（一个图画完，一行行尾的空格会被移除）</td>
</tr>
<tr>
<td>Borders</td>
<td>开关在填充图形周围绘制行边界的功能</td>
</tr>
</tbody>
</table>
<h4><a id="arrows" name="arrows"></a>箭头</h4>
<p class="first">在artist-mode中，有下面两个键</p>
<pre>&lt; artist-toggle-first-arrow &gt; artist-toggle-second-arrow
</pre>
<p>就像他们的快捷键所展示，artist-toggle-first-arrow将一条直线的第一个字符变为&lt;，而artist-toggle-second-arrow将一条线的最后一个字符变为&gt;。</p>
<h3>命令</h3>
<h4>基本命令</h4>
<table class="muse-table" border="2" cellpadding="5">
<tbody>
<tr>
<td>命令</td>
<td>功能</td>
</tr>
<tr>
<td>M-x artist-key-set-point</td>
<td><a href="#artist-key-set-point">执行以下功能</a></td>
</tr>
<tr>
<td>M-x artist-select-operation</td>
<td>选择绘制类型</td>
</tr>
<tr>
<td>M-x artist-next-line, M-x artist-previous-line, M-x artist-forward-char and M-x artist-backward-char.</td>
<td>移动</td>
</tr>
<tr>
<td>M-x artist-select-fill-char</td>
<td>设置填充字符</td>
</tr>
<tr>
<td>M-x artist-select-line-char</td>
<td>设置绘制时字符</td>
</tr>
<tr>
<td>M-x artist-select-erase-char</td>
<td>设置擦除时使用字符</td>
</tr>
<tr>
<td>M-x artist-toggle-rubber-banding</td>
<td>开关  rubber-banding功能（不知道是什么）</td>
</tr>
<tr>
<td>M-x artist-toggle-trim-line-endings</td>
<td>开关修剪行尾的功能</td>
</tr>
<tr>
<td>M-x artist-toggle-borderless-shapes</td>
<td>开关在填充图形周围绘制行边界的功能</td>
</tr>
</tbody>
</table>
<h5><a id="artist-key-set-point" name="artist-key-set-point"></a>artist-key-set-point 执行的功能</h5>
<table class="muse-table" border="2" cellpadding="5">
<tbody>
<tr>
<td>情况</td>
<td>作用</td>
</tr>
<tr>
<td>lines/rectangles/squares</td>
<td>设置起始/结束点</td>
</tr>
<tr>
<td>poly-lines</td>
<td>设置其中一个点， (使用 C-u M-x artist-key-set-point 设置结束点)</td>
</tr>
<tr>
<td>擦除字符时</td>
<td>开关橡皮功能</td>
</tr>
<tr>
<td>剪切，复制</td>
<td>设置区域/正方形 的 开始/结束点</td>
</tr>
<tr>
<td>粘贴时</td>
<td>粘贴动作</td>
</tr>
</tbody>
</table>
<h4>箭头命令</h4>
<table class="muse-table" border="2" cellpadding="5">
<tbody>
<tr>
<td>M-x artist-toggle-first-arrow</td>
<td>设置/取消 在线/多线段开头的箭头</td>
</tr>
<tr>
<td>M-x artist-toggle-second-arrow</td>
<td>设置/取消 在线/多线段结尾的箭头</td>
</tr>
</tbody>
</table>
<h4>选择操作</h4>
<table class="muse-table" border="2" cellpadding="5">
<tbody>
<tr>
<td>M-x artist-select-op-line</td>
<td>绘制线</td>
</tr>
<tr>
<td>M-x artist-select-op-straight-line</td>
<td>绘制直线</td>
</tr>
<tr>
<td>M-x artist-select-op-rectangle</td>
<td>绘制矩形</td>
</tr>
<tr>
<td>M-x artist-select-op-square</td>
<td>绘制正方形</td>
</tr>
<tr>
<td>M-x artist-select-op-poly-line</td>
<td>绘制多线段</td>
</tr>
<tr>
<td>M-x artist-select-op-straight-poly-line</td>
<td>绘制直线组成的多线段</td>
</tr>
<tr>
<td>M-x artist-select-op-ellipse</td>
<td>绘制椭圆</td>
</tr>
<tr>
<td>M-x artist-select-op-circle</td>
<td>绘制圆</td>
</tr>
<tr>
<td>M-x artist-select-op-text-see-thru</td>
<td>写字（插入模式）</td>
</tr>
<tr>
<td>M-x artist-select-op-text-overwrite</td>
<td>写字（覆盖模式）</td>
</tr>
<tr>
<td>M-x artist-select-op-spray-can</td>
<td>喷雾器</td>
</tr>
<tr>
<td>M-x artist-select-op-spray-set-size</td>
<td>设置喷雾器的大小</td>
</tr>
<tr>
<td>M-x artist-select-op-erase-char</td>
<td>擦除字符</td>
</tr>
<tr>
<td>M-x artist-select-op-erase-rectangle</td>
<td>擦除矩形内字符</td>
</tr>
<tr>
<td>M-x artist-select-op-vaporize-line</td>
<td>擦除一行</td>
</tr>
<tr>
<td>M-x artist-select-op-vaporize-lines</td>
<td>擦除所有相连的行</td>
</tr>
<tr>
<td>M-x artist-select-op-cut-rectangle</td>
<td>剪切矩形</td>
</tr>
<tr>
<td>M-x artist-select-op-copy-rectangle</td>
<td>复制矩形</td>
</tr>
<tr>
<td>M-x artist-select-op-paste</td>
<td>粘贴</td>
</tr>
<tr>
<td>M-x artist-select-op-flood-fill</td>
<td>填充</td>
</tr>
</tbody>
</table>
<p>有了以上的介绍，我将所有artist-mode的命令绘制为一张表格，再参考artist-mode的键绑定+自己绑定，键盘绘制会像用鼠标绘制一样顺手。</p>
<h3>artist变身</h3>
<p class="first">或许有人觉得artist-mode绘制出来的ascii图很不错，但是如果能变成图片或许更好；或者图片是一种硬性要求；或者由于不知道的原因，总有可能有需求将ascii变成图片呢？多一种选择总是好事。</p>
<p>好吧，<a href="http://emacser.com/emacs-ditaa.htm">传送门</a> 。</p>
<p class="footnote"><a class="footnum" name="fn.1" href="#fnr.1">1.</a> 我试验，此处并没有绘制正方形，难道是我的版本有问题，求确认。</p>
<p class="footnote"><a class="footnum" name="fn.2" href="#fnr.2">2.</a> 与<sup><a class="footref" name="fnr.1" href="#fn.1">1</a></sup>相同，我仍然没有得到圆，得到的是椭圆</p>
<p class="footnote"><a class="footnum" name="fn.3" href="#fnr.3">3.</a> 顾名思义，很拉风的东西，但是我感觉不实用</p>

<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://emacser.com/artist-mode.htm' t='用artist-mode画文本图' d='' tag='artist-mode,Emacs,emacser,emacser.com,irc,org,screenshot,截图,配色,鼠标' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://emacser.com/wp-content/plugins/addthischina/a1.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://emacser.com/dea.htm" title="我的Emacs配置文件 － DEA (2009年11月11日)">我的Emacs配置文件 － DEA</a> (345)</li>
	<li><a href="http://emacser.com/emacs-ditaa.htm" title="Emacs中绘图 － ditaa篇 (2010年08月4日)">Emacs中绘图 － ditaa篇</a> (34)</li>
	<li><a href="http://emacser.com/evernote-mode.htm" title="Emacs中的Evernote: evernote-mode (2011年04月26日)">Emacs中的Evernote: evernote-mode</a> (49)</li>
	<li><a href="http://emacser.com/zjl-c-hl.htm" title="高亮C的所有变量和函数 (2010年05月17日)">高亮C的所有变量和函数</a> (44)</li>
	<li><a href="http://emacser.com/emacs-toolbar.htm" title="自定义Emacs工具栏 (2010年06月9日)">自定义Emacs工具栏</a> (23)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://emacser.com/artist-mode.htm/feed</wfw:commentRss>
		<slash:comments>56</slash:comments>
		</item>
		<item>
		<title>高亮C的所有变量和函数</title>
		<link>http://emacser.com/zjl-c-hl.htm</link>
		<comments>http://emacser.com/zjl-c-hl.htm#comments</comments>
		<pubDate>Mon, 17 May 2010 01:19:37 +0000</pubDate>
		<dc:creator>ahei</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[中级]]></category>
		<category><![CDATA[CEDET]]></category>
		<category><![CDATA[ede]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[emacser]]></category>
		<category><![CDATA[emacser.com]]></category>
		<category><![CDATA[face]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[org]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[semantic]]></category>
		<category><![CDATA[zjl-c-hl]]></category>
		<category><![CDATA[截图]]></category>
		<category><![CDATA[配色]]></category>
		<category><![CDATA[颜色]]></category>

		<guid isPermaLink="false">http://emacser.com/?p=41359</guid>
		<description><![CDATA[作者: nowait@smth



1 前言 
2 有图为证, 图个痛快 
3 install 
4 Feature 
5 缺陷 
6 可以customize的变量 
7 程序的骨干的说明-&#8212;给不满意效果想要自行修改代码的同志看的 

7.1 font-lock-add-keywords 
7.2 (add-hook hook &#8216;zjl-c-hl-init) 






1 前言 

emacs的代码语法加亮实在是做的不好,和source insight无法相比, 可能是以前没有集成cedet,不好分析语法的原因吧.我就自己写了一个山寨品来用. 之所以说这个文章里要介绍的这个zjl-c-hl.el是山寨的,是由于最重要的变量和参数加亮的实现原理是山寨的:用semantic得到单个函数的变量和参数list(这个还不算山寨),然后用highlight.el对函数范围内的变量和参数进行匹配加亮(就是这个就比较山寨). 我估计正常应该是用font-lock-add-keywords的高级功能来加亮,从而比较深的整合进emacs本身中. 不过我一直没有去深入的研究, 这个code也是按需要逐渐添加的. 虽然比较山寨,不过挺好用的. 下面是简单的介绍,很短, 看完了解了,有需要的朋友就可以拿来用了.




2 有图为证, 图个痛快 




3 install 

到这儿下载zjl-c-hl.el(以后应该wiki上面会有)http://code.google.com/p/dea/source/browse/trunk/lisps/zjl-c-hl.el
这个包里面使用了emacswiki上的highlight.el,从这儿下载:http://www.emacswiki.org/emacs/highlight.el
(require &#8216;zjl-c-hl)




4 Feature 



支持c文件, 如果是.cpp文件,内部实际是c,也可以:), 那种实际是cpp的,估计把zjl-c-hl-c++-mode-enable-flag为妥.


加亮对象包括:局部变量,函数引用, 操作符,数字. 加亮的结果是还剩下的黑白字(默认face)部分的则一定是全局变量,宏或错误的局部变量(比如输入错误).


加亮过的区域,不会再被加亮一次,除非函数内部被修改(参见下一条), 这样cpu资源消耗不大


函数内部被修改后,进行局部(实际上是整个函数的)重新加亮. 具体表现为,就是随着代码输入,延时1-3秒加亮.


颜色face可以customize,分为白背景和暗背景, 白背景的加亮face我尽量做成了source insight的默认颜色, 暗背景的我目前也是用的和白背景一样的face&#8230;, 我自己没怎么用过暗背景,觉得现在的也可以接受, 所以用户如果对暗背景的默认颜色不满意可以有两个选择


自己默默的改得符合自己喜好


改好了之后, 把custom.el发给我







5 缺陷 [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #0000ff;">作者: </span><a href="http://emacser.com/about.htm#nowait" target="_blank"><span style="color: #0000ff;"><b>nowait@smth</b></span></a></p>
<div id="table-of-contents">
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 前言 </a></li>
<li><a href="#sec-2">2 有图为证, 图个痛快 </a></li>
<li><a href="#sec-3">3 install </a></li>
<li><a href="#sec-4">4 Feature </a></li>
<li><a href="#sec-5">5 缺陷 </a></li>
<li><a href="#sec-6">6 可以customize的变量 </a></li>
<li><a href="#sec-7">7 程序的骨干的说明-&mdash;给不满意效果想要自行修改代码的同志看的 </a>
<ul>
<li><a href="#sec-7.1">7.1 font-lock-add-keywords </a></li>
<li><a href="#sec-7.2">7.2 (add-hook hook &#8216;zjl-c-hl-init) </a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-3">
<h3 id="sec-1"><span class="section-number-3">1</span> 前言 </h3>
<div class="outline-text-3" id="text-1">
<p>emacs的代码语法加亮实在是做的不好,和source insight无法相比, 可能是以前没有集成cedet,不好分析语法的原因吧.我就自己写了一个山寨品来用. 之所以说这个文章里要介绍的这个zjl-c-hl.el是山寨的,是由于最重要的变量和参数加亮的实现原理是山寨的:用semantic得到单个函数的变量和参数list(这个还不算山寨),然后用highlight.el对函数范围内的变量和参数进行匹配加亮(就是这个就比较山寨). 我估计正常应该是用font-lock-add-keywords的高级功能来加亮,从而比较深的整合进emacs本身中. 不过我一直没有去深入的研究, 这个code也是按需要逐渐添加的. 虽然比较山寨,不过挺好用的. 下面是简单的介绍,很短, 看完了解了,有需要的朋友就可以拿来用了.<br />
<span id="more-41359"></span></p>
</div>
</div>
<div id="outline-container-2" class="outline-3">
<h3 id="sec-2"><span class="section-number-3">2</span> 有图为证, 图个痛快 </h3>
<div class="outline-text-3" id="text-2">
<div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/zjl-c-hl.png" rel="lightbox"><img src="screenshots/thumbs/thumbs_zjl-c-hl.png"/></a><p class="wp-caption-text">zjl-c-hl效果截图</p></div>
</div>
</div>
<div id="outline-container-3" class="outline-3">
<h3 id="sec-3"><span class="section-number-3">3</span> install </h3>
<div class="outline-text-3" id="text-3">
<p>到这儿下载zjl-c-hl.el(以后应该wiki上面会有)<a href="http://code.google.com/p/dea/source/browse/trunk/lisps/zjl-c-hl.el" target="_blank">http://code.google.com/p/dea/source/browse/trunk/lisps/zjl-c-hl.el</a><br />
这个包里面使用了emacswiki上的highlight.el,从这儿下载:<a href="http://www.emacswiki.org/emacs/highlight.el" target="_blank">http://www.emacswiki.org/emacs/highlight.el</a><br />
(require &#8216;zjl-c-hl)
</p>
</div>
</div>
<div id="outline-container-4" class="outline-3">
<h3 id="sec-4"><span class="section-number-3">4</span> Feature </h3>
<div class="outline-text-3" id="text-4">
<ul>
<li>
支持c文件, 如果是.cpp文件,内部实际是c,也可以:), 那种实际是cpp的,估计把zjl-c-hl-c++-mode-enable-flag为妥.
</li>
<li>
加亮对象包括:局部变量,函数引用, 操作符,数字. 加亮的结果是还剩下的黑白字(默认face)部分的则一定是全局变量,宏或错误的局部变量(比如输入错误).
</li>
<li>
加亮过的区域,不会再被加亮一次,除非函数内部被修改(参见下一条), 这样cpu资源消耗不大
</li>
<li>
函数内部被修改后,进行局部(实际上是整个函数的)重新加亮. 具体表现为,就是随着代码输入,延时1-3秒加亮.
</li>
<li>
颜色face可以customize,分为白背景和暗背景, 白背景的加亮face我尽量做成了source insight的默认颜色, 暗背景的我目前也是用的和白背景一样的face&hellip;, 我自己没怎么用过暗背景,觉得现在的也可以接受, 所以用户如果对暗背景的默认颜色不满意可以有两个选择</p>
<ol>
<li>
自己默默的改得符合自己喜好
</li>
<li>
改好了之后, 把custom.el发给我</p>
</li>
</ol>
</li>
</ul>
</div>
</div>
<div id="outline-container-5" class="outline-3">
<h3 id="sec-5"><span class="section-number-3">5</span> 缺陷 </h3>
<div class="outline-text-3" id="text-5">
<p>没有能够准确辨识出全局变量,宏,和函数调用导致:
</p>
<ol>
<li>
函数名/全局变量如果书写错误,无法实时得知,只能等待编译时知晓.
</li>
<li>
全局变量没有加亮,不能够和宏定义区分, 不像source insight那样看的自然</p>
</li>
</ol>
</div>
</div>
<div id="outline-container-6" class="outline-3">
<h3 id="sec-6"><span class="section-number-3">6</span> 可以customize的变量 </h3>
<div class="outline-text-3" id="text-6">
<p>我直接从代码里面copy过来了,将就着看</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p41359code9'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p413599"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code" id="p41359code9"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>defcustom zjl-c-hl-c-mode-enable-flag t
    <span style="color: #ff0000;">&quot;*Enable c mode highlight when zjl-c-hl-disable-global-all is called&quot;</span>
     'zjl-c-hl<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defcustom zjl-c-hl-c++-mode-enable-flag t
    <span style="color: #ff0000;">&quot;*Enable c++ mode highlight when zjl-c-hl-disable-global-all is called.
Currently only c style file but named as *.cpp is supported&quot;</span>
    <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> 'boolean <span style="color: #66cc66;">:</span><span style="color: #555;">group</span> 'zjl-c-hl<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defcustom zjl-c-hl-normal-size <span style="color: #cc66cc;">40000</span>
    <span style="color: #ff0000;">&quot;*The size of erea that zjl-c-hl can highlight without any delay.
You can improve this if your computer has enough performance.&quot;</span>
    <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> '<span style="color: #b1b100;">integer</span> <span style="color: #66cc66;">:</span><span style="color: #555;">group</span> 'zjl-c-hl<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defcustom zjl-c-hl-toobig-size <span style="color: #cc66cc;">10000000</span>
    <span style="color: #ff0000;">&quot;*The threshold size of function that zjl-c-hl will stop to highlight since it is too big. &quot;</span>
    <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> '<span style="color: #b1b100;">integer</span> <span style="color: #66cc66;">:</span><span style="color: #555;">group</span> 'zjl-c-hl<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defcustom zjl-c-hl-toobig-not-update-size <span style="color: #cc66cc;">1000000</span>
    <span style="color: #ff0000;">&quot;*The size of function that zjl-chl will stop to  highlight when the function is modified.&quot;</span>
    <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> '<span style="color: #b1b100;">integer</span> <span style="color: #66cc66;">:</span><span style="color: #555;">group</span> 'zjl-c-hl<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defcustom zjl-c-hl-numberofscreen-to-hl-each-time <span style="color: #cc66cc;">2</span>
    <span style="color: #ff0000;">&quot;*The number of screens around current screen to highlight every time.&quot;</span>
    <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> '<span style="color: #b1b100;">integer</span> <span style="color: #66cc66;">:</span><span style="color: #555;">group</span> 'zjl-c-hl<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defcustom zjl-c-hl-firstscreen-hl-toggle <span style="color: #b1b100;">nil</span>
    <span style="color: #ff0000;">&quot;*When not nil and when you open a new buffer, hl buffer before it shown on window.&quot;</span>
    <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> 'boolean <span style="color: #66cc66;">:</span><span style="color: #555;">group</span> 'zjl-c-hl<span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

</p>
</div>
</div>
<div id="outline-container-7" class="outline-3">
<h3 id="sec-7"><span class="section-number-3">7</span> 程序的骨干的说明-&mdash;给不满意效果想要自行修改代码的同志看的 </h3>
<div class="outline-text-3" id="text-7">
<p>入口函数是zjl-c-hl-enable-global-all, 这个函数根据c-mode/c++-mode分别调用zjl-c-hl-enable-global, zjl-c-hl-enable-global里面定义是
</p>
</div>
<div id="outline-container-7.1" class="outline-4">
<h4 id="sec-7.1"><span class="section-number-4">7.1</span> font-lock-add-keywords </h4>
<div class="outline-text-4" id="text-7.1">

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p41359code10'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4135910"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p41359code10"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>font-lock-add-keywords
     mode
     zjl-c-hl-c-mode-keywords
     <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>
zjl-c-hl-c-mode-keywords里面定义了operators, brackets, types, warning-words, number, member-reference, function-call, member-point加亮所需要的一切. 就是除了变量和参数加亮以外的所有的加亮靠这里实现
</p>
</div>
</div>
<div id="outline-container-7.2" class="outline-4">
<h4 id="sec-7.2"><span class="section-number-4">7.2</span> (add-hook hook &#8216;zjl-c-hl-init) </h4>
<div class="outline-text-4" id="text-7.2">
<p>加亮变量和参数,具体是挂载在window-scroll-functions这个hook来实现. 使用这个hook原因有两个
</p>
<ol>
<li>
避免semantic的后台自动load文件分析时也运行zjl-c-hl-init, 所以我们就需要有机制判断只有拥有window的buffer才会被执行zjl-c-hl.
</li>
<li>
每会用户scroll窗口的时候,也需要刷新新的位置的函数内部的加亮.
</li>
</ol>
<p>所以window-scroll-functions是很好的选择
</p>
<ul>
<li id="sec-7.2.1">(add-hook &#8216;window-scroll-functions &#8216;zjl-c-hl-window-scroll-hook t t) <br/>
<ul>
<li id="sec-7.2.1.1">如果是第一次运行这个hook则 <br/><br />
(add-hook &#8217;semantic-after-partial-cache-change-hook &#8216;zjl-c-hl-semantic-after-partial-cache-change-hook t t)  </p>
<p>
zjl-c-hl-semantic-after-partial-cache-change-hook(tags)的内容是
</p>
<ol>
<li>
semantic会把局部被更新的tags放在这个函数的调用参数里面, 里面包含了需要它重新分析过(由于buffer被修改导致的)的区域, 把这个区域标志为未加亮区域(具体是一个这样的list ((4 . 50) (100 . 300) (401 . 555)))
</li>
<li>
调用zjl-c-hl-window-scroll-hook,实时刷新一下当前窗口内容</p>
</li>
</ol>
</li>
<li id="sec-7.2.1.2">(run-with-idle-timer 0.5 nil &#8216;zjl-c-hl-timer-do-every-time (current-buffer)) <br/><br />
每次窗口移动后,用户idle时,加亮当前窗口内的变量和参数,具体是</p>
<ol>
<li>
设定范围A为当前窗口的前2个窗口的起始点所在的函数的开始和后2个窗口的末尾点所在的函数的结束
</li>
<li>
检查范围A中是否有没有被刷新的区域, 如果有找出来, 并分别加亮区域</p>
</li>
</ol>
<p>再之后,就是比较复杂的具体加亮,就不赘述了.
</p>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div id="postamble">
</div>

<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://emacser.com/zjl-c-hl.htm' t='高亮C的所有变量和函数' d='' tag='C/C++,CEDET,ede,Emacs,emacser,emacser.com,face,highlight,org,screenshot,semantic,zjl-c-hl,截图,配色,配色,颜色' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://emacser.com/wp-content/plugins/addthischina/a1.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://emacser.com/dea.htm" title="我的Emacs配置文件 － DEA (2009年11月11日)">我的Emacs配置文件 － DEA</a> (345)</li>
	<li><a href="http://emacser.com/built-in-cedet.htm" title="用CEDET浏览和编辑C++代码(续) &#8211; 使用Emacs 23.2内置的CEDET (2010年05月10日)">用CEDET浏览和编辑C++代码(续) &#8211; 使用Emacs 23.2内置的CEDET</a> (97)</li>
	<li><a href="http://emacser.com/cedet.htm" title="用CEDET浏览和编辑C++代码 (2010年03月18日)">用CEDET浏览和编辑C++代码</a> (185)</li>
	<li><a href="http://emacser.com/highlight-symbol.htm" title="Emacs才是世界上最强的IDE － 高亮光标处单词 (2009年11月27日)">Emacs才是世界上最强的IDE － 高亮光标处单词</a> (23)</li>
	<li><a href="http://emacser.com/emacs.htm" title="Emacs长啥样 (2009年11月5日)">Emacs长啥样</a> (15)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://emacser.com/zjl-c-hl.htm/feed</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
		<item>
		<title>Emacs才是世界上最强的IDE － 用linum+智能显示行号</title>
		<link>http://emacser.com/linum-plus.htm</link>
		<comments>http://emacser.com/linum-plus.htm#comments</comments>
		<pubDate>Fri, 02 Apr 2010 05:43:04 +0000</pubDate>
		<dc:creator>ahei</dc:creator>
				<category><![CDATA[IDE]]></category>
		<category><![CDATA[初级]]></category>
		<category><![CDATA[autoload]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[face]]></category>
		<category><![CDATA[linum+]]></category>
		<category><![CDATA[linum-plus]]></category>
		<category><![CDATA[org]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[截图]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[行号]]></category>
		<category><![CDATA[鼠标]]></category>

		<guid isPermaLink="false">http://emacser.com/?p=41085</guid>
		<description><![CDATA[稍微现代点的编辑器都有行号显示功能，行号显示是在buffer的左侧一栏显示当前buffer每行的行号，比较直观，但其实在以鼠标为中心的编辑器、IDE中，其实这个行号显示功能不大，但是在以纯键盘为中心的编辑器，如vi, Emacs中这个行号显示功能就非常方便了，它可以帮助你迅速定位到某行，知道了行号，直接通过M-x goto-line到达某行，非常方便。
但是Emacs比较“土”，Emacs23之前一直没有内置的行号显示功能，但是“土”归“土”，但是它很听话，你要怎样控制它就怎样控制它，所以诞生了一堆外置的行号显示插件，比如wb-line-number, setnu, setnu-plus, display-line-number, 虽然很多，但是都有一些小bug，不是很方便。Emacs23出来后，我欣喜的看到，它已经内置了行号显示功能，用的是linum-mode，既然是内置的，当然性能比较好，bug也比较少。它每次只显示当前buffer可视区域内的行号，而且用了一个小缓存的技巧，保证了性能，即使打开大文件也没问题。它的行号显示格式是通过linum-format来控制的，该值为&#8217;dynamic的话，就会动态控制行号的宽度，比如当前buffer最大行是3位数，那么行号的宽度就是3，这个format还可以设为固定的宽度，比如设置成&#8221;%4d&#8221;，那么始终显示成4个字符宽度。一般的编辑器用的都是那个&#8217;dynamic, 动态控制行号显示的宽度。
但是这个动态显示宽度还不够智能，比如当前buffer最大行的行号是3位数，我显示前面几行行号的时候，比如从1到50，没必要也用3个字符宽度来显示，只需要用2位就可以了，所以我写了一个linum+，来弥补linum这个缺点，linum+主要是重新定义了下linum里面更新行号的函数linum-update-window，代码如下：

?View Code LISP1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
;;;###autoload
&#40;defun linum+-generate-linum-format &#40;format-type limit&#41;
  &#34;Generate line number format by FORMAT-TYPE, LIMIT is `window-end' of win.&#34;
  &#40;cond &#40;&#40;stringp format-type&#41; format-type&#41;
        &#40;&#40;or &#40;listp format-type&#41; &#40;vectorp format-type&#41;
             &#40;eq [...]]]></description>
			<content:encoded><![CDATA[<p>稍微现代点的编辑器都有行号显示功能，行号显示是在buffer的左侧一栏显示当前buffer每行的行号，比较直观，但其实在以鼠标为中心的编辑器、IDE中，其实这个行号显示功能不大，但是在以纯键盘为中心的编辑器，如vi, Emacs中这个行号显示功能就非常方便了，它可以帮助你迅速定位到某行，知道了行号，直接通过M-x goto-line到达某行，非常方便。<span id="more-41085"></span></p>
<p>但是Emacs比较“土”，Emacs23之前一直没有内置的行号显示功能，但是“土”归“土”，但是它很听话，你要怎样控制它就怎样控制它，所以诞生了一堆外置的行号显示插件，比如wb-line-number, setnu, setnu-plus, display-line-number, 虽然很多，但是都有一些小bug，不是很方便。Emacs23出来后，我欣喜的看到，它已经内置了行号显示功能，用的是linum-mode，既然是内置的，当然性能比较好，bug也比较少。它每次只显示当前buffer可视区域内的行号，而且用了一个小缓存的技巧，保证了性能，即使打开大文件也没问题。它的行号显示格式是通过linum-format来控制的，该值为&#8217;dynamic的话，就会动态控制行号的宽度，比如当前buffer最大行是3位数，那么行号的宽度就是3，这个format还可以设为固定的宽度，比如设置成&#8221;%4d&#8221;，那么始终显示成4个字符宽度。一般的编辑器用的都是那个&#8217;dynamic, 动态控制行号显示的宽度。</p>
<p>但是这个动态显示宽度还不够智能，比如当前buffer最大行的行号是3位数，我显示前面几行行号的时候，比如从1到50，没必要也用3个字符宽度来显示，只需要用2位就可以了，所以我写了一个linum+，来弥补linum这个缺点，linum+主要是重新定义了下linum里面更新行号的函数linum-update-window，代码如下：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p41085code14'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4108514"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
</pre></td><td class="code" id="p41085code14"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;;;###autoload</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> linum+-generate-linum-format <span style="color: #66cc66;">&#40;</span>format-type limit<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Generate line number format by FORMAT-TYPE, LIMIT is `window-end' of win.&quot;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cond</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>stringp format-type<span style="color: #66cc66;">&#41;</span> format-type<span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">or</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">listp</span> format-type<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>vectorp format-type<span style="color: #66cc66;">&#41;</span>
             <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">eq</span> format-type 'dynamic<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">eq</span> format-type 'smart<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
         <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span>* <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>dynamic-width <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">or</span> <span style="color: #66cc66;">&#40;</span>vectorp format-type<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">eq</span> format-type 'smart<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#40;</span>old-format
                 <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">eq</span> format-type 'dynamic<span style="color: #66cc66;">&#41;</span>
                     linum+-dynamic-format
                   <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">eq</span> format-type 'smart<span style="color: #66cc66;">&#41;</span>
                       linum+-smart-format
                     format-type<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#40;</span>w <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">length</span>
                    <span style="color: #66cc66;">&#40;</span>number-to-string
                     <span style="color: #66cc66;">&#40;</span>line-number-at-pos <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> dynamic-width limit <span style="color: #66cc66;">&#40;</span>point-<span style="color: #b1b100;">max</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#40;</span>new-format
                 <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">listp</span> old-format<span style="color: #66cc66;">&#41;</span>
                     <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> old-format<span style="color: #66cc66;">&#41;</span>
                   <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>vectorp old-format<span style="color: #66cc66;">&#41;</span>
                       <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">aref</span> old-format <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
                     old-format<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
           <span style="color: #66cc66;">&#40;</span>format new-format w<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;;;###autoload</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> linum-update-window <span style="color: #66cc66;">&#40;</span>win<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Update line numbers for the portion visible in window WIN.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>goto-char <span style="color: #66cc66;">&#40;</span>window-start win<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span>* <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>line <span style="color: #66cc66;">&#40;</span>line-number-at-pos<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
         <span style="color: #66cc66;">&#40;</span>limit <span style="color: #66cc66;">&#40;</span>window-end win t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
         <span style="color: #66cc66;">&#40;</span>fmt <span style="color: #66cc66;">&#40;</span>linum+-generate-linum-format linum-format limit<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
         <span style="color: #66cc66;">&#40;</span>width <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>run-hooks 'linum-before-numbering-hook<span style="color: #66cc66;">&#41;</span>
    <span style="color: #808080; font-style: italic;">;; Create an overlay (or reuse an existing one) for each</span>
    <span style="color: #808080; font-style: italic;">;; line visible in this window, if necessary.</span>
    <span style="color: #66cc66;">&#40;</span>while <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">and</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">not</span> <span style="color: #66cc66;">&#40;</span>eobp<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&lt;=</span> <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span> limit<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span>* <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>str <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> fmt
                      <span style="color: #66cc66;">&#40;</span>propertize <span style="color: #66cc66;">&#40;</span>format fmt line<span style="color: #66cc66;">&#41;</span> 'face 'linum<span style="color: #66cc66;">&#41;</span>
                    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">funcall</span> linum-format line<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
             <span style="color: #66cc66;">&#40;</span>visited <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">catch</span> 'visited
                        <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">dolist</span> <span style="color: #66cc66;">&#40;</span>o <span style="color: #66cc66;">&#40;</span>overlays-in <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                          <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">when</span> <span style="color: #66cc66;">&#40;</span>equal-including-properties
                                 <span style="color: #66cc66;">&#40;</span>overlay-<span style="color: #b1b100;">get</span> o 'linum-str<span style="color: #66cc66;">&#41;</span> str<span style="color: #66cc66;">&#41;</span>
                            <span style="color: #66cc66;">&#40;</span>unless <span style="color: #66cc66;">&#40;</span>memq o linum-overlays<span style="color: #66cc66;">&#41;</span>
                              <span style="color: #66cc66;">&#40;</span>push o linum-overlays<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                            <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> linum-available <span style="color: #66cc66;">&#40;</span>delq o linum-available<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                            <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">throw</span> 'visited t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> width <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">max</span> width <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">length</span> str<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span>unless visited
          <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>ov <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null</span> linum-available<span style="color: #66cc66;">&#41;</span>
                        <span style="color: #66cc66;">&#40;</span>make-overlay <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">&#40;</span>move-overlay <span style="color: #66cc66;">&#40;</span>pop linum-available<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span>push ov linum-overlays<span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span>overlay-put ov 'before-string
                         <span style="color: #66cc66;">&#40;</span>propertize <span style="color: #ff0000;">&quot; &quot;</span> 'display `<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>margin left-margin<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">,</span>str<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span>overlay-put ov 'linum-str str<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span>forward-line<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> line <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>+ line<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>set-window-margins win width<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>其实这个linum-update-window改的很简单，主要是根据当前最大行号来制定一个宽度。<br />
linum+.el全文件在<a href="http://code.google.com/p/dea/source/browse/trunk/my-lisps/linum%2B.el" target="_blank">这里</a>下载。<br />
因为只有行号从n位数过度到n+1位数的时候，行号宽度才会发生改变，这种机会并不多，所以我这个linum+性能基本上和linum一样。</p>
<p>linum中, linum-format有可以有三种形式, string, &#8216;dynamic, 或者函数, 你使用了linum+以后，增加了三种形式, 分别是&#8217;smart, 含有一个字符串的list, 和含有一个字符串的vector, string和函数还和linum中的作用一样, &#8216;dynamic还是根据当前buffer最大行来控制最大的行号宽度, &#8217;smart则是智能根据当前可使范围内最大行号来控制行号显示宽度的, 如果是list的话, 则是根据list中的字符串来和当前最大行号的宽度一起作为format函数的参数来生成当前行号的格式，然后再用这个格式来显示行号，比如当前buffer显示的行数是从1到50，那么最大的行号是50，其宽度是2，list的值为&#8217;(&#8220;%%%dd|&#8221;), 那么当前buffer每行行号的显示格式就是：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p41085code15'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4108515"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p41085code15"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot;%%%dd|&quot;</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">=&gt;</span><span style="color: #ff0000;">&quot;%2d|&quot;</span></pre></td></tr></table></div>

<p>得到&#8221;%2d|&#8221;，然后当前buffer每行的行号显示格式就是&#8221;%2d|&#8221;了。<br />
当linum-format为vector的时候, 处理过程基本和list的一样, 唯一的差别就是行号的格式的时候, &#8220;%d&#8221;是用当前buffer最大行号的宽度去替换的, 比如当前最大行号是125, 其宽度是3, 那么当前buffer每行行号的显示格式就是:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p41085code16'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4108516"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p41085code16"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot;%%%dd|&quot;</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">=&gt;</span><span style="color: #ff0000;">&quot;%2d|&quot;</span></pre></td></tr></table></div>

<p>得到&#8221;%3d|&#8221;，然后当前buffer每行的行号显示格式就是&#8221;%2d|&#8221;了。<br />
其实, linum+内部实现时, &#8216;dynamic和&#8217;(&#8220;%%%dd|&#8221;)作用一样, &#8217;smart和["%%%dd|"]作用一样. 你不喜欢&#8217;smart后面的&#8221;|&#8221;的话, 把linum-format设置为["%%%dd"]就可以了.<br />
如果你喜欢linum中的&#8217;dynamic, 根据buffer最大的行号生成固定的宽度, 而不喜欢linum+中&#8217;smart那样动态变化的宽度, 你仍然可以把linum-format配置成&#8217;dynamic, 或者配置成list, 比如&#8217;(&#8220;%%%dd&#8221;), 这样既可以享受固定的宽度, 又可以享受可配置的格式(linum中linum-format为&#8217;dynamic, 行号的格式你是控制不了的)</p>
<p>下面是linum+的截图：</p>
<table border="0">
<tr>
<td>
      <div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/linum+/linum+1.png" rel="lightbox"><img src="screenshots/linum+/thumbs/thumbs_linum+1.png" width="150" height="150" /></a><p class="wp-caption-text">用linum+智能显示行号</p></div>
    </td>
<td>
      <div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/linum+/linum+2.png" rel="lightbox"><img src="screenshots/linum+/thumbs/thumbs_linum+2.png" width="150" height="150" /></a><p class="wp-caption-text">用linum+智能显示行号</p></div>
    </td>
</tr>
</table>

<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://emacser.com/linum-plus.htm' t='Emacs才是世界上最强的IDE － 用linum+智能显示行号' d='' tag='autoload,Emacs,face,IDE,linum+,linum-plus,org,screenshot,截图,插件,行号,鼠标' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://emacser.com/wp-content/plugins/addthischina/a1.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://emacser.com/dea.htm" title="我的Emacs配置文件 － DEA (2009年11月11日)">我的Emacs配置文件 － DEA</a> (345)</li>
	<li><a href="http://emacser.com/emacs.htm" title="Emacs长啥样 (2009年11月5日)">Emacs长啥样</a> (15)</li>
	<li><a href="http://emacser.com/w3m.htm" title="Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页 (2009年11月23日)">Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页</a> (39)</li>
	<li><a href="http://emacser.com/emacs-cpp-dev.htm" title="在Emacs下用C/C++编程 (2010年10月25日)">在Emacs下用C/C++编程</a> (33)</li>
	<li><a href="http://emacser.com/cedet.htm" title="用CEDET浏览和编辑C++代码 (2010年03月18日)">用CEDET浏览和编辑C++代码</a> (185)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://emacser.com/linum-plus.htm/feed</wfw:commentRss>
		<slash:comments>87</slash:comments>
		</item>
		<item>
		<title>Emacs的Jabber客户端</title>
		<link>http://emacser.com/jabber.htm</link>
		<comments>http://emacser.com/jabber.htm#comments</comments>
		<pubDate>Thu, 11 Mar 2010 06:39:59 +0000</pubDate>
		<dc:creator>ahei</dc:creator>
				<category><![CDATA[其他]]></category>
		<category><![CDATA[初级]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[jabber]]></category>
		<category><![CDATA[org]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[waterlin]]></category>
		<category><![CDATA[截图]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[配色]]></category>

		<guid isPermaLink="false">http://emacser.com/?p=40951</guid>
		<description><![CDATA[作者: Water Lin


通过使用 Jabber 插件，可以在 Emacs 里进行即时通讯聊天，相关截图可以在 Emacs-wiki 上看到，怎么样，很不错吧？！我们可以通过 Jabber 来在 Emacs 里使用若干即时通讯工具，这里就以 Gtalk 为例简单说明一下 Jabber 的基本使用方法。


Ubuntu/Debian 上可以直接从源里安装 emacs-jabber 的软件包。


例如，我要配置 Google Talk 的话，可以在 .emacs 里用下面的方法来配置：


?View Code LISP1
2
3
4
&#40;setq jabber-account-list
      '&#40;&#40;&#34;waterlin.org@gmail.com&#34;
         &#40;:network-server . &#34;talk.google.com&#34;&#41;
         &#40;:connection-type . [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #0000ff;">作者: </span><a href="about.htm#WaterLin" target="_blank"><span style="color: #0000ff;"><b>Water Lin</b></span></a></p>
<p><img class="alignright" title="Jabber" src="screenshots/jabber-logo.png"/></p>
<p>
通过使用 <a href="http://emacs-jabber.sourceforge.net/" target="_blank">Jabber</a> 插件，可以在 Emacs 里进行即时通讯聊天，<a href="http://www.emacswiki.org/emacs/JabberEl" target="_blank">相关截图可以在 Emacs-wiki 上看到</a>，怎么样，很不错吧？！我们可以通过 Jabber 来在 Emacs 里使用若干即时通讯工具，这里就以 <a href="http://www.emacswiki.org/emacs/GoogleTalk" target="_blank">Gtalk</a> 为例简单说明一下 Jabber 的基本使用方法。<span id="more-40951"></span>
</p>
<p>
Ubuntu/Debian 上可以直接从源里安装 emacs-jabber 的软件包。
</p>
<p>
例如，我要配置 Google Talk 的话，可以在 .emacs 里用下面的方法来配置：
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40951code18'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4095118"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p40951code18"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> jabber-account-<span style="color: #b1b100;">list</span>
      '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;waterlin.org@gmail.com&quot;</span>
         <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">:</span><span style="color: #555;">network-server</span> <span style="color: #66cc66;">.</span> <span style="color: #ff0000;">&quot;talk.google.com&quot;</span><span style="color: #66cc66;">&#41;</span>
         <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">:</span><span style="color: #555;">connection-type</span> <span style="color: #66cc66;">.</span> ssl<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>
配置好了以后，可以用 M-x jabber-connect 来登陆，它会让你输入 JID，你直接输入你设置好的邮箱名即可。
</p>
<p>
登录成功后，Emacs 会有一个 *-jabber-roster-* 的 buffer，从里面就能找到你想聊天的人一起聊天。
</p>
<p>
和某个人聊天的话，就用 M-x jabber-chat-with 命令，输入某个人的帐号，或者直接从 *-jabber-roster-* buffer 里找到某人的帐号并按回车，就会出现 *-jabber-chat-:-person-* 这样的一个 buffer。在这个 Buffer 里，你就可以和他/她聊天了。如果对方有消息过来，Emacs 会在 minibuffer 里提示对方的名字，提示你有新的消息。
</p>
<p>
聊天时，用回车就是发送消息，用 C-j 就是新建一行输入消息。
</p>
<p>
默认情况下，你会显示为在线状态，如果需要修改状态，例如修改为 away，可以用命令 M-x jabber-send-presence 或快捷键 C-x C-j C-p 来切换状态。
</p>
<p>
其它常用命令：
</p>
<ul>
<li>
要退出用 M-x jabber-disconnect 命令即可；
</li>
<li>
要添加某人为好友，可以用命令 <a href="http://emacs-jabber.sourceforge.net/manual-0.7.1/Presence-subscription.html#Presence-subscription" target="_blank">M-x jabber-send-subscription-request</a>；
</li>
<li>
用命令 M-x jabber-customize 可以对 jabber 进行基本的配置。
</li>
</ul>
<p>这个玩意不错，尤其是作为 Linux 下面的 Gtalk 客户端挺好的，不仅能聊天，同时也支持在 Gmail 里保存聊天记录。</p>

<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://emacser.com/jabber.htm' t='Emacs的Jabber客户端' d='' tag='Emacs,jabber,org,screenshot,ubuntu,waterlin,截图,插件,配色,配色' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://emacser.com/wp-content/plugins/addthischina/a1.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://emacser.com/weblogger.htm" title="用weblogger写WordPress博客 (2010年03月3日)">用weblogger写WordPress博客</a> (100)</li>
	<li><a href="http://emacser.com/w3m.htm" title="Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页 (2009年11月23日)">Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页</a> (39)</li>
	<li><a href="http://emacser.com/zjl-c-hl.htm" title="高亮C的所有变量和函数 (2010年05月17日)">高亮C的所有变量和函数</a> (44)</li>
	<li><a href="http://emacser.com/built-in-cedet.htm" title="用CEDET浏览和编辑C++代码(续) &#8211; 使用Emacs 23.2内置的CEDET (2010年05月10日)">用CEDET浏览和编辑C++代码(续) &#8211; 使用Emacs 23.2内置的CEDET</a> (97)</li>
	<li><a href="http://emacser.com/dea.htm" title="我的Emacs配置文件 － DEA (2009年11月11日)">我的Emacs配置文件 － DEA</a> (345)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://emacser.com/jabber.htm/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>用性感的尾巴highlight-tail标记最近的修改</title>
		<link>http://emacser.com/highlight-tail.htm</link>
		<comments>http://emacser.com/highlight-tail.htm#comments</comments>
		<pubDate>Fri, 26 Feb 2010 03:33:01 +0000</pubDate>
		<dc:creator>ahei</dc:creator>
				<category><![CDATA[其他]]></category>
		<category><![CDATA[初级]]></category>
		<category><![CDATA[好玩的]]></category>
		<category><![CDATA[buffer]]></category>
		<category><![CDATA[CEDET]]></category>
		<category><![CDATA[ede]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[highlight-tail]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[mode]]></category>
		<category><![CDATA[pulse]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[se]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[截图]]></category>
		<category><![CDATA[淡入淡出]]></category>
		<category><![CDATA[配置]]></category>
		<category><![CDATA[配色]]></category>
		<category><![CDATA[颜色]]></category>

		<guid isPermaLink="false">http://emacser.com/?p=40758</guid>
		<description><![CDATA[
昨天写了文章《用pulse实现Emacs的淡入淡出效果》后，wd给我留言让我试试highlight-tail，我google了一下，原来wd和sssslang，xwl聚会的时候，wd从xwl那看到的highlight-tail。看来有牛人在用，肯定挺有意思的，遂去它的主页down下来，试了一把，果然效果不同凡响，遂拿来跟大家一起分享。
cedet有个功能，就是它会标记出你buffer中最近的修改，一看就能知道哪修改了，挺实用的，效果如下：
上图中的朦朦胧胧的灰色区域就是cedet标记的修改的部分。
highlight-tail也是干这个的，它会用渐变颜色标记出你最近的修改，不过更漂亮了。highlight-tail的作者Rafal Jedruszek很幽默的说：

So from now on, your Emacs will be even more sexy! ;o )

确实，用上highlight-tail你的emacs会更性感，吸引小MM必备，  
现在你是不是非常想看看highlight-tail到底长啥样子，看下面的截图：
作者还录了一段视频，可惜链接失效了，不急，所以我自己也录制了一段，这里观看视频。
看完上面的视频觉得怎么样？果然很sexy吧！  
highlight-tail使用很简单，require后，打开highlight-tail-mode，就可以使用了，当你对buffer内容修改之后，修改的内容就会以渐变的颜色标记出来。它的配置选项主要是：highlight-tail-colors控制渐变颜色(重新设置了这个变量后想要生效的话需要重启一下highlight-tail-mode，方法是执行两次M-x highlight-tail-mode)。作者默认设置的highlight-tail-colors比较适合白底黑字的界面，他还在highlight-tail-colors的文档里提供了另外一个比较好看的适合白底黑字的颜色：

?View Code LISP1
2
3
4
&#40;setq highlight-tail-colors
        '&#40;&#40;&#34;#c1e156&#34; . 0&#41;
          &#40;&#34;#b8ff07&#34; . 25&#41;
          &#40;&#34;#00c377&#34; . [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="highlight-tail" src="screenshots/highlight-tail/highlight-tail.gif"/></p>
<p>昨天写了文章<a href="pulse.htm" target="_blank">《用pulse实现Emacs的淡入淡出效果》</a>后，<a href="http://wdicc.com/" target="_blank">wd</a>给我留言让我试试<a href="http://blog.arithm.com/2008/04/12/highlight-tail-for-emacs/" target="_blank">highlight-tail</a>，我google了一下，原来wd和<a href="http://twitter.com/sssslang" target="_blank">sssslang</a>，<a href="xwl.appspot.com" target="_blank">xwl</a><a href="http://wdicc.com/party-with-sssslang-and-xwl/" target="_blank">聚会</a>的时候，wd从xwl那看到的highlight-tail。看来有牛人在用，肯定挺有意思的，遂去它的主页down下来，试了一把，果然效果不同凡响，遂拿来跟大家一起分享。<span id="more-40758"></span></p>
<p>cedet有个功能，就是它会标记出你buffer中最近的修改，一看就能知道哪修改了，挺实用的，效果如下：<br />
<div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/cedet/cedet-mark-modify.png" rel="lightbox"><img title="cedet标记的修改的部分" src="screenshots/cedet/thumbs/thumbs_cedet-mark-modify.png" alt="cedet标记的修改的部分" width="150" height="150" /></a><p class="wp-caption-text">cedet标记的修改的部分</p></div><br />
上图中的朦朦胧胧的灰色区域就是cedet标记的修改的部分。</p>
<p>highlight-tail也是干这个的，它会用渐变颜色标记出你最近的修改，不过更漂亮了。highlight-tail的作者<a href="mailto:necui-emahte@nic-nac-project.net">Rafal Jedruszek</a>很幽默的说：</p>
<pre>
So from now on, your Emacs will be even more sexy! ;o )
</pre>
<p>确实，用上highlight-tail你的emacs会更性感，吸引小MM必备， <img src='http://emacser.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>现在你是不是非常想看看highlight-tail到底长啥样子，看下面的截图：<br />
<div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/highlight-tail/highlight-tail.png" rel="lightbox"><img title="性感的尾巴highlight-tail" src="screenshots/highlight-tail/thumbs/thumbs_highlight-tail.png" alt="性感的尾巴highlight-tail" width="150" height="150" /></a><p class="wp-caption-text">性感的尾巴highlight-tail</p></div><br />
作者还录了一段<a href="http://nic-nac-project.net/~necui/img/htshow.gif" target="_blank">视频</a>，可惜链接失效了，不急，所以我自己也录制了一段，<a href="highlight-tail-video.htm" target="_blank"><span style="color: #0000ff;">这里</span></a>观看视频。</p>
<p>看完上面的视频觉得怎么样？果然很sexy吧！ <img src='http://emacser.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>highlight-tail使用很简单，require后，打开highlight-tail-mode，就可以使用了，当你对buffer内容修改之后，修改的内容就会以渐变的颜色标记出来。它的配置选项主要是：highlight-tail-colors控制渐变颜色(重新设置了这个变量后想要生效的话需要重启一下highlight-tail-mode，方法是执行两次M-x highlight-tail-mode)。作者默认设置的highlight-tail-colors比较适合白底黑字的界面，他还在highlight-tail-colors的文档里提供了另外一个比较好看的适合白底黑字的颜色：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40758code21'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4075821"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p40758code21"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> highlight-tail-colors
        '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;#c1e156&quot;</span> <span style="color: #66cc66;">.</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
          <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;#b8ff07&quot;</span> <span style="color: #66cc66;">.</span> <span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span>
          <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;#00c377&quot;</span> <span style="color: #66cc66;">.</span> <span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>其效果图如下：<br />
<div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/highlight-tail/highlight-tail-white-black.png" rel="lightbox"><img title="性感的尾巴highlight-tail" src="screenshots/highlight-tail/thumbs/thumbs_highlight-tail-white-black.png" alt="性感的尾巴highlight-tail" width="150" height="150" /></a><p class="wp-caption-text">性感的尾巴highlight-tail</p></div><br />
如果你像我一样比较喜欢黑底白字的话，可以试试作者在黑底白字下的颜色设置：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40758code22'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4075822"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p40758code22"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> highlight-tail-colors
          '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;black&quot;</span> <span style="color: #66cc66;">.</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;#bc2525&quot;</span> <span style="color: #66cc66;">.</span> <span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;black&quot;</span> <span style="color: #66cc66;">.</span> <span style="color: #cc66cc;">66</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>其效果图如下：<br />
<div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/highlight-tail/highlight-tail-black-white.png" rel="lightbox"><img title="性感的尾巴highlight-tail" src="screenshots/highlight-tail/thumbs/thumbs_highlight-tail-black-white.png" alt="性感的尾巴highlight-tail" width="150" height="150" /></a><p class="wp-caption-text">性感的尾巴highlight-tail</p></div><br />
highlight-tail-posterior-type控制渐变的方式，如果该值为t，就渐变所有的修改，如果为&#8217;const则渐变固定长度的修改，而这个长度则是由highlight-tail-const-width来控制的。至于它的速度，也还不错，不会耗你的cpu，据作者测试，你一直按着某个字母的话，也就占15%左右，如果你还嫌它占cpu的话，你可以把highlight-tail-steps调小，把highlight-tail-timer调大，这样占的cpu就会更少了。</p>

<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://emacser.com/highlight-tail.htm' t='用性感的尾巴highlight-tail标记最近的修改' d='' tag='buffer,CEDET,ede,Emacs,highlight,highlight-tail,IDE,lightbox,mode,pulse,screenshot,se,twitter,vi,截图,淡入淡出,配置,配色,配色,颜色' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://emacser.com/wp-content/plugins/addthischina/a1.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://emacser.com/emacs.htm" title="Emacs长啥样 (2009年11月5日)">Emacs长啥样</a> (15)</li>
	<li><a href="http://emacser.com/pulse.htm" title="用pulse实现Emacs的淡入淡出效果 (2010年02月25日)">用pulse实现Emacs的淡入淡出效果</a> (17)</li>
	<li><a href="http://emacser.com/highlight-symbol.htm" title="Emacs才是世界上最强的IDE － 高亮光标处单词 (2009年11月27日)">Emacs才是世界上最强的IDE － 高亮光标处单词</a> (23)</li>
	<li><a href="http://emacser.com/svn-status-mode-line.htm" title="在mode-line上标记svn状态 (2010年01月28日)">在mode-line上标记svn状态</a> (30)</li>
	<li><a href="http://emacser.com/mode-line.htm" title="Emacs的状态栏 － mode-line (2009年11月17日)">Emacs的状态栏 － mode-line</a> (21)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://emacser.com/highlight-tail.htm/feed</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
		<item>
		<title>在mode-line上标记svn状态</title>
		<link>http://emacser.com/svn-status-mode-line.htm</link>
		<comments>http://emacser.com/svn-status-mode-line.htm#comments</comments>
		<pubDate>Wed, 27 Jan 2010 23:06:51 +0000</pubDate>
		<dc:creator>ahei</dc:creator>
				<category><![CDATA[Elisp]]></category>
		<category><![CDATA[mode-line]]></category>
		<category><![CDATA[中级]]></category>
		<category><![CDATA[好玩的]]></category>
		<category><![CDATA[buffer]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[mode]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[svn-status]]></category>
		<category><![CDATA[定制]]></category>
		<category><![CDATA[截图]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[状态栏]]></category>
		<category><![CDATA[编译]]></category>
		<category><![CDATA[配置]]></category>
		<category><![CDATA[配置文件]]></category>
		<category><![CDATA[配色]]></category>
		<category><![CDATA[颜色]]></category>

		<guid isPermaLink="false">http://emacser.com/?p=40664</guid>
		<description><![CDATA[
psvn.el是一款Emacs下的svn插件，前段时间把Emacs升级到23，升级整理的过程中，看到psvn.el，遂去它的主页把它的最新版本down下来，试了一下，果然功能又强大多了，一个我一直想要的功能就是在mode-line上显示当前文件的svn状态，比如是否修改过，就像下面这样：
psvn用一个带有颜色的圆表示文件的状态，绿色的圆表示未修改过，淡红色的圆表示已经修改过。
由于psvn包只有一个文件psvn.el，所以它那个圆应该不是事先做好的图片，应该是程序里面生成的。那这个就比较有意思了，竟然可以在Emacs中画圆，赶快去瞧瞧它是杂实现的。
由于这个圆是在mode-line上画的，直接去psvn.el里面去搜索mode-line，搜到一个mode-line-process，还有一个：

?View Code LISP&#40;setq svn-status-mode-line-process-status &#40;format &#34; running %s&#34; cmdtype&#41;&#41;

平时运行svn-status命令的时候，会看到状态栏显示running，看来是控制这个mode-line-process来实现的，看一下mode-line-process的文档：

?View Code LISP1
2
3
4
5
6
7
8
mode-line-process is a variable defined in `bindings.el'.
Its value is nil
&#160;
  Automatically becomes buffer-local when set in any fashion.
&#160;
Documentation:
Mode-line control for displaying info on process status.
Normally nil in most modes, since there is no process to display.

看来真是它，我们来试试：

?View Code LISP&#40;setq mode-line-process &#34; hi, I'm mode-line-process&#34;&#41;

C-x C-e执行上面的语句，mode-line变成：
果然!
继续搜索mode-line，找到一个函数：

?View [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="Subversion" src="screenshots/subversion-logo.png" width="110" height="90"/></p>
<p><a href="http://www.xsteve.at/prg/vc_svn/" target="_blank">psvn.el</a>是一款Emacs下的svn插件，前段时间把Emacs升级到23，升级整理的过程中，看到psvn.el，遂去它的主页把它的最新版本down下来，试了一下，果然功能又强大多了，一个我一直想要的功能就是在<a href="mode-line.htm" target="_blank">mode-line</a>上显示当前文件的svn状态，比如是否修改过，就像下面这样：<span id="more-40664"></span><br />
<div class="wp-caption alignnone" style="width: 596px"><a href="screenshots/svn/svn-mode-line-up-to-date.png" rel="lightbox"><img src="screenshots/svn/svn-mode-line-up-to-date.png" width="964" height="175" /></a><p class="wp-caption-text">svn文件，未修改</p></div><br />
<div class="wp-caption alignnone" style="width: 596px"><a href="screenshots/svn/svn-mode-line-edited.png" rel="lightbox"><img src="screenshots/svn/svn-mode-line-edited.png" width="964" height="175" /></a><p class="wp-caption-text">svn文件，已修改</p></div><br />
<div class="wp-caption alignnone" style="width: 596px"><a href="screenshots/svn/svn-mode-line-added.png" rel="lightbox"><img src="screenshots/svn/svn-mode-line-added.png" width="964" height="175" /></a><p class="wp-caption-text">svn文件，刚增加</p></div><br />
psvn用一个带有颜色的圆表示文件的状态，绿色的圆表示未修改过，淡红色的圆表示已经修改过。</p>
<p>由于psvn包只有一个文件psvn.el，所以它那个圆应该不是事先做好的图片，应该是程序里面生成的。那这个就比较有意思了，竟然可以在Emacs中画圆，赶快去瞧瞧它是杂实现的。</p>
<p>由于这个圆是在mode-line上画的，直接去psvn.el里面去搜索mode-line，搜到一个mode-line-process，还有一个：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code41'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066441"><td class="code" id="p40664code41"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> svn-status-mode-line-process-status <span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot; running %s&quot;</span> cmdtype<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>平时运行svn-status命令的时候，会看到状态栏显示running，看来是控制这个mode-line-process来实现的，看一下mode-line-process的文档：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code42'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066442"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p40664code42"><pre class="lisp" style="font-family:monospace;">mode-line-process is a variable defined in `bindings<span style="color: #66cc66;">.</span>el'<span style="color: #66cc66;">.</span>
Its <span style="color: #b1b100;">value</span> is <span style="color: #b1b100;">nil</span>
&nbsp;
  Automatically becomes buffer-local <span style="color: #b1b100;">when</span> <span style="color: #b1b100;">set</span> in any fashion<span style="color: #66cc66;">.</span>
&nbsp;
Documentation<span style="color: #66cc66;">:</span>
<span style="color: #555;">Mode-line</span> control for displaying info on process status<span style="color: #66cc66;">.</span>
Normally <span style="color: #b1b100;">nil</span> in most modes<span style="color: #66cc66;">,</span> since there is no process to display<span style="color: #66cc66;">.</span></pre></td></tr></table></div>

<p>看来真是它，我们来试试：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code43'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066443"><td class="code" id="p40664code43"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> mode-line-process <span style="color: #ff0000;">&quot; hi, I'm mode-line-process&quot;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>C-x C-e执行上面的语句，mode-line变成：<br />
<div class="wp-caption alignnone" style="width: 596px"><a href="screenshots/mode-line/mode-line-process.png" rel="lightbox"><img src="screenshots/mode-line/mode-line-process.png" width="964" height="175" /></a><p class="wp-caption-text">mode-line-process</p></div><br />
果然!</p>
<p>继续搜索mode-line，找到一个函数：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code44'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066444"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code" id="p40664code44"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> svn-status-state-mark-modeline-dot <span style="color: #66cc66;">&#40;</span>color<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>propertize <span style="color: #ff0000;">&quot;    &quot;</span>
              'help-echo 'svn-status-state-mark-tooltip
              'display
              `<span style="color: #66cc66;">&#40;</span>image <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> xpm
                      <span style="color: #66cc66;">:</span><span style="color: #555;">data</span> <span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot;/* XPM */
static char * data[] = {
<span style="color: #000099; font-weight: bold;">\&quot;</span>18 13 3 1<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>  c None<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>+ c #000000<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>. c %s<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>                  <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>       +++++      <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>      +.....+     <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>     +.......+    <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    +.........+   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    +.........+   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    +.........+   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    +.........+   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    +.........+   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>     +.......+    <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>      +.....+     <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>       +++++      <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>                  <span style="color: #000099; font-weight: bold;">\&quot;</span>};&quot;</span>
                                     color<span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">:</span><span style="color: #555;">ascent</span> center<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>看这函数名，代码和图形，有点像是它画的圆，那么我们再来看看这个svn-status-state-mark-modeline-dot函数都哪里调用了。继续查找，只有一个地方调用了：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code45'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066445"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p40664code45"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> svn-status-install-state-mark-modeline <span style="color: #66cc66;">&#40;</span>color<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>push `<span style="color: #66cc66;">&#40;</span>svn-status-state-mark-modeline
          <span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span>svn-status-state-mark-modeline-dot color<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        mode-line-format<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>force-mode-line-update t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>而svn-status-install-state-mark-modeline是svn-status-update-state-mark调用的，svn-status-update-modeline又调用了svn-status-update-state-mark，看来没错了，应该就是svn-status-state-mark-modeline-dot画的圆，为了更加确定一点，来做个实验。</p>
<p>改下svn-status-state-mark-modeline-dot的函数变成这样：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code46'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066446"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code" id="p40664code46"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> generate-circle <span style="color: #66cc66;">&#40;</span>tip space edge inside<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Generate a circle.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>propertize <span style="color: #ff0000;">&quot; &quot;</span>
              'help-echo tip
              'display
              `<span style="color: #66cc66;">&#40;</span>image <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> xpm
                      <span style="color: #66cc66;">:</span><span style="color: #555;">data</span> <span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot;/* XPM */
static char * data[] = {
<span style="color: #000099; font-weight: bold;">\&quot;</span>18 13 3 1<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>  c %s<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>+ c %s<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>. c %s<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>                  <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>       +++++      <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>      +.....+     <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>     +.......+    <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    +.........+   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    +.........+   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    +.........+   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    +.........+   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    +.........+   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>     +.......+    <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>      +.....+     <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>       +++++      <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>                  <span style="color: #000099; font-weight: bold;">\&quot;</span>
};&quot;</span>
                                     space edge inside<span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">:</span><span style="color: #555;">ascent</span> center<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>然后执行下面的代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code47'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066447"><td class="code" id="p40664code47"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>insert <span style="color: #66cc66;">&#40;</span>generate-circle <span style="color: #ff0000;">&quot;我是圆&quot;</span> <span style="color: #ff0000;">&quot;None&quot;</span> <span style="color: #ff0000;">&quot;black&quot;</span> <span style="color: #ff0000;">&quot;red&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>出现下面的截图：<br />
<div class="wp-caption alignnone" style="width: 596px"><a href="screenshots/circle/emacs-circle.png" rel="lightbox"><img src="screenshots/circle/emacs-circle.png" width="964" height="175" /></a><p class="wp-caption-text">emacs中画圆</p></div></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code48'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066448"><td class="code" id="p40664code48"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>insert <span style="color: #66cc66;">&#40;</span>generate-circle <span style="color: #ff0000;">&quot;我是月环食&quot;</span> <span style="color: #ff0000;">&quot;None&quot;</span> <span style="color: #ff0000;">&quot;yellow&quot;</span> <span style="color: #ff0000;">&quot;red&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p><div class="wp-caption alignnone" style="width: 596px"><a href="screenshots/circle/moon-circle.png" rel="lightbox"><img src="screenshots/circle/moon-circle.png" width="964" height="175" /></a><p class="wp-caption-text">emacs中画月环食</p></div><br />
再来一张膏药旗</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code49'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066449"><td class="code" id="p40664code49"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>insert <span style="color: #66cc66;">&#40;</span>generate-circle <span style="color: #ff0000;">&quot;我是膏药旗&quot;</span> <span style="color: #ff0000;">&quot;white&quot;</span> <span style="color: #ff0000;">&quot;yellow&quot;</span> <span style="color: #ff0000;">&quot;red&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p><div class="wp-caption alignnone" style="width: 596px"><a href="screenshots/circle/plaster-flag.png" rel="lightbox"><img src="screenshots/circle/plaster-flag.png" width="964" height="175" /></a><p class="wp-caption-text">Emacs中画膏药旗</p></div><br />
再画个立方体：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code50'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066450"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
</pre></td><td class="code" id="p40664code50"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> generate-cube <span style="color: #66cc66;">&#40;</span>tip<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Generate a cube.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>propertize <span style="color: #ff0000;">&quot; &quot;</span>
              'help-echo tip
              'display
              `<span style="color: #66cc66;">&#40;</span>image <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> xpm
                      <span style="color: #66cc66;">:</span><span style="color: #555;">data</span> <span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot;/* XPM */
static char * data[] = {
<span style="color: #000099; font-weight: bold;">\&quot;</span>32 39 5 1<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.      c none<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>+      c black<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>@      c #3070E0<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>#      c #F05050<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>$      c #35E035<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>................+...............<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>..............+++++.............<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>............+++++@@++...........<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>..........+++++@@@@@@++.........<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>........++++@@@@@@@@@@++........<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>......++++@@++++++++@@@++.......<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.....+++@@@+++++++++++@@@++.....<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>...+++@@@@+++@@@@@@++++@@@@+....<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>..+++@@@@+++@@@@@@@@+++@@@@@++..<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.++@@@@@@+++@@@@@@@@@@@@@@@@@@++<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+#+@@@@@@++@@@@+++@@@@@@@@@@@@+<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+##++@@@@+++@@@+++++@@@@@@@@$@.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+###++@@@@+++@@@+++@@@@@++$$$@.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+####+++@@@+++++++@@@@@+@$$$$@.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+#####+++@@@@+++@@@@++@$$$$$$+.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+######++++@@@@@@@++@$$$$$$$$+.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+#######+##+@@@@+++$$$$$$@@$$+.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+###+++##+##+@@++@$$$$$$++$$$+.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+###++++##+##+@@$$$$$$$@+@$$@+.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+###++++++#+++@$$@+@$$@++$$$@+.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+####+++++++#++$$@+@$$++$$$$+..<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.++####++++++#++$$@+@$++@$$$$+..<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+#####+++++##++$$++@+++$$$$$+..<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.++####+++##+#++$$+++++@$$$$$+..<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.++####+++####++$$++++++@$$$@+..<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+#####++#####++$$+++@++++@$@+..<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+#####++#####++$$++@$$@+++$@@..<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.++####++#####++$$++$$$$$+@$@++.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.++####++#####++$$++$$$$$$$$+++.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.+++####+#####++$$++$$$$$$$@+++.<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>..+++#########+@$$+@$$$$$$+++...<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>...+++########+@$$$$$$$$@+++....<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.....+++######+@$$$$$$$+++......<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>......+++#####+@$$$$$@++........<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.......+++####+@$$$$+++.........<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.........++###+$$$@++...........<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>..........++##+$@+++............<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>...........+++++++..............<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.............++++...............<span style="color: #000099; font-weight: bold;">\&quot;</span>
};&quot;</span>
                                     <span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">:</span><span style="color: #555;">ascent</span> center<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code51'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066451"><td class="code" id="p40664code51"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>insert <span style="color: #66cc66;">&#40;</span>generate-cube <span style="color: #ff0000;">&quot;我是立方体&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p><div class="wp-caption alignnone" style="width: 596px"><a href="screenshots/circle/emacs-cube.png" rel="lightbox"><img src="screenshots/circle/emacs-cube.png" width="964" height="175" /></a><p class="wp-caption-text">Emacs中画立方体</p></div><br />
再来一张更眩的：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code52'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066452"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code" id="p40664code52"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> generate-compact-disk <span style="color: #66cc66;">&#40;</span>tip<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Generate one compact disk.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>propertize <span style="color: #ff0000;">&quot; &quot;</span>
              'help-echo tip
              'display
              `<span style="color: #66cc66;">&#40;</span>image <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> xpm
                      <span style="color: #66cc66;">:</span><span style="color: #555;">data</span> <span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot;/* XPM */
static char * data[] = {
<span style="color: #000099; font-weight: bold;">\&quot;</span>16 16 8 1<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>    c None s None<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.   c #808080<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>X   c #FFFF00<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>o   c #c0c0c0<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>O   c black<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>+   c #00FFFF<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>@   c #00FF00<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>#   c white<span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>     .....      <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>   ..XXoooOO    <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>  .+XXXoooooO   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span> .@++XXoooo#oO  <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span> .@@+XXooo#ooO  <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.oo@@+Xoo#ooooO <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.ooo@+.O.oooooO <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.oooo@O#OoooooO <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.oooo#.O.+ooooO <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>.ooo#oo#@X+oooO <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span> .o#oooo@X++oO  <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span> .#ooooo@XX++O  <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>  .ooooo@@XXO   <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>   ..ooo@@OO    <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>     ..OOO      <span style="color: #000099; font-weight: bold;">\&quot;</span>,
<span style="color: #000099; font-weight: bold;">\&quot;</span>                <span style="color: #000099; font-weight: bold;">\&quot;</span>
};&quot;</span>
                                     <span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">:</span><span style="color: #555;">ascent</span> center<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code53'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066453"><td class="code" id="p40664code53"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>insert <span style="color: #66cc66;">&#40;</span>generate-compact-disk <span style="color: #ff0000;">&quot;我是光盘&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p><div class="wp-caption alignnone" style="width: 596px"><a href="screenshots/circle/emacs-compact-disk.png" rel="lightbox"><img src="screenshots/circle/emacs-compact-disk.png" width="964" height="175" /></a><p class="wp-caption-text">Emacs中画光盘</p></div><br />
其实, 只要你明白xpm的格式, 自己完全可以构建那个data, 画出各种各样的图形.</p>
<p>现在还有个问题，怎么定制这些圆的颜色呢？</p>
<p>我们来看看svn-status-update-mode-line的代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code54'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066454"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p40664code54"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> svn-status-update-modeline <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Update modeline state dot mark properly&quot;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">when</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">and</span> buffer-file-<span style="color: #b1b100;">name</span> <span style="color: #66cc66;">&#40;</span>svn-status-in-vc-mode?<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>svn-status-update-state-mark
     <span style="color: #66cc66;">&#40;</span>svn-status-interprete-state-mode-color
      <span style="color: #66cc66;">&#40;</span>vc-svn-state buffer-file-<span style="color: #b1b100;">name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>svn-status-update-mode-line把</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code55'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066455"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p40664code55"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>svn-status-interprete-state-mode-color
      <span style="color: #66cc66;">&#40;</span>vc-svn-state buffer-file-<span style="color: #b1b100;">name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>作为参数传给svn-status-update-state-mark，而svn-status-update-state-mark代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code56'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066456"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p40664code56"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> svn-status-update-state-mark <span style="color: #66cc66;">&#40;</span>color<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>svn-status-uninstall-state-mark-modeline<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>svn-status-install-state-mark-modeline color<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>svn-status-update-state-mark的参数为颜色，这就是说svn-status-interprete-state-mode-color的作用应该是得到颜色，且来看看它的定义：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code57'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066457"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p40664code57"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>defsubst svn-status-interprete-state-mode-color <span style="color: #66cc66;">&#40;</span>stat<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Interpret vc-svn-state symbol to mode line color&quot;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">case</span> stat
    <span style="color: #66cc66;">&#40;</span>'edited <span style="color: #ff0000;">&quot;tomato&quot;</span>      <span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>'up-to-date <span style="color: #ff0000;">&quot;GreenYellow&quot;</span> <span style="color: #66cc66;">&#41;</span>
    <span style="color: #808080; font-style: italic;">;; what is missing here??</span>
    <span style="color: #808080; font-style: italic;">;; ('unknown  &quot;gray&quot;        )</span>
    <span style="color: #808080; font-style: italic;">;; ('added    &quot;blue&quot;        )</span>
    <span style="color: #808080; font-style: italic;">;; ('deleted  &quot;red&quot;         )</span>
    <span style="color: #808080; font-style: italic;">;; ('unmerged &quot;purple&quot;      )</span>
    <span style="color: #66cc66;">&#40;</span>t <span style="color: #ff0000;">&quot;red&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>这个函数的参数是当前文件的svn状态，返回一个颜色字符串。<br />
看来只要改这个函数就能定制颜色了。<br />
等等，难道要直接修改psvn.el吗？当然不需要，而且那是个不好的习惯。由于Elisp不像c等编译型语言，它是解释型语言(也可以编译成字节码)，如果你多处定义了同一个函数，后面的会覆盖的前面的定义。根据这个特性，我们就可以在我们自己的配置文件中重新定义一下svn-status-interprete-state-mode-color就可以了，重新定义如下：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40664code58'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4066458"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p40664code58"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>defsubst svn-status-interprete-state-mode-color <span style="color: #66cc66;">&#40;</span>stat<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Interpret vc-svn-state symbol to mode line color&quot;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">case</span> stat
    <span style="color: #66cc66;">&#40;</span>'up-to-date <span style="color: #ff0000;">&quot;GreenYellow&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>'edited     <span style="color: #ff0000;">&quot;tomato&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>'unknown    <span style="color: #ff0000;">&quot;gray&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>'added      <span style="color: #ff0000;">&quot;blue&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>'deleted    <span style="color: #ff0000;">&quot;red&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>'unmerged   <span style="color: #ff0000;">&quot;purple&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>t           <span style="color: #ff0000;">&quot;black&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>这样，未修改的文件绿色圆，修改过的淡红色圆，增加的文件蓝色圆，删除的文件红色圆。</p>

<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://emacser.com/svn-status-mode-line.htm' t='在mode-line上标记svn状态' d='' tag='buffer,control,Elisp,Emacs,IDE,irc,lightbox,lisp,mode,mode-line,screenshot,svn-status,定制,截图,插件,状态栏,编译,配置,配置文件,配色,配色,颜色' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://emacser.com/wp-content/plugins/addthischina/a1.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://emacser.com/mode-line.htm" title="Emacs的状态栏 － mode-line (2009年11月17日)">Emacs的状态栏 － mode-line</a> (21)</li>
	<li><a href="http://emacser.com/w3m.htm" title="Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页 (2009年11月23日)">Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页</a> (39)</li>
	<li><a href="http://emacser.com/to-emacs-beginner.htm" title="致Emacs初学者 (2009年11月30日)">致Emacs初学者</a> (117)</li>
	<li><a href="http://emacser.com/emacs-beginner-must-know.htm" title="Emacs初学者必知必会 (2010年01月24日)">Emacs初学者必知必会</a> (8)</li>
	<li><a href="http://emacser.com/icicles-doremi-palette.htm" title="&#8220;色向胆边生&#8221; － 记Emacs配色的超级武器：Icicles，Color Palette和DoReMi (2009年11月19日)">&#8220;色向胆边生&#8221; － 记Emacs配色的超级武器：Icicles，Color Palette和DoReMi</a> (17)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://emacser.com/svn-status-mode-line.htm/feed</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Emacs截图</title>
		<link>http://emacser.com/emacs-screenshots.htm</link>
		<comments>http://emacser.com/emacs-screenshots.htm#comments</comments>
		<pubDate>Sat, 28 Nov 2009 14:45:13 +0000</pubDate>
		<dc:creator>ahei</dc:creator>
				<category><![CDATA[初级]]></category>
		<category><![CDATA[ahei]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[截图]]></category>

		<guid isPermaLink="false">http://ahei.yo2.cn/?page_id=37644</guid>
		<description><![CDATA[Emacs的截图在这里.


	相关日志
	
	我的Emacs配置文件 － DEA (345)
	Emacs的皮肤 － Color Theme (33)
	Emacs的状态栏 － mode-line (21)
	Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页 (39)
	&#8220;色向胆边生&#8221; － 记Emacs配色的超级武器：Icicles，Color Palette和DoReMi (17)


]]></description>
			<content:encoded><![CDATA[<p>Emacs的截图在<a href="emacs.htm">这里</a>.</p>

<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://emacser.com/emacs-screenshots.htm' t='Emacs截图' d='' tag='ahei,Emacs,截图' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://emacser.com/wp-content/plugins/addthischina/a1.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://emacser.com/dea.htm" title="我的Emacs配置文件 － DEA (2009年11月11日)">我的Emacs配置文件 － DEA</a> (345)</li>
	<li><a href="http://emacser.com/color-theme.htm" title="Emacs的皮肤 － Color Theme (2009年11月20日)">Emacs的皮肤 － Color Theme</a> (33)</li>
	<li><a href="http://emacser.com/mode-line.htm" title="Emacs的状态栏 － mode-line (2009年11月17日)">Emacs的状态栏 － mode-line</a> (21)</li>
	<li><a href="http://emacser.com/w3m.htm" title="Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页 (2009年11月23日)">Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页</a> (39)</li>
	<li><a href="http://emacser.com/icicles-doremi-palette.htm" title="&#8220;色向胆边生&#8221; － 记Emacs配色的超级武器：Icicles，Color Palette和DoReMi (2009年11月19日)">&#8220;色向胆边生&#8221; － 记Emacs配色的超级武器：Icicles，Color Palette和DoReMi</a> (17)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://emacser.com/emacs-screenshots.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Emacs才是世界上最强的IDE &#8211; 用w3m浏览网页</title>
		<link>http://emacser.com/w3m.htm</link>
		<comments>http://emacser.com/w3m.htm#comments</comments>
		<pubDate>Mon, 23 Nov 2009 09:16:51 +0000</pubDate>
		<dc:creator>ahei</dc:creator>
				<category><![CDATA[IDE]]></category>
		<category><![CDATA[w3m]]></category>
		<category><![CDATA[中级]]></category>
		<category><![CDATA[好玩的]]></category>
		<category><![CDATA[ahei]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[buffer]]></category>
		<category><![CDATA[conkeror]]></category>
		<category><![CDATA[ctrl]]></category>
		<category><![CDATA[DEA]]></category>
		<category><![CDATA[Elisp]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[face]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[mode]]></category>
		<category><![CDATA[org]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[光标]]></category>
		<category><![CDATA[定制]]></category>
		<category><![CDATA[工具栏]]></category>
		<category><![CDATA[截图]]></category>
		<category><![CDATA[按键]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[搜索引擎]]></category>
		<category><![CDATA[浏览器]]></category>
		<category><![CDATA[行号]]></category>
		<category><![CDATA[配置]]></category>
		<category><![CDATA[配置文件]]></category>
		<category><![CDATA[配色]]></category>
		<category><![CDATA[鼠标]]></category>

		<guid isPermaLink="false">http://ahei.yo2.cn/?p=36939</guid>
		<description><![CDATA[
也许当你看到我这个标题的时候, 你就会感到惊讶, 在Emacs里面能浏览网页? 对, 在Emacs里面确实能浏览网页. 你应该是第一次见到能浏览网页的IDE吧, 其他的IDE顶多是能浏览一些带超链接的帮助. 有必要在Emacs里面浏览网页吗? 有那么多的浏览器, 为什么要在Emacs里面浏览网页? 对啊, 为什么啊?
当你在浏览网页的时候, 你是否想过只按几个字母就可以上下滚动网页, 上下翻屏, 前进后退? 现在的浏览器都是多标签页浏览, 你是否想过能用更方便的方式来切换这些标签页, 而不是那么难按的Ctrl+Tab? 当你在网页文本框里面输入文字的时候, 你是否想过是否可以使用自己熟悉的编辑器方式来编辑这些文本呢?
上述功能, w3m都可以完成.
现在你很想见见w3m了吧? 下面就是它:


















下面我来讲讲w3m的使用.
使用M-M打开w3m，它会提示你输入一个url，不输入的话默认为主页(这样设置(setq w3m-home-page &#8220;http://www.google.cn&#8221;))，或者用C-x M-B打开标签页，再或者使用w3m-browse-current-buffer命令直接调用w3m来浏览当前buffer，w3m-browse-current-buffer会单独开一个w3m的buffer来浏览当前buffer内容，而w3m-buffer直接在当前buffer浏览，下面是用w3m直接浏览这篇文章的html：
注意：下面所说的按键如无特殊说明，均是在w3m中有效。
浏览页面
正如vim中那样, h, j, k, l上下左右移动光标, J, K快速上下移动光标, u向上滚半屏, 空格键向下翻一屏, n或tab移到光标到下一个链接, p或Shift+tab移动光标到上一个链接, w移动光标到下一个表单, b移动个光标到上一个表单. 按f，w3m会把它的每一个链接加一个编号，你输入编号就可以到达这个链接，非常之方便，效果如下：
上图中灰色的数字编号就是链接的数字编号。默认的w3m链接编号有个小问题，就是不显示form的编号，不知道它为啥不显示，我改了一下，使得可以显示form的编号，因为显示编号实际上是用函数w3m-link-numbering来实现的，它的代码如下：

?View Code LISP1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
&#40;defun w3m-link-numbering &#40;&#38;rest args&#41;
  &#34;Make overlays that display link numbers.&#34;
  &#40;when w3m-link-numbering-mode
   [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="Chrome" src="screenshots/chrome.jpg" width="100" height="100"/></p>
<p>也许当你看到我这个标题的时候, 你就会感到惊讶, 在Emacs里面能浏览网页? 对, 在Emacs里面确实能浏览网页. 你应该是第一次见到能浏览网页的IDE吧, 其他的IDE顶多是能浏览一些带超链接的帮助. 有必要在Emacs里面浏览网页吗? 有那么多的浏览器, 为什么要在Emacs里面浏览网页? 对啊, 为什么啊?<span id="more-36939"></span></p>
<p>当你在浏览网页的时候, 你是否想过只按几个字母就可以上下滚动网页, 上下翻屏, 前进后退? 现在的浏览器都是多标签页浏览, 你是否想过能用更方便的方式来切换这些标签页, 而不是那么难按的Ctrl+Tab? 当你在网页文本框里面输入文字的时候, 你是否想过是否可以使用自己熟悉的编辑器方式来编辑这些文本呢?</p>
<p>上述功能, w3m都可以完成.</p>
<p>现在你很想见见w3m了吧? 下面就是它:</p>
<table border="0">
<tr>
<td>
      <div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/w3m/w3m-google.png" rel="lightbox"><img title="w3m view google" src="screenshots/w3m/thumbs/thumbs_w3m-google.png" alt="在w3m里面浏览google" width="150" height="150" /></a><p class="wp-caption-text">在w3m里面浏览google</p></div>
    </td>
<td>
      <div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/w3m/w3m-baidu.png" rel="lightbox"><img title="w3m view baidu" src="screenshots/w3m/thumbs/thumbs_w3m-baidu.png" alt="在w3m里面浏览百度" width="150" height="150" /></a><p class="wp-caption-text">在w3m里面浏览百度</p></div>
    </td>
<td>
      <div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/w3m/w3m-emacswiki.png" rel="lightbox"><img title="w3m view emacswiki" src="screenshots/w3m/thumbs/thumbs_w3m-emacswiki.png" alt="在w3m里面浏览EmacsWiki" width="150" height="150" /></a><p class="wp-caption-text">在w3m里面浏览EmacsWiki</p></div>
    </td>
</tr>
<tr>
<td>
      <div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/w3m/w3m-my-blog.png" rel="lightbox"><img title="w3m view my blog" src="screenshots/w3m/thumbs/thumbs_w3m-my-blog.png" alt="在w3m浏览我的博客" width="150" height="150" /></a><p class="wp-caption-text">在w3m浏览我的博客</p></div>
    </td>
<td>
      <div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/w3m/w3m-liudehua.png" rel="lightbox"><img title="w3m search liudehua with google" src="screenshots/w3m/thumbs/thumbs_w3m-liudehua.png" alt="用w3m在google里搜索刘德华" width="150" height="150" /></a><p class="wp-caption-text">用w3m在google里搜索刘德华</p></div>
    </td>
<td>
      <div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/w3m/w3m-chenhao.png" rel="lightbox"><img title="w3m google search chenhao" src="screenshots/w3m/thumbs/thumbs_w3m-chenhao.png" alt="用w3m在google图片搜索中搜索陈好" width="150" height="150" /></a><p class="wp-caption-text">用w3m在google图片搜索中搜索陈好</p></div>
    </td>
</tr>
</table>
<p>下面我来讲讲w3m的使用.</p>
<p>使用M-M打开w3m，它会提示你输入一个url，不输入的话默认为主页(这样设置(setq w3m-home-page &#8220;<a href="http://www.google.cn">http://www.google.cn</a>&#8221;))，或者用C-x M-B打开标签页，再或者使用w3m-browse-current-buffer命令直接调用w3m来浏览当前buffer，w3m-browse-current-buffer会单独开一个w3m的buffer来浏览当前buffer内容，而w3m-buffer直接在当前buffer浏览，下面是用w3m直接浏览这篇文章的html：<br />
<div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/w3m/w3m-browse-current-buffer.png" rel="lightbox"><img title="w3m browse current buffer" src="screenshots/w3m/thumbs/thumbs_w3m-browse-current-buffer.png" alt="使用w3m浏览当前buffer" width="150" height="150" /></a><p class="wp-caption-text">使用w3m浏览当前buffer</p></div></p>
<p>注意：下面所说的按键如无特殊说明，均是在w3m中有效。</p>
<h4>浏览页面</h4>
<p>正如vim中那样, h, j, k, l上下左右移动光标, J, K快速上下移动光标, u向上滚半屏, 空格键向下翻一屏, n或tab移到光标到下一个链接, p或Shift+tab移动光标到上一个链接, w移动光标到下一个表单, b移动个光标到上一个表单. 按f，w3m会把它的每一个链接加一个编号，你输入编号就可以到达这个链接，非常之方便，效果如下：<br />
<div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/w3m/w3m-link-number.png" rel="lightbox"><img title="w3m的链接编号" src="screenshots/w3m/thumbs/thumbs_w3m-link-number.png" alt="w3m的链接编号" width="150" height="150" /></a><p class="wp-caption-text">w3m的链接编号</p></div><br />
上图中灰色的数字编号就是链接的数字编号。默认的w3m链接编号有个小问题，就是不显示form的编号，不知道它为啥不显示，我改了一下，使得可以显示form的编号，因为显示编号实际上是用函数w3m-link-numbering来实现的，它的代码如下：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p36939code63'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3693963"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code" id="p36939code63"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> w3m-link-numbering <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>rest args<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Make overlays that display link numbers.&quot;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">when</span> w3m-link-numbering-mode
    <span style="color: #66cc66;">&#40;</span>save-excursion
      <span style="color: #66cc66;">&#40;</span>goto-char <span style="color: #66cc66;">&#40;</span>point-<span style="color: #b1b100;">min</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>i <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
            overlay num<span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">catch</span> 'already-numbered
          <span style="color: #66cc66;">&#40;</span>while <span style="color: #66cc66;">&#40;</span>w3m-goto-next-anchor<span style="color: #66cc66;">&#41;</span>
            <span style="color: #808080; font-style: italic;">;; 这里判断是否是一个锚链接</span>
            <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">when</span> <span style="color: #66cc66;">&#40;</span>w3m-anchor<span style="color: #66cc66;">&#41;</span>
              <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">when</span> <span style="color: #66cc66;">&#40;</span>get-char-property <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span> 'w3m-link-numbering-overlay<span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">throw</span> 'already-numbered <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
              <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> overlay <span style="color: #66cc66;">&#40;</span>make-overlay <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>+ <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                    num <span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot;[%d]&quot;</span> <span style="color: #66cc66;">&#40;</span>incf i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
              <span style="color: #66cc66;">&#40;</span>w3m-static-<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>featurep 'xemacs<span style="color: #66cc66;">&#41;</span>
                  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">progn</span>
                    <span style="color: #66cc66;">&#40;</span>overlay-put overlay 'before-string num<span style="color: #66cc66;">&#41;</span>
                    <span style="color: #66cc66;">&#40;</span>set-glyph-face <span style="color: #66cc66;">&#40;</span>extent-begin-glyph overlay<span style="color: #66cc66;">&#41;</span>
                                    'w3m-link-numbering<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#40;</span>w3m-add-face-property <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">length</span> num<span style="color: #66cc66;">&#41;</span> 'w3m-link-numbering num<span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#40;</span>overlay-put overlay 'before-string num<span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#40;</span>overlay-put overlay 'evaporate t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
              <span style="color: #66cc66;">&#40;</span>overlay-put overlay 'w3m-link-numbering-overlay i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>上面代码中用了“(when (w3m-anchor)”判断是否有锚链接，form显然没有，所以把这条语句去掉就可以了。<br />
接着前面，还可以使用goto-line直接定位光标到指定行(最好打开行号显示，方便你查看行号)。上述命令以及Emacs本身的光标移动命令使得可以快速移动光标和定位链接.</p>
<h4>图片显示</h4>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p36939code64'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3693964"><td class="code" id="p36939code64"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> w3m-default-display-inline-images t<span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>设置默认显示图片, t或者用鼠标单击图片或者图片url控制是否显示光标处的图片, T控制是否显示所有图片</p>
<h4>导航</h4>
<p>F或C-;前进, B或C-h后退; S列出历史页面, M-s显示曾经打开的会话和当前的会话; 回车或者单击鼠标在当前标签页中打开光标处的链接, m在新标签页中打开光标处的链接, g在新标签页中打开用户所输入的url, G在当前标签页中打开用户所输入的url, s启用自定义的搜索引擎来搜索, P显示当前标签页url, c拷贝当前标签页url, U拷贝并显示光标所在处的链接的url, d下载光标处的链接, M-d下载用户输入的url, r重新加载当前页, 相当于一般浏览器的强制刷新(Ctrl+F5).</p>
<h4>切换标签页</h4>
<p>M-n切换到下一个标签页, M-p切换到上一个标签页, C-k关闭当前标签页, C-c 1关闭其他的标签页, 只留下当前标签页, 1或C-x 1最大化当前标签页, 还可以使用Emacs自己的ido来方便的切换标签页. M-n可以复制当前标签页. C-x C-s可以保存当前标签页, C-x C-w可以在保存当前标签页的同时，直接改变当前mode为你所输入的文件名对应的mode，不再是w3m-mode了. </p>
<h4>书签</h4>
<p>a把当前页面加到书签里面去, M-a把光标处的url加入书签, v新开一个标签页来显示所有的书签, 打开书签后, M-e可以直接打开书签文件进行编辑, M-k可以删除一个书签, C-_可以undo刚才删掉的标签.<br />
下面这个是书签的截图:<br />
<div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/w3m/w3m-bookmark.png" rel="lightbox"><img title="w3m bookmark" src="screenshots/w3m/thumbs/thumbs_w3m-bookmark.png" alt="w3m的书签" width="150" height="150" /></a><p class="wp-caption-text">w3m的书签</p></div></p>
<h4>工具栏</h4>
<p>一般的浏览器都有个工具栏，w3m当然也有。w3m-use-toolbar这个选项控制是否显示工具栏，如果你不想要显示工具栏的话把它设为nil就可以了。但是如果你想要显示工具栏的话，并不需要手动去设置这个变量，为什么呢？因为emacs-w3m已经自动帮你设置好了，代码如下：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p36939code65'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3693965"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p36939code65"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>defcustom w3m-use-toolbar
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">and</span> <span style="color: #66cc66;">&#40;</span>featurep 'tool-bar<span style="color: #66cc66;">&#41;</span>
       <span style="color: #808080; font-style: italic;">;; Emacs 22 and greater return t for `(featurep 'tool-bar)'</span>
       <span style="color: #808080; font-style: italic;">;; even if being launched with the -nw option.</span>
       <span style="color: #66cc66;">&#40;</span>display-images-p<span style="color: #66cc66;">&#41;</span>
       <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">or</span> <span style="color: #66cc66;">&#40;</span>featurep 'gtk<span style="color: #66cc66;">&#41;</span>
	   <span style="color: #66cc66;">&#40;</span>image-type-available-p 'xpm<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Non-nil activates toolbar of w3m.&quot;</span>
  <span style="color: #66cc66;">:</span><span style="color: #555;">group</span> 'w3m
  <span style="color: #66cc66;">:</span><span style="color: #555;">type</span> 'boolean<span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>如果你有tool-bar这个包，而且能显示图片，它就会自动帮你设为t的。<br />
那是不是现在你就能看到工具栏呢？抱歉，不能，因为工具栏显示的话会用到图片，而这个图片emacs-w3m从哪里找呢？这就需要你指定了，通过w3m-icon-directory指定，指定好它了以后，打开w3m的时候，就会看到一个工具栏了(当然，首先你的工具栏得打开，C-u 1 M-x tool-bar-mode)，效果如下：<br />
<div class="wp-caption alignnone" style="width: 160px"><a href="screenshots/w3m/w3m-toolbar.png" rel="lightbox"><img title="w3m的工具栏" src="screenshots/w3m/thumbs/thumbs_w3m-toolbar.png" alt="w3m的工具栏" width="150" height="150" /></a><p class="wp-caption-text">w3m的工具栏</p></div></p>
<h4>其他</h4>
<p>M-k显示cookie, 打开cookie页面, 你还可以编辑cookie.<br />
当要在form中输入数据的时候，把光标移到form上，按回车键或m，如果当前form框很小(比如搜索引擎的输入框)，w3m会让你在minibuffer中输入数据，如果很大的话(比如编辑wiki的时候很大的文本框)，w3m则会新开一个buffer让你输入，方便之极，在那个新开的buffer里面，按C-c C-q取消输入，C-c C-c则确认输入。<br />
switch-to-w3m命令可以切换到w3m的buffer。<br />
w3m-weather可以显示天气预报，不过显示的都是作者家(日本)的那天气预报，如果有人对天气预报感兴趣的话，可以使用<a href="http://code.google.com/p/dea/source/browse/trunk/lisps/cn-weather.el" target="_blank">cn-weather</a>，这是水木上的<a href="http://www.wlamos.com/" target="_blank">wlamos</a>写的一个elisp包。</p>
<p>以上我所说的命令已经让你能够快速浏览网页了, w3m的功能特别强大, 等待你的挖掘, w3m的elisp代码有2万5千多行, elisp可不像c代码, 不需要多少行代码就可以实现非常强大的功能, w3m的代码就有那么多, 从此也可见它的功能之强大. </p>
<h4>w3m的不足</h4>
<p>任何软件都有不足, 包括Emacs, w3m更是如此, 其实它的缺点还挺大的, 它不能识别css, &#8230;, 也许你现在觉得它也太弱了吧, 连css都识别不了, 不要这样鄙视它, 它毕竟是一个文本浏览器, 但是它能看图片, 这个从上面的截图你也能看出来. 既然w3m有这么大的缺点, 我为什么还要向大家介绍w3m呢? 原因是它既然是个文本浏览器, 浏览速度当然就很快了, 看一些文字居多的网页还是比较不错的, 小说之类的网页啊, w3m都是个不错的选择, 我现在经常用它来浏览EmacsWiki.</p>
<h4>有什么改进的软件吗?</h4>
<p><a href="http://conkeror.org/" target="_blank">conkeror</a>起初是一个firefox的插件, 使得能在firefox下模拟Emacs的快捷键, 随着后来的发展, 它独立成为一个软件了, 它的操作方式完全类似Emacs, 而且它的命令也是自文档的, 不过它的配置文件是JavaScript写的, 对JavaScript比较熟悉的同志是件好事. 目前firefox的插件它也基本都能兼容, 不能兼容的稍微修改一下也能兼容. 那么它是完美的吗? 当然也不是, 由于它是独立于Emacs之外的, 好多对Emacs的定制就不能用于它了, 比如我写了一个非常好用的浏览buffer的包, conkeror便不能用了, 正因为它是独立于Emacs之外, 它的标签页浏览都不是很方便. 不过它有一个非常好用的功能, 就是可以显示每个链接的编号, 然后用户可以输入链接编号快速打开某个链接. </p>
<p>我的w3m配置文件在<a href="http://code.google.com/p/dea/source/browse/trunk/my-lisps/w3m-settings.el" target="_blank">这里</a>，配置如下：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p36939code66'); return false;">View Code</a> LISP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3693966"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
</pre></td><td class="code" id="p36939code66"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;; -*- Emacs-Lisp -*-</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;; Time-stamp: &lt;2010-02-23 13:52:32 Tuesday by ahei&gt;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>require 'w3m<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>require 'w3m-lnum<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>require 'util<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>defvar w3m-buffer-name-prefix <span style="color: #ff0000;">&quot;*w3m&quot;</span> <span style="color: #ff0000;">&quot;Name prefix of w3m buffer&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defvar w3m-buffer-<span style="color: #b1b100;">name</span> <span style="color: #66cc66;">&#40;</span>concat w3m-buffer-name-prefix <span style="color: #ff0000;">&quot;*&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000;">&quot;Name of w3m buffer&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defvar w3m-bookmark-buffer-<span style="color: #b1b100;">name</span> <span style="color: #66cc66;">&#40;</span>concat w3m-buffer-name-prefix <span style="color: #ff0000;">&quot;-bookmark*&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000;">&quot;Name of w3m buffer&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defvar w3m-dir <span style="color: #66cc66;">&#40;</span>concat my-emacs-lisps-path <span style="color: #ff0000;">&quot;emacs-w3m/&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000;">&quot;Dir of w3m.&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> w3m-command-arguments '<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;-cookie&quot;</span> <span style="color: #ff0000;">&quot;-F&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> w3m-use-cookies t<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> w3m-icon-directory <span style="color: #66cc66;">&#40;</span>concat w3m-dir <span style="color: #ff0000;">&quot;icons&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> w3m-use-mule-ucs t<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> w3m-home-page <span style="color: #ff0000;">&quot;http://www.google.cn&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> w3m-default-display-inline-images t<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> w3m-settings <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>make-local-variable 'hl-line-face<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> hl-line-face 'hl-line-nonunderline-face<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> hl-line-overlay <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>color-theme-adjust-hl-line-face<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>add-hook 'w3m-mode-hook 'w3m-settings<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> w3m-save-current-buffer <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Save current w3m buffer.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>interactive<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>save-excursion
    <span style="color: #66cc66;">&#40;</span>mark-whole-buffer<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>call-interactively 'copy-region-as-kill-nomark<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>with-temp-buffer
    <span style="color: #66cc66;">&#40;</span>call-interactively 'yank<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>call-interactively 'write-file<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> w3m-print-current-url <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Display current url.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>interactive<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>w3m-message <span style="color: #ff0000;">&quot;%s&quot;</span> <span style="color: #66cc66;">&#40;</span>w3m-url-readable-string w3m-current-url<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> w3m-copy-current-url <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Display the current url in the echo area and put it into `kill-ring'.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>interactive<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">when</span> w3m-current-url
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>deactivate-mark <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span>kill-new w3m-current-url<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span>w3m-print-current-url<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> view-w3m-bookmark <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;View w3m bokmark.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>interactive<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>buffer <span style="color: #66cc66;">&#40;</span>get-buffer w3m-bookmark-buffer-<span style="color: #b1b100;">name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> buffer
        <span style="color: #66cc66;">&#40;</span>switch-to-buffer buffer<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span>with-current-buffer <span style="color: #66cc66;">&#40;</span>get-buffer-create w3m-bookmark-buffer-<span style="color: #b1b100;">name</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span>w3m-mode<span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span>w3m-bookmark-view<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> switch-to-w3m <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Switch to *w3m* buffer.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>interactive<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>buffer <span style="color: #66cc66;">&#40;</span>get-buffer w3m-buffer-<span style="color: #b1b100;">name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> buffer
        <span style="color: #66cc66;">&#40;</span>switch-to-buffer buffer<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span>message <span style="color: #ff0000;">&quot;Could not found w3m buffer.&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> w3m-browse-current-buffer <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Use w3m browser current buffer.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>interactive<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>w3m-browse-buffer<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> w3m-browse-buffer <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>optional buffer<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Use w3m browser buffer BUFFER.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>interactive <span style="color: #ff0000;">&quot;bBuffer to browse use w3m: &quot;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>unless buffer <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> buffer <span style="color: #66cc66;">&#40;</span>current-buffer<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span>* <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>file <span style="color: #66cc66;">&#40;</span>buffer-file-<span style="color: #b1b100;">name</span> buffer<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
         <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">name</span> <span style="color: #66cc66;">&#40;</span>buffer-<span style="color: #b1b100;">name</span> buffer<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> file
        <span style="color: #66cc66;">&#40;</span>w3m-goto-url-new-session file<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span>with-current-buffer buffer
        <span style="color: #66cc66;">&#40;</span>save-excursion
          <span style="color: #66cc66;">&#40;</span>mark-whole-buffer<span style="color: #66cc66;">&#41;</span>
          <span style="color: #66cc66;">&#40;</span>call-interactively 'copy-region-as-kill-nomark<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span>* <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>new-<span style="color: #b1b100;">name</span>
              <span style="color: #66cc66;">&#40;</span>concat
               w3m-buffer-name-prefix
               <span style="color: #ff0000;">&quot;-&quot;</span>
               <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>string<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;*&quot;</span> <span style="color: #66cc66;">&#40;</span>substring <span style="color: #b1b100;">name</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                   <span style="color: #66cc66;">&#40;</span>substring <span style="color: #b1b100;">name</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
                 <span style="color: #66cc66;">&#40;</span>concat <span style="color: #b1b100;">name</span> <span style="color: #ff0000;">&quot;*&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
             <span style="color: #66cc66;">&#40;</span>new-buffer <span style="color: #66cc66;">&#40;</span>get-buffer-create new-<span style="color: #b1b100;">name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span>switch-to-buffer new-buffer<span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span>call-interactively 'yank<span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span>w3m-buffer<span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span>w3m-mode<span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> w3m-current-title <span style="color: #66cc66;">&#40;</span>buffer-<span style="color: #b1b100;">name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;; fix small bug about of `w3m-auto-show'</span>
<span style="color: #808080; font-style: italic;">;; see my-blog/emacs/w3m-auto-show-bug.htm</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> w3m-auto-show <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Scroll horizontally so that the point is visible.&quot;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">when</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">and</span> truncate-lines
             w3m-auto-show
             <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">not</span> w3m-horizontal-scroll-done<span style="color: #66cc66;">&#41;</span>
             <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">not</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">and</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">eq</span> last-command this-command<span style="color: #66cc66;">&#41;</span>
                       <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">or</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">eq</span> <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>point-<span style="color: #b1b100;">min</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                           <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">eq</span> <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>point-<span style="color: #b1b100;">max</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
             <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">or</span> <span style="color: #66cc66;">&#40;</span>memq this-command '<span style="color: #66cc66;">&#40;</span>beginning-of-buffer end-of-buffer<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                 <span style="color: #66cc66;">&#40;</span>string-match <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>`i?search-&quot;</span>
                               <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">symbolp</span> this-command<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>symbol-<span style="color: #b1b100;">name</span> this-command<span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                 <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">and</span> <span style="color: #66cc66;">&#40;</span>markerp <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">nth</span> <span style="color: #cc66cc;">1</span> w3m-current-position<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">&#40;</span>markerp <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">nth</span> <span style="color: #cc66cc;">2</span> w3m-current-position<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&gt;=</span> <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span>
                          <span style="color: #66cc66;">&#40;</span>marker-position <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">nth</span> <span style="color: #cc66cc;">1</span> w3m-current-position<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&lt;=</span> <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span>
                          <span style="color: #66cc66;">&#40;</span>marker-position <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">nth</span> <span style="color: #cc66cc;">2</span> w3m-current-position<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>w3m-horizontal-on-screen<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> w3m-horizontal-scroll-done <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> w3m-link-numbering <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>rest args<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Make overlays that display link numbers.&quot;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">when</span> w3m-link-numbering-mode
    <span style="color: #66cc66;">&#40;</span>save-excursion
      <span style="color: #66cc66;">&#40;</span>goto-char <span style="color: #66cc66;">&#40;</span>point-<span style="color: #b1b100;">min</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>i <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
            overlay num<span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">catch</span> 'already-numbered
          <span style="color: #66cc66;">&#40;</span>while <span style="color: #66cc66;">&#40;</span>w3m-goto-next-anchor<span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">when</span> <span style="color: #66cc66;">&#40;</span>get-char-property <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span> 'w3m-link-numbering-overlay<span style="color: #66cc66;">&#41;</span>
              <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">throw</span> 'already-numbered <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> overlay <span style="color: #66cc66;">&#40;</span>make-overlay <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>+ <span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                  num <span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot;[%d]&quot;</span> <span style="color: #66cc66;">&#40;</span>incf i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span>w3m-static-<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>featurep 'xemacs<span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">progn</span>
                  <span style="color: #66cc66;">&#40;</span>overlay-put overlay 'before-string num<span style="color: #66cc66;">&#41;</span>
                  <span style="color: #66cc66;">&#40;</span>set-glyph-face <span style="color: #66cc66;">&#40;</span>extent-begin-glyph overlay<span style="color: #66cc66;">&#41;</span>
                                  'w3m-link-numbering<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
              <span style="color: #66cc66;">&#40;</span>w3m-add-face-property <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">length</span> num<span style="color: #66cc66;">&#41;</span> 'w3m-link-numbering num<span style="color: #66cc66;">&#41;</span>
              <span style="color: #66cc66;">&#40;</span>overlay-put overlay 'before-string num<span style="color: #66cc66;">&#41;</span>
              <span style="color: #66cc66;">&#40;</span>overlay-put overlay 'evaporate t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span>overlay-put overlay 'w3m-link-numbering-overlay i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>apply-define-key
 global-map
 `<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;M-M&quot;</span>     w3m-goto-url-new-session<span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;C-x M-B&quot;</span> view-w3m-bookmark<span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;C-x M-m&quot;</span> switch-to-w3m<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>apply-define-key
 w3m-mode-map
  `<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;&lt;backtab&gt;&quot;</span> w3m-previous-anchor<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;n&quot;</span>         w3m-next-anchor<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;p&quot;</span>         w3m-previous-anchor<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;w&quot;</span>         w3m-next-form<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;b&quot;</span>         w3m-previous-form<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;f&quot;</span>         w3m-go-to-linknum<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;M-n&quot;</span>       w3m-next-buffer<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;M-p&quot;</span>       w3m-previous-buffer<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;C-k&quot;</span>       kill-this-buffer<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;C-k&quot;</span>       w3m-delete-buffer<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;C-c 1&quot;</span>     w3m-delete-other-buffers<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;1&quot;</span>         delete-other-windows<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;C-x C-s&quot;</span>   w3m-save-current-buffer-sb<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;P&quot;</span>         w3m-print-current-url<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;U&quot;</span>         w3m-print-this-url<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;c&quot;</span>         w3m-copy-current-url<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;g&quot;</span>         w3m-goto-url-new-session<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;G&quot;</span>         w3m-goto-url<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;d&quot;</span>         w3m-download-this-url-sb<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;M-d&quot;</span>       w3m-download-sb<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;s&quot;</span>         w3m-search<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;S&quot;</span>         w3m-history<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;u&quot;</span>         View-scroll-page-backward<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;J&quot;</span>         roll-down<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;K&quot;</span>         roll-up<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;o&quot;</span>         other-window<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;m&quot;</span>         w3m-view-this-url-new-session<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;C-h&quot;</span>       w3m-view-previous-page<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;F&quot;</span>         w3m-view-next-page<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;C-;&quot;</span>       w3m-view-next-page<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;r&quot;</span>         w3m-reload-this-page<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;v&quot;</span>         w3m-bookmark-view-new-session<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;M-e&quot;</span>       w3m-bookmark-edit<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;'&quot;</span>         switch-to-other-buffer<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>


<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://emacser.com/w3m.htm' t='Emacs才是世界上最强的IDE &amp;#8211; 用w3m浏览网页' d='' tag='ahei,browser,buffer,conkeror,ctrl,DEA,Elisp,Emacs,face,IDE,java,lightbox,lisp,mode,org,screenshot,theme,vi,vim,w3m,windows,光标,定制,工具栏,截图,按键,插件,搜索引擎,浏览器,行号,配置,配置文件,配色,配色,鼠标' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://emacser.com/wp-content/plugins/addthischina/a1.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://emacser.com/to-emacs-beginner.htm" title="致Emacs初学者 (2009年11月30日)">致Emacs初学者</a> (117)</li>
	<li><a href="http://emacser.com/auto-complete.htm" title="Emacs才是世界上最强大的IDE － 用auto-complete实现自动补全 (2009年11月11日)">Emacs才是世界上最强大的IDE － 用auto-complete实现自动补全</a> (109)</li>
	<li><a href="http://emacser.com/icicles-doremi-palette.htm" title="&#8220;色向胆边生&#8221; － 记Emacs配色的超级武器：Icicles，Color Palette和DoReMi (2009年11月19日)">&#8220;色向胆边生&#8221; － 记Emacs配色的超级武器：Icicles，Color Palette和DoReMi</a> (17)</li>
	<li><a href="http://emacser.com/emacs-beginner-must-know.htm" title="Emacs初学者必知必会 (2010年01月24日)">Emacs初学者必知必会</a> (8)</li>
	<li><a href="http://emacser.com/mode-line.htm" title="Emacs的状态栏 － mode-line (2009年11月17日)">Emacs的状态栏 － mode-line</a> (21)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://emacser.com/w3m.htm/feed</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
	</channel>
</rss>

