<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.3" -->
<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/"
	>

<channel>
	<title>Dryice Liu's Blog &#187; emacs</title>
	<link>http://dryice.name/blog</link>
	<description></description>
	<pubDate>Tue, 31 Aug 2010 12:01:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>
	<language>en</language>
			<item>
		<title>Learning VIM</title>
		<link>http://dryice.name/blog/emacs/learning-vim/</link>
		<comments>http://dryice.name/blog/emacs/learning-vim/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 09:40:16 +0000</pubDate>
		<dc:creator>dryice</dc:creator>
		
		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://dryice.name/blog/emacs/learning-vim/</guid>
		<description><![CDATA[Well I&#8217;m still an Emacs user  
The problem is, my Emacs configuration is too complicated and depending on a lot of external tools. It is not easy to get all the things running when you come to a new machine. And Emacs is not on every machine, especially when I was on other people&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Well I&#8217;m still an Emacs user <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The problem is, my Emacs configuration is too complicated and depending on a lot of external tools. It is not easy to get all the things running when you come to a new machine. And Emacs is not on every machine, especially when I was on other people&#8217;s machines.</p>
<p>So I decided to make up a light weight vim configuration, so I can use it quickly everywhere.  Here&#8217;s a list of the plugins I choose: taglist,  pydoc, code_complete, matchit, and SearchComplete.</p>
<p>And I think  zsh is not available everywhere too so I&#8217;ll need some setup for bash.</p>
<p><hints id="hah_hints"></hints></p>
<p class="akst_link"><a href="http://dryice.name/blog/?p=871&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_871" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://dryice.name/blog/emacs/learning-vim/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using GDB in the New Emacs 22</title>
		<link>http://dryice.name/blog/emacs/using-gdb-in-the-new-emacs-22/</link>
		<comments>http://dryice.name/blog/emacs/using-gdb-in-the-new-emacs-22/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 04:47:09 +0000</pubDate>
		<dc:creator>dryice</dc:creator>
		
		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://dryice.name/blog/emacs/using-gdb-in-the-new-emacs-22/</guid>
		<description><![CDATA[&#160;
Contents

Why
Using GDB Before Emacs 22
The new interface with Emacs 22

&#160;
Why
Using GDB is necessary for every C/C++ developer in the Linux world. Though many gurus like the traditional command line, many people want a more integrated interface. At least they don&#8217;t want to do list all the time.
Among the current solutions xxgdb is a good choice, [...]]]></description>
			<content:encoded><![CDATA[<p class="contents topic">&nbsp;</p>
<p class="topic-title first"><a title="contents" id="contents" name="contents"></a>Contents</p>
<ul class="simple">
<li><a href="file:///home/ddliu/liudong/partTime/linuxWritter/gdb_in_Emacs_22.html#why" title="id1" class="reference" id="id1" name="id1">Why</a></li>
<li><a href="file:///home/ddliu/liudong/partTime/linuxWritter/gdb_in_Emacs_22.html#using-gdb-before-emacs-22" title="id2" aiotitle="id2" class="reference" id="id2" name="id2">Using GDB Before Emacs 22</a></li>
<li><a href="file:///home/ddliu/liudong/partTime/linuxWritter/gdb_in_Emacs_22.html#the-new-interface-with-emacs-22" title="id3" aiotitle="id3" class="reference" id="id3" name="id3">The new interface with Emacs 22</a></li>
</ul>
<p class="section">&nbsp;</p>
<h1><a href="file:///home/ddliu/liudong/partTime/linuxWritter/gdb_in_Emacs_22.html#id1" title="why" class="toc-backref" id="why" name="why">Why</a></h1>
<p>Using <a href="http://www.gnu.org/software/gdb/" class="reference">GDB</a> is necessary for every C/C++ developer in the Linux world. Though many gurus like the traditional command line, many people want a more integrated interface. At least they don&#8217;t want to do <strong>list</strong> all the time.</p>
<p>Among the current solutions <a href="http://en.wikipedia.org/wiki/Xxgdb" class="reference">xxgdb</a> is a good choice, however it is available in X environment only, and pretty unmaintained. The last release was back in 1995.</p>
<p>Another choice is <a href="http://cgdb.sourceforge.net/index.shtml" class="reference">cgdb</a>. This is curses-based and well maintained. However you have to be a VI user to use it, and you can&#8217;t benefit from the good X stuff. For us Emacs users, we have the GUD/GDB mode, and the best of all, as Emacs itself, this works under both X and terminal environment.</p>
<p class="section">&nbsp;</p>
<h1><a href="file:///home/ddliu/liudong/partTime/linuxWritter/gdb_in_Emacs_22.html#id2" title="using-gdb-before-emacs-22" class="toc-backref" id="using-gdb-before-emacs-22" name="using-gdb-before-emacs-22">Using GDB Before Emacs 22</a></h1>
<p>Before Emacs 22, the <a href="http://www.gnu.org/software/gdb/" class="reference">GDB</a> interface in Emacs looks pretty much like <a href="http://cgdb.sourceforge.net/index.shtml" class="reference">cgdb</a>. That is, you got two windows, one is the source window, and the other is used to interactive with <a href="http://www.gnu.org/software/gdb/" class="reference">GDB</a>.</p>
<p>As always, you need to add the <em>-g</em> option to <em>gcc</em> when compiling. And on the Emacs part, you need to add:</p>
<div class="lisp" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> gdb-show-main t<span style="color: #66cc66;">&#41;</span></div>
<p>to your ~/.emacs file. Then you just run <strong>M-x gdb</strong>. Emacs will ask how to run <a href="http://www.gnu.org/software/gdb/" class="reference">GDB</a> like:</p>
<div class="bash" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #c20cb9; font-weight: bold;">gdb</span> &#8211;<span style="color: #007800;">annotate=</span><span style="color: #000000;">3</span> your_executable_name</div>
<p>in the mini buffer. Normally the only thing you need to change is <em>your_executable_name</em>. Hit <strong>RET</strong> and Emacs will split the frame with two windows. One is the GDB interface, called GUD-XX where XX is the name of your executable, and the other is the source file with the <em>main</em> function in it. Emacs will find the source file automatically, even if you haven&#8217;t openned it before.</p>
<p>Now you can move normally in the source file buffer, and hit <strong>C-x SPACE</strong> to set a breakpoint on the current line. A small red ball will shown on the left of the line, as you seen from most other IDEs. If you are running Emacs under X, you can also use your mouse to left click on the space area to the left of the line (called <strong>Fringe</strong> in Emacs) to set a breakpoint. If you do <strong>C-x SPACE</strong> or left click on a line that already have a breakpoint, the breakpoint is canceled.</p>
<p><a href="http://dryice.name/blog/wp-content/uploads/2007/09/two_window.jpg" aiotitle="Two window GDB in Emacs"><img src="http://dryice.name/blog/wp-content/uploads/2007/09/two_window.jpg" alt="Two window GDB in Emacs" /></a></p>
<p>You can use the <a href="http://www.gnu.org/software/gdb/" class="reference">GDB</a> buffer as well as in a terminal session. Except you don&#8217;t need to do <em>list</em> all the time. An arrow will appear in the source buffer showing the current line of code if a breakpoint is hit, or you use the <em>next</em> command. If your program involves another source file, Emacs will find it and open it for you. There are also hollow arrows in the fringe area of source buffer. These indicates the current line in a higher frame where a function is called.</p>
<p>Most <a href="http://www.gnu.org/software/gdb/" class="reference">GDB</a> commands get their key bindings. You can use either the key bindings or type directly in the <a href="http://www.gnu.org/software/gdb/" class="reference">GDB</a> buffer. If you just want to see the flow of your program, key bindings might be a better choice cause you can hide the <a href="http://www.gnu.org/software/gdb/" class="reference">GDB</a> buffer and get more code displayed. A tip: As most of the key bindings takes two or three key strokes, you may find the Emacs build-in command <strong>repeat</strong> useful, which is bind to <strong>C-x z</strong> by default. For example, if you want many <em>next</em> command, you can hit <strong>C-x C-a C-s</strong> to run one <em>next</em> first, then <strong>C-x z</strong> for another <em>next</em>, and you can hit <strong>z z z z z</strong>, as many times as you want <em>next</em>. And as expected, you can see the arrow jumps around your source file buffer.</p>
<p class="section">&nbsp;</p>
<h1><a href="file:///home/ddliu/liudong/partTime/linuxWritter/gdb_in_Emacs_22.html#id3" title="the-new-interface-with-emacs-22" aiotitle="the-new-interface-with-emacs-22" class="toc-backref" id="the-new-interface-with-emacs-22" name="the-new-interface-with-emacs-22">The new interface with Emacs 22</a></h1>
<p>With the new coming Emacs 22, we get a more powerful debugger, to use it, just add:</p>
<div class="lisp" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> gdb-many-windows t<span style="color: #66cc66;">&#41;</span></div>
<p>in your ~/.emacs file. You could start <a href="http://www.gnu.org/software/gdb/" aiotitle="GDB" class="reference">GDB</a> mode as before, and&#8230; Bang! A lot of windows shows up <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://dryice.name/blog/wp-content/uploads/2007/09/multi_window.jpg" aiotarget="false" aiotitle="Multi window GDB in Emacs"><img src="http://dryice.name/blog/wp-content/uploads/2007/09/multi_window.jpg" alt="Multi window GDB in Emacs" /><br />
</a></p>
<p>Actually there are five windows there (by default). In the middle, the big window is the source file buffer. On the top left, is the GUD buffer, as we seen before. The other three windows are brand new:</p>
<ul class="simple">
<li>On the top right corner is the locals buffer. In this buffer are the variables and their values of the current frame, and they are updated in real time. What&#8217;s more, if you hit <strong>RET</strong> or left click on the values, you can change them on the fly.</li>
<li>On the bottom left corner is the stack buffer. Here shows the calling stack, one function call per line. What&#8217;s more, if you hit <strong>RET</strong> on a line here, the source buffer will get updated to show the function of that line. Meanwhile, the locals buffer on the top right corner will be updated too: showing the variables in this frame.</li>
<li>On the bottom right corner is the breakpoint buffer. Here shows all the breakpoints. And, you can use <strong>SPACE</strong> to enable or disable a breakpoint here, use <strong>D</strong> to delete a break point, and as in the stack buffer, you can use <strong>RET</strong> to make the source buffer updated to where the breakpoint is.</li>
</ul>
<p>Besides this, we can have lots more dedicated buffers: A separate IO buffer instead of output in the <a href="http://www.gnu.org/software/gdb/" class="reference">GDB</a> buffer, a register buffer, an assembler buffer, a memory buffer, and even a threads buffer.</p>
<p>There&#8217;s lots more to discover: for example, you can drag the arrow in the source file buffer to execute the program. Just give it a try, and if you like it, go and read the manual <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<hints id="hah_hints"></hints></p>
<p class="akst_link"><a href="http://dryice.name/blog/?p=847&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_847" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://dryice.name/blog/emacs/using-gdb-in-the-new-emacs-22/feed/</wfw:commentRss>
		</item>
		<item>
		<title>combile switching buffer and open files/directories</title>
		<link>http://dryice.name/blog/emacs/combile-switching-buffer-and-open-filesdirectories/</link>
		<comments>http://dryice.name/blog/emacs/combile-switching-buffer-and-open-filesdirectories/#comments</comments>
		<pubDate>Wed, 28 Feb 2007 04:30:00 +0000</pubDate>
		<dc:creator>dryice</dc:creator>
		
		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://dryice.name/wordpress/index.php/uncategorized/combile-switching-buffer-and-open-filesdirectories/</guid>
		<description><![CDATA[Tamas Patrovics posted timid.el a couple days ago, and I find it really useful:
The original goal was to help open history files with find-file. However yesterday he make it possible to use with iswitchb-buffer: The history file list also shows up there.
First of all I rebind some keys cause I don&#8217;t like move my finger [...]]]></description>
			<content:encoded><![CDATA[<p>Tamas Patrovics posted <a href="http://www.emacswiki.org/cgi-bin/emacs/timid.el">timid.el</a> a couple days ago, and I find it really useful:</p>
<p>The original goal was to help open history files with find-file. However yesterday he make it possible to use with iswitchb-buffer: The history file list also shows up there.</p>
<p>First of all I rebind some keys cause I don&#8217;t like move my finger from the main keyboard area to the arrow keys:</p>
<div class="lisp" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #808080; font-style: italic;">;;; easy open files</span><br />
<span style="color: #66cc66;">&#40;</span>require &#8216;timid<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> timid-keys<br />
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">list</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;&amp;#60;C-return&amp;gt;&quot;</span><span style="color: #66cc66;">&#41;</span> &#8216;timid-select-file<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;C-p&quot;</span><span style="color: #66cc66;">&#41;</span> &#8216;timid-previous-line<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;C-n&quot;</span><span style="color: #66cc66;">&#41;</span> &#8216;timid-next-line<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;M-v&quot;</span><span style="color: #66cc66;">&#41;</span> &#8216;timid-previous-page<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;C-v&quot;</span><span style="color: #66cc66;">&#41;</span> &#8216;timid-next-page<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span>timid-mode t<span style="color: #66cc66;">&#41;</span></div>
<p>I also rebind timid-select-file to C-return so I can hit RET for what&#8217;s the current in mini-buffer, and C-return for what&#8217;s the current in the \*timid\* buffer.</p>
<p>The current timid.el use file-name-history, which is a list of file names entered in the minibuffer. However I&#8217;m a heavy dired user. So I over write it like this:</p>
<div class="lisp" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #808080; font-style: italic;">;; overwrite</span><br />
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> timid-iswitchb-setup <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #ff0000;">&quot;Setup timid to work with iswitchb.&quot;</span><br />
<span style="color: #66cc66;">&#40;</span>interactive<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span>require &#8216;iswitchb<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span>put &#8216;iswitchb-buffer &#8216;timid-pattern-<span style="color: #b1b100;">function</span> &#8216;timid-iswitchb-get-pattern<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span>put &#8216;iswitchb-buffer &#8216;timid-candidates-variable &#8216;recentf-<span style="color: #b1b100;">list</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span>put &#8216;iswitchb-buffer &#8216;timid-visit-file-<span style="color: #b1b100;">function</span> &#8216;timid-iswitchb-visit-file<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span>put &#8216;iswitchb-buffer &#8216;timid-search-delay <span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span>put &#8216;iswitchb-buffer &#8216;timid-completion t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span>timid-iswitchb-setup<span style="color: #66cc66;">&#41;</span></div>
<p>The recentf-list contains files I opened with both the minibuffer and dired.</p>
<div class="lisp" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #66cc66;">&#40;</span>require &#8216;recentf<span style="color: #66cc66;">&#41;</span></div>
<p>And, well, recentf only record file names. I want it to remember my dired buffers too. Cause I switch-buffer to a dired buffer often, and it&#8217;s nice to open it if it&#8217;s not openned already:</p>
<div class="lisp" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #808080; font-style: italic;">;; also save directories openned with dired</span><br />
<span style="color: #66cc66;">&#40;</span>defsubst ddliu-recentf-add-directory <span style="color: #66cc66;">&#40;</span>dirname<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #ff0000;">&quot;Add or move FILENAME at the beginning of the recent list.<br />
Does nothing if the name satisfies any of the `recentf-exclude&#8217;<br />
regexps or predicates.&quot;</span><br />
<span style="color: #66cc66;">&#40;</span>when <span style="color: #66cc66;">&#40;</span>recentf-include-p dirname<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#40;</span>recentf-push dirname<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div>
<p>(defun ddliu-recentf-track-opened-directory ()<br />
&#8220;Insert the name of the file just opened or written into the recent list.&#8221;<br />
(and dired-directory<br />
(ddliu-recentf-add-directory dired-directory))<br />
;; Must return nil because it is run from `write-file-functions&#8217;.<br />
nil)</p>
<p>(setq recentf-used-hooks<br />
&#8216;(<br />
(find-file-hook       recentf-track-opened-file)<br />
(write-file-functions recentf-track-opened-file)<br />
(kill-buffer-hook     recentf-track-closed-file)<br />
(kill-emacs-hook      recentf-save-list)<br />
(dired-after-readin-hook ddliu-recentf-track-opened-directory)<br />
)<br />
)</p>
<p>;; this need to be after the recentf-used-hooks overwrite above<br />
(recentf-mode 1)<br />
Now with lots of history infos</p>
<div class="lisp" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> recentf-max-saved-items <span style="color: #cc66cc;">2000</span><span style="color: #66cc66;">&#41;</span></div>
<p>I don&#8217;t need to remember if I&#8217;ve openned a file/directory: just C-x b and type the name. If it&#8217;s not openned already, the timid buffer will show up and I can open it immediately.</p>
<p>One thing is that I&#8217;m a ido.el user. The current code of timid.el only support iswitchb.el. Although it is possible to write ido support code, I don&#8217;t have the time to dive in ido code right. Anyway, with all the handy things, it&#8217;s not a bad idea to use ido for file open only:</p>
<div class="lisp" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #66cc66;">&#40;</span>ido-mode &#8216;files<span style="color: #66cc66;">&#41;</span></div>
<p><hints id="hah_hints"></hints></p>
<p class="akst_link"><a href="http://dryice.name/blog/?p=637&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_637" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://dryice.name/blog/emacs/combile-switching-buffer-and-open-filesdirectories/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Get Things Done</title>
		<link>http://dryice.name/blog/emacs/planner/get-things-done/</link>
		<comments>http://dryice.name/blog/emacs/planner/get-things-done/#comments</comments>
		<pubDate>Tue, 31 Oct 2006 07:20:00 +0000</pubDate>
		<dc:creator>dryice</dc:creator>
		
		<category><![CDATA[planner]]></category>

		<guid isPermaLink="false">http://dryice.name/wordpress/index.php/uncategorized/get-things-done/</guid>
		<description><![CDATA[Well I&#8217;ve used Emacs planner for more than 2 years everyday, and really happy about it.
However, as I got more and more rely on it, I can still find some room for improvement, but not easy to do:

It is all text based. This is good in some way, but bad in some other way. Say [...]]]></description>
			<content:encoded><![CDATA[<p>Well I&#8217;ve used <a href="http://dryice.name/blog/emacs/index.html">Emacs</a> <a href="http://dryice.name/blog/emacs/planner/index.html">planner</a> for more than 2 years everyday, and really happy about it.</p>
<p>However, as I got more and more rely on it, I can still find some room for improvement, but not easy to do:</p>
<ul>
<li>It is all text based. This is good in some way, but bad in some other way. Say the planner-id thing is still not working very well, so we can&#8217;t say something like &#8220;this task need to be done after that task&#8221;</li>
<li>It is not easy to sync with a mobile device. When I start using planner, this is not a big deal, but now mobile device is becoming more and more popullar. Someone has tried to do this, but looks they are all on the way. THe best way I can think off is to get Emacs running on PDAs, but it is not easy, and even if we get Emacs running on PDA, on most devices we won&#8217;t have the keyboard, even if we have some keyboard included device, the key bindings is not easy to type. And we don&#8217;t have those Esc-Meta-Alt-Ctrl-Shift keys <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </li>
</ul>
<p>And after I reading David Allen&#8217;s <a href="http://www.davidco.com/">Get Things Done</a>, The most thing I&#8217;ve learned is that we should get split tasks to &#8220;todo&#8221;s. So I think a PIM should support turn a note/task to a project, whice contains sub tasks and more notes. And <a href="http://www.43folders.com/2004/09/08/getting-started-with-getting-things-done/">the discuss on 43 folders</a> didn&#8217;t mention a software that can do this. So I might write one my own some day. And here&#8217;s some dump of what I&#8217;ve got so far:</p>
<ul>
<li>cross platform, and sync. There might be a server, which also runs the web version, that do all the sync thing, or the desktop/mobile version could sync among themselves.</li>
<li>This should do the &#8220;task management&#8221; stuff only. Leaving contact manager and/or email client alone. But should support other contact manager/mail client as more as possible</li>
<li>Say for contact manager, we could store the contact name and email address (the email address is unique). And call the external contact manager to search for the email address, and so on</li>
<li>There should be some kind of &#8220;meta data&#8221;. So I can convert a task to a project, or a note to a project</li>
<li>Everythink is linkable. Like in <a href="http://www.edgewall.com/trac/">trac</a>. Some kind of wiki should be good for this.</li>
<li>Data storage. Need to take cross platform into consideration. XML? Or JSON? Will wiki works inside XML?</li>
<li>There should be templates for both GTD style and Franklin Convey style, and user should be able to define their own.</li>
<li>There should be both GUI version and CLI version. I don&#8217;t care CLI version very much, but there must be an Emacs interface. I could write the core with Python, the GUI with wxPython, and call the core via <a href="http://pymacs.progiciels-bpi.ca/">PyMacs</a>. For mobile version, I don&#8217;t know. Maybe write on their own API, to work with the contact manager/mail client on them.</li>
<li>Should support print task list. For people who don&#8217;t have a palm/PPC</li>
<li>Standard protocals. Should support standard protocals like iCalendar, etc.</li>
</ul>
<p><hints id="hah_hints"></hints></p>
<p class="akst_link"><a href="http://dryice.name/blog/?p=655&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_655" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://dryice.name/blog/emacs/planner/get-things-done/feed/</wfw:commentRss>
		</item>
		<item>
		<title>get annotation from firefox</title>
		<link>http://dryice.name/blog/emacs/planner/get-annotation-from-firefox/</link>
		<comments>http://dryice.name/blog/emacs/planner/get-annotation-from-firefox/#comments</comments>
		<pubDate>Thu, 24 Aug 2006 08:56:00 +0000</pubDate>
		<dc:creator>dryice</dc:creator>
		
		<category><![CDATA[planner]]></category>

		<guid isPermaLink="false">http://dryice.name/wordpress/index.php/uncategorized/get-annotation-from-firefox/</guid>
		<description><![CDATA[Most of the time I use Firefox to visit my ticket system and making a task there is not as easy as in w3m.
Here&#8217;s how my way of getting the annotation improves:

At the very beginning I just copy the URL from Firefox and paste to w3m-browse-url, and make annotation there. This is not very convience, [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the time I use <a href="http://dryice.name/blog/firefox/index.html">Firefox</a> to visit my ticket system and making a task there is not as easy as in w3m.</p>
<p>Here&#8217;s how my way of getting the annotation improves:</p>
<ul>
<li>At the very beginning I just copy the URL from <a href="http://dryice.name/blog/firefox/index.html">Firefox</a> and paste to w3m-browse-url, and make annotation there. This is not very convience, and my CVS version of w3m-mode hangs my CVS Emacs often.</li>
<li>I use the <a href="http://copyurlplus.mozdev.org/">copyurlplus</a> extention to get the annotation. To do that, I&#8217;ll need to add</li>
</ul>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">user_pref(&quot;copyurlplus.menus.2.copy&quot;, &quot;[[%URL%][%TITLE%]]&quot;);<br />
user_pref(&quot;copyurlplus.menus.2.label&quot;, &quot;Copy as planner anno&quot;);</div>
<p class="quoted">to my prefs.js. (change the &#8220;2&#8243; to &#8220;1&#8243; if you haven&#8217;t customize copy URL Plus before.) However, to get the annotation, I need to right click on the page and choose the menu item. This is, of cause, not convience for a keyboard user like me.</p>
<ul>
<li>And here&#8217;s what I&#8217;ve figured out today, using <a href="http://mozilla.dorando.at/">key config</a>. By adding these:</li>
</ul>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">user_pref(&quot;keyconfig.main.xxx_key__ddliu_copy_as_planner_anno&quot;, &quot;alt][C][][function ddliu_CopyClipboard(text) {\nvar gClipboardHelper = Components.classes[\&quot;@mozilla.org/widget/clipboardhelper;1\&quot;].getService(Components.interfaces.nsIClipboardHelper);\ngClipboardHelper.copyString(text);\n}\nvar myURL= window._content.location.href;\nvar myTitle = window._content.document.title;\n\nvar copytext = \&quot;[[\&quot; + myURL + \&quot;]\&quot; + \&quot;[\&quot; + myTitle + \&quot;]]\&quot;;\nddliu_CopyClipboard(copytext);\n][&quot;);</div>
<p class="quoted">Into my prefs.js, I can get the annotation by just press Alt-c.</p>
<p>The life rocks <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><hints id="hah_hints"></hints></p>
<p class="akst_link"><a href="http://dryice.name/blog/?p=667&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_667" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://dryice.name/blog/emacs/planner/get-annotation-from-firefox/feed/</wfw:commentRss>
		</item>
		<item>
		<title>emms using mplayer</title>
		<link>http://dryice.name/blog/emacs/emms-using-mplayer/</link>
		<comments>http://dryice.name/blog/emacs/emms-using-mplayer/#comments</comments>
		<pubDate>Tue, 25 Jul 2006 06:34:00 +0000</pubDate>
		<dc:creator>dryice</dc:creator>
		
		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://dryice.name/wordpress/index.php/uncategorized/emms-using-mplayer/</guid>
		<description><![CDATA[Well I said I could use music play daemon to play media files within Emacs, there&#8217;s something made it uncomfortable: every time I found some new mp3 files, I&#8217;ll need to rebuild the mpd database and restart the daemon. This is boring especially when I get one from a friend and just want to play [...]]]></description>
			<content:encoded><![CDATA[<p>Well I said I could use music play daemon to <a href="playing_media_files_within_emacs.muse">play media files within Emacs</a>, there&#8217;s something made it uncomfortable: every time I found some new mp3 files, I&#8217;ll need to rebuild the mpd database and restart the daemon. This is boring especially when I get one from a friend and just want to play it once: The mpd backend always comes before mplayer and all other backends and report &#8220;this file is not in the database&#8221; and I have to switch to the command line <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>And today I find the &#8220;-slave&#8221; option of mplayer. This makes mplayer a daemon running at the background and waiting for commands from <a href="http://dryice.name/blog/emacs/index.html">Emacs</a>. So there&#8217;s no need to tweak later-do-interval and I can change volume via mplayer.</p>
<p>So here&#8217;s my new setting, using mplayer instead of mpd:</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">(setq emms-player-mplayer-command-name &quot;mplayer&quot;<br />
emms-player-mplayer-parameters &#8216;(&quot;-slave&quot;)<br />
emms-player-mpg321-command-name &quot;mpg123&quot;<br />
emms-player-list<br />
&#8216;(emms-player-mplayer<br />
emms-player-mplayer-playlist<br />
emms-player-mpg321<br />
emms-player-ogg123))<br />
(defun ddliu-emms-player-mplayer-volume-up ()<br />
&quot;Depends on mplayer&#8217;s -slave mode.&quot;<br />
(interactive)<br />
(process-send-string<br />
emms-player-simple-process-name &quot;volume 1\n&quot;))</div>
<p>(defun ddliu-emms-player-mplayer-volume-down ()<br />
&#8220;Depends on mplayer&#8217;s -slave mode.&#8221;<br />
(interactive)<br />
(process-send-string<br />
emms-player-simple-process-name &#8220;volume -1\n&#8221;))</p>
<p>(define-key emms-playlist-mode-map (kbd &#8220;&gt;&#8221;) &#8216;ddliu-emms-player-mplayer-volume-up)<br />
(define-key emms-playlist-mode-map (kbd &#8220;&lt;&#8221;) &#8216;ddliu-emms-player-mplayer-volume-down)<br />
One drawback is that if I exit Emacs, the music will stop. But&#8230; who will exim Emacs?</p>
<p><hints id="hah_hints"></hints></p>
<p class="akst_link"><a href="http://dryice.name/blog/?p=676&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_676" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://dryice.name/blog/emacs/emms-using-mplayer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The JED editor</title>
		<link>http://dryice.name/blog/emacs/the-jed-editor/</link>
		<comments>http://dryice.name/blog/emacs/the-jed-editor/#comments</comments>
		<pubDate>Fri, 30 Jun 2006 01:55:00 +0000</pubDate>
		<dc:creator>dryice</dc:creator>
		
		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://dryice.name/wordpress/index.php/uncategorized/the-jed-editor/</guid>
		<description><![CDATA[Well this is not exactly Emacs. But Emacs related.
I will always like a lightweight Emacs clone. Emacsclient is good for desktop usage. But for server maintenance, where you spend 10 minutes on a box everyday, you won&#8217;t like the 100M monster eating up all your memory.
I&#8217;ve been using  for this. And today I&#8217;ve found [...]]]></description>
			<content:encoded><![CDATA[<p>Well this is not exactly Emacs. But Emacs related.</p>
<p>I will always like a lightweight Emacs clone. Emacsclient is good for desktop usage. But for server maintenance, where you spend 10 minutes on a box everyday, you won&#8217;t like the 100M monster eating up all your memory.</p>
<p>I&#8217;ve been using  for this. And today I&#8217;ve found a better one: <a href="http://www.jedsoft.org/jed/" aiotitle="jed">jed</a>. The most advantage over mg is that it support customization and syntax highlight. Also it support UTF-8, which is a BIG plus for me as a Chinese user.</p>
<p>Now with a little customization the jed looks like my Emacs. I&#8217;ve decide to use this on all my server machines for quick editing. And I&#8217;ve put the windows binaries got from <a href="http://www.skilleter.pwp.blueyonder.co.uk/misc/jed.htm">http://www.skilleter.pwp.blueyonder.co.uk/misc/jed.htm</a> and <a href="http://www.paneura.com/~dino/wjed.html#INSTALLER">http://www.paneura.com/~dino/wjed.html#INSTALLER</a> on my USB key to see how they will work on windoes.</p>
<p><hints id="hah_hints"></hints></p>
<p class="akst_link"><a href="http://dryice.name/blog/?p=679&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_679" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://dryice.name/blog/emacs/the-jed-editor/feed/</wfw:commentRss>
		</item>
		<item>
		<title>trac and planner</title>
		<link>http://dryice.name/blog/emacs/planner/trac-and-planner/</link>
		<comments>http://dryice.name/blog/emacs/planner/trac-and-planner/#comments</comments>
		<pubDate>Fri, 26 May 2006 14:30:00 +0000</pubDate>
		<dc:creator>dryice</dc:creator>
		
		<category><![CDATA[planner]]></category>

		<guid isPermaLink="false">http://dryice.name/wordpress/index.php/uncategorized/trac-and-planner/</guid>
		<description><![CDATA[Well I&#8217;ve used to use roundup as my ticket system. However the intergration of a ticket system and a version control system of trac attract me these days. So I decided to give it a try.
There&#8217;s noting to say about installation thanks to the FreeBSD ports system. And it really nice to have the version [...]]]></description>
			<content:encoded><![CDATA[<p>Well I&#8217;ve used to use <a href="http://roundup.sourceforge.net/">roundup</a> as my ticket system. However the intergration of a ticket system and a version control system of <a href="http://www.edgewall.com/trac/" aiotitle="trac">trac</a> attract me these days. So I decided to give it a try.</p>
<p>There&#8217;s noting to say about installation thanks to the <a href="http://www.freebsd.org">FreeBSD</a> ports system. And it really nice to have the version control and ticket system intergrated and point to each other.</p>
<p>However, one thing annoyed me a lot is that I&#8217;ve used to use <a href="http://emacs-w3m.namazu.org/">emacs-w3m</a> to visit the roundup tickets and make planner tasks directly by planner-w3m. But the trac ticket web interface use a brace around the ticket summary. All planner users knows that we depends on () alot. So I have to get rid of it.</p>
<p>After checking all the settings I&#8217;ve got no luck. So I drive myself into the source code and finially find it: It&#8217;s in ticket/web_ui.py, line 382, as of trac version 0.9.5. Just remove the () in that line and everything comes out good <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><hints id="hah_hints"></hints></p>
<p class="akst_link"><a href="http://dryice.name/blog/?p=689&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_689" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://dryice.name/blog/emacs/planner/trac-and-planner/feed/</wfw:commentRss>
		</item>
		<item>
		<title>playing media files within Emacs</title>
		<link>http://dryice.name/blog/emacs/playing-media-files-within-emacs/</link>
		<comments>http://dryice.name/blog/emacs/playing-media-files-within-emacs/#comments</comments>
		<pubDate>Wed, 10 May 2006 09:16:00 +0000</pubDate>
		<dc:creator>dryice</dc:creator>
		
		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://dryice.name/wordpress/index.php/uncategorized/playing-media-files-within-emacs/</guid>
		<description><![CDATA[Well Emacs itself can&#8217;t play media files, it can call an external program to play them. I like have some music as the background when programming, so I have this (stealed from the net)
;;;; A little function that plays marked files in dired with xmms
(defun dired-xmms-play-mp3 (&#38;amp;optional arg)
&#34;play mp3 files marked in dired buffer with [...]]]></description>
			<content:encoded><![CDATA[<p>Well Emacs itself can&#8217;t play media files, it can call an external program to play them. I like have some music as the background when programming, so I have this (stealed from the net)</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">;;;; A little function that plays marked files in dired with xmms<br />
(defun dired-xmms-play-mp3 (&amp;amp;optional arg)<br />
&quot;play mp3 files marked in dired buffer with xmms&quot;<br />
(interactive)<br />
(let ((files nil))<br />
(progn<br />
(mapcar<br />
&#8216;(lambda (x)<br />
(setq files<br />
(concat files &quot; \&quot;&quot; x &nbsp;&quot;\&quot;&quot;)))<br />
(dired-map-over-marks<br />
(dired-get-filename) arg))<br />
(start-process-shell-command<br />
&quot;dired-play-mp3&quot; &quot;*dired-play-mp3*&quot; &quot;xmms&quot; files))))</div>
<p>;; Example of how to bind this to M-m when opening dired:<br />
(add-hook &#8216;dired-mode-hook<br />
(function (lambda ()<br />
(define-key dired-mode-map &#8220;\M-m&#8221; &#8216;dired-xmms-play-mp3))))<br />
So I can mark some mp3 file in dired, and call xmms to play it.</p>
<p>However it&#8217;s not very convience to play with xmms. For example, if I want to change the volume, I&#8217;ll need to move my hand from the keyboard to the mouse.</p>
<p>As the <a href="http://www.gnu.org/software/emms/index.html">EMMS</a> 2.0 is released, I decide to give it a try.</p>
<p><a href="http://www.gnu.org/software/emms/index.html">EMMS</a> could call mpg321, mplayer, ogg321, and musicpd to play the media files, I decide to use musicpd because it uses mimimal CPU.</p>
<p>It turns out to be not very hard compared with those command line players, the only thing need an extra care is to set</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">(setq emms-player-mpd-server-name &quot;localhost&quot;)<br />
(setq emms-player-mpd-server-port &quot;2100&quot;)<br />
(setq emms-player-mpd-music-directory &quot;/home/ddliu/entertainment/mp3&quot;)</div>
<p>correctly, according to the music player daemon settings.</p>
<p>For the rest, just pick the settings you like from emms-setup.el. For me, I have</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">(require &#8216;emms-source-file)<br />
(require &#8216;emms-source-playlist)<br />
(require &#8216;emms-player-simple)<br />
(require &#8216;emms-player-mplayer)<br />
(setq emms-player-list &#8216;(emms-player-mpg321<br />
emms-player-ogg123<br />
emms-player-mplayer))</div>
<p>(require &#8216;emms-info)<br />
(require &#8216;emms-info-mp3info)<br />
(require &#8216;emms-info-ogginfo)<br />
(add-to-list &#8216;emms-track-initialize-functions &#8216;emms-info-initialize-track)<br />
(add-to-list &#8216;emms-info-functions &#8216;emms-info-mp3info)<br />
(add-to-list &#8216;emms-info-functions &#8216;emms-info-ogginfo)<br />
(setq emms-track-description-function &#8216;emms-info-track-description)</p>
<p>(require &#8216;emms-playlist-mode)<br />
(setq emms-playlist-buffer-name &#8220;*Music*&#8221;)<br />
(setq emms-playlist-default-major-mode &#8216;emms-playlist-mode)</p>
<p>;; (require &#8216;emms-streams)<br />
(require &#8216;emms-playlist-sort)</p>
<p>(add-to-list &#8216;emms-info-functions &#8216;emms-info-mpd)<br />
(add-to-list &#8216;emms-player-list &#8216;emms-player-mpd)</p>
<p>Because I don&#8217;t like seeing the lyrics or playing times.</p>
<p>Now everthing is set, I can even play movies via <a href="http://www.gnu.org/software/emms/index.html">EMMS</a>, though I can also press &#8220;X&#8221; directly from dired <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>To make it more convience, I have M-m rebined in dired:</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">(define-key dired-mode-map &quot;\M-m&quot; &#8216;emms-add-dired)</div>
<p>And to change volume,</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">(define-key emms-playlist-mode-map (kbd &quot;&amp;gt;&quot;) &#8216;emms-player-mpd-volume-up)<br />
(define-key emms-playlist-mode-map (kbd &quot;&amp;#60;&quot;) &#8216;emms-player-mpd-volume-down)</div>
<p>Finially, goto the play list buffer easily:</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">(defun ddliu-goto-music ()<br />
&quot;Switch to the music buffer&quot;<br />
(interactive)<br />
(switch-to-buffer &quot;*Music*&quot;))<br />
(define-key goto-global-map &quot;m&quot; &#8216;ddliu-goto-music)</div>
<p>Enjoy <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><hints id="hah_hints"></hints></p>
<p class="akst_link"><a href="http://dryice.name/blog/?p=691&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_691" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://dryice.name/blog/emacs/playing-media-files-within-emacs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>interactive with the rest of the world</title>
		<link>http://dryice.name/blog/emacs/interactive-with-the-rest-of-the-world/</link>
		<comments>http://dryice.name/blog/emacs/interactive-with-the-rest-of-the-world/#comments</comments>
		<pubDate>Fri, 21 Apr 2006 04:55:00 +0000</pubDate>
		<dc:creator>dryice</dc:creator>
		
		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://dryice.name/wordpress/index.php/uncategorized/interactive-with-the-rest-of-the-world/</guid>
		<description><![CDATA[Though many people says Emacs is an &#8220;Operating System&#8221;, it is not and still need to interactive with other programs  
I&#8217;ve talked about how to call other programs from eshell, dired, and view files according to mime types within dired. Besides that, the 2 programs I use most is a terminal emulator and Firefox.
Most [...]]]></description>
			<content:encoded><![CDATA[<p>Though many people says <a href="http://dryice.name/blog/emacs/index.html" aiotitle="Emacs">Emacs</a> is an &#8220;Operating System&#8221;, it is not and still need to interactive with other programs <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;ve talked about how to call other programs from <a href="eshell.html">eshell</a>, <a href="dired.html" aiotitle="dired">dired</a>, and <a href="dired__view_files_according_to_mime_types.html" aiotitle="view files according to mime types within dired">view files according to mime types within dired</a>. Besides that, the 2 programs I use most is a terminal emulator and <a href="http://dryice.name/blog/firefox/index.html">Firefox</a>.</p>
<p>Most <a href="http://dryice.name/blog/emacs/index.html">Emacs</a> users know the basic of <a href="http://www.vim.org" aiotitle="VIM">VIM</a> because it&#8217;s a waste of time waiting for <a href="http://dryice.name/blog/emacs/index.html" aiotitle="Emacs">Emacs</a> to start just to change one or two lines of a config file. A better way than learning <a href="http://www.vim.org">VIM</a> is to config your <a href="http://dryice.name/blog/emacs/index.html" aiotitle="Emacs">Emacs</a> to do things quickly <img src='http://dryice.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>There are two solutions for this, with nearly the same mechinesm: turn the running <a href="http://dryice.name/blog/emacs/index.html">Emacs</a> as a server and connect to it from the outside world. Emacsserv/emacsclient comes with the official GNU Emacs and there&#8217;s a standalone package called <a href="http://meltin.net/hacks/emacs/">gnuserv</a>. The later is more powerful that it could connect from other machines through TCP/IP and works with <a href="http://www.xemacs.org">XEmacs</a> too. It is very useful with <a href="http://www.gnu.org/software/tramp/">tramp</a>, especially in the same LAN. I&#8217;ve used it before and it&#8217;s really handy. However my current network connection is not good for that kind of usage so I&#8217;m using the official emacsserv/emacsclient now.</p>
<p>To start it is simple: just add</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">(if (not noninteractive)<br />
(server-start))</div>
<p>to your <a href="http://dryice.name/blog/emacs/index.html">Emacs</a> config file. The noninteractive line makes sure the server only starts on an interactive <a href="http://dryice.name/blog/emacs/index.html">Emacs</a>. I have some scripts calling <a href="http://dryice.name/blog/emacs/index.html">Emacs</a> and I don&#8217;t want them to start another instance of <a href="http://dryice.name/blog/emacs/index.html">Emacs</a> and confuse the clients about which server to connect.</p>
<p>It is easy to use in the terminal, just call emacsclient with the file you want to edit. One important option is &#8220;—no-wait&#8221; which tells the shell or caller don&#8217;t wait for the end of the editing.</p>
<p>I have</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">#!/bin/sh<br />
emacsclient &#8211;no-wait $@</div>
<p>as my ~/bin/e so I can call it with less key presses. This not only works for files, if you give it a directory as the argument, like &#8220;e .&#8221;, <a href="http://dryice.name/blog/emacs/index.html">Emacs</a> will show the dired buffer with the current directory.</p>
<p>And I have</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">#!/bin/sh<br />
emacsclient $@</div>
<p>as my ~/bin/e_wait and EDITOR and VISUAL point to it.</p>
<p>And in <a href="http://dryice.name/blog/firefox/index.html">Firefox</a>, there is a <a href="https://addons.mozilla.org/extensions/moreinfo.php?id=60">web developer entension</a> that could call external editors for viewing page source, the &#8220;e&#8221; shell fits quite well here.</p>
<p>It can do more than that, like <a href="../firefox/let_emacs_handle_mailto_.muse">use Emacs to handle &#8220;mailto:&#8221; within firefox</a>.</p>
<p>Sometimes want to jump to the current <a href="http://dryice.name/blog/emacs/index.html">Emacs</a> directory in the buffer? this function</p>
<div style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">(defun default-directory-to-kill-ring ()<br />
&quot;Copy current directory to `kill-ring&#8217; prefixed with &#8216;cd &#8216;.&quot;<br />
(interactive)<br />
(if (consp comint-completion-addsuffix)<br />
(kill-new (concat &quot;cd &quot; (subst-char-in-string ?/ (string-to-char<br />
(car comint-completion-addsuffix)) default-directory)))<br />
(kill-new (concat &quot;cd &quot; default-directory))<br />
)<br />
)</div>
<p>helps me alot. I bind it to &#8220;C-c g d&#8221; and I can paste the directory with &#8220;cd&#8221; to the terminal.</p>
<p><hints id="hah_hints"></hints></p>
<p class="akst_link"><a href="http://dryice.name/blog/?p=695&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_695" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://dryice.name/blog/emacs/interactive-with-the-rest-of-the-world/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

