<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="http://xahlee.org/emacs/">

 <title>Xah's Emacs Blog</title>
 <subtitle>Emacs, Emacs, Emacs</subtitle>
 <link rel="self" href="http://xahlee.org/emacs/blog.xml"/>
 <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 <updated>2010-07-30T23:32:31-07:00</updated>
 <author>
   <name>Xah Lee</name>
   <uri>http://xahlee.org/</uri>
 </author>
 <id>http://xahlee.org/emacs/blog.html</id>
 <icon>http://xahlee.org/ics/sum.png</icon>
 <rights>© 2009, 2010 Xah Lee</rights>

 <entry>
   <title>Emacs Idolization: Have You Read the Emacs Manual From Cover to Cover?</title>
   <id>tag:xahlee.org,2010-07-31:063231</id>
   <updated>2010-07-31T01:03:02-07:00</updated>
   <summary>essay</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_manual_cover_to_cover.html"/>
 </entry>

 <entry>
   <title>outline mode (org-mode) tree branch moving keys</title>
   <id>tag:xahlee.org,2010-07-30:091548</id>
   <updated>2010-07-30T02:15:48-07:00</updated>
   <summary>tips</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Outline mode (org-mode) is nice, but i never took the time to learn the details. Have been using it simply by just knowing the star header syntax and Tab or Shift Tab to show/hide headings. Today, i took the time and learned the basics keyboard shortcuts for creating and moving branches. Fantastic. Added to <a href="emacs_outline.html">Writing Outline with Emacs (org mode tutorial)</a>.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_outline.html"/>
 </entry>

 <entry>
   <title>glasses-mode for camelCase</title>
   <id>tag:xahlee.org,2010-07-29:073359</id>
   <updated>2010-07-29T00:33:59-07:00</updated>
   <summary>tips</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Learned a tip today. There's glasses-mode, a minor mode, bundled in at least emacs 22.2. It will display “camelCase” words like this “camel-Case”. Note: it only display it that way, the text is actually not changed. (via gnu.emacs.help post by Tim X)</p>

<p>This tip is added to: <a href="emacs_adv_tips.html">Emacs Advanced Tips</a>.</p>

</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_adv_tips.html"/>
 </entry>

 <entry>
   <title>Emacs Lisp: Writing a google-earth Function</title>
   <id>tag:xahlee.org,2010-07-26:133445</id>
   <updated>2010-07-26T06:34:45-07:00</updated>
   <summary>elisp tutorial. Complete re-write. It was written when i just started learning elisp in 2006. Now much better.</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/google-earth.html"/>
 </entry>

 <entry>
   <title>How To Avoid The Emacs Pinky Problem</title>
   <id>tag:xahlee.org,2010-07-25:080030</id>
   <updated>2010-07-25T01:00:30-07:00</updated>
   <summary>tips. Added a section.</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_pinky.html"/>
 </entry>

 <entry>
   <title>misc: google earth, kml, emacs lisp scripting...</title>
   <id>tag:xahlee.org,2010-07-24:025446</id>
   <updated>2010-07-23T19:54:46-07:00</updated>
   <summary>see content</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>In the past few days, been working on my site that heavily involves emacs lisp scripts i've written.</p>

<p>First is a update to my kml files. See: <a href="../comp/kml_validation.html">(Google Earth) KML Validation Fuckup</a>.
This involves also updating my script for generating kml files, see:
<a href="google-earth.html">Emacs Lisp: Writing a google-earth Function</a>.
Then, i created a collection of links to kml files. See: <a href="../kml_links.html">Google Earth Files at XahLee.org</a>.
This is done by modifying my elisp script that generate Wikipedia links. See:
<a href="elisp_link_report.html">Generate a Web Links Report with Emacs Lisp</a>.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>How to Quickly Switch Fonts in Emacs</title>
   <id>tag:xahlee.org,2010-07-18:212339</id>
   <updated>2010-07-18T14:23:39-07:00</updated>
   <summary>tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_switching_fonts.html"/>
 </entry>

 <entry>
   <title>GNU Emacs Developement Inefficiency</title>
   <id>tag:xahlee.org,2010-07-15:225159</id>
   <updated>2010-07-15T15:51:59-07:00</updated>
   <summary>commentary</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/GNU_Emacs_dev_inefficiency.html"/>
 </entry>

 <entry>
   <title>ErgoEmacs mentioned in hacker news</title>
   <id>tag:xahlee.org,2010-07-14:191216</id>
   <updated>2010-07-14T12:12:16-07:00</updated>
   <summary>ErgoEmacs testimonial</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>ErgoEmacs mentioned in <a class="sorc" href="http://news.ycombinator.com/item?id=1510146" title="accessed:2010-07-14">news.ycombinator.com</a>.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>Emacs Lisp's Library System</title>
   <id>tag:xahlee.org,2010-07-14:002333</id>
   <updated>2010-07-13T17:23:33-07:00</updated>
   <summary>tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/elisp_library_system.html"/>
 </entry>

 <entry>
   <title>GUI Makes People Dumb?</title>
   <id>tag:xahlee.org,2010-07-12:024018</id>
   <updated>2010-07-11T19:40:18-07:00</updated>
   <summary>commentary</summary>
  <link rel="alternate" href="http://xahlee.org/UnixResource_dir/writ/gui_and_dumbness.html"/>
 </entry>

 <entry>
   <title>Emacs: How to Turn a Minor Mode on/off/toggle?</title>
   <id>tag:xahlee.org,2010-07-11:165015</id>
   <updated>2010-07-11T09:50:15-07:00</updated>
   <summary>a major correction; Thanks to YOO.</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs-tip_mode_on_off_toggle.html"/>
 </entry>

 <entry>
   <title>move between CamelCaseLetters</title>
   <id>tag:xahlee.org,2010-07-04:144911</id>
   <updated>2010-07-04T07:49:11-07:00</updated>
   <summary>tip</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Want the cursor movement to stop between camelCaseLetters? Use “global-subword-mode” or “subword-mode”. (Thanks to Deniz Dogan for the tip.)</p>

<p>This tip is added to: <a href="emacs_adv_tips.html">Emacs Advanced Tips</a>.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_adv_tips.html"/>
 </entry>

 <entry>
   <title>GNU Emacs and Xemacs Schism, by Ben Wing</title>
   <id>tag:xahlee.org,2010-06-29:134712</id>
   <updated>2010-06-29T06:47:12-07:00</updated>
   <summary>article</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/gnu_emacs_xemacs_schism_Ben_Wing.html"/>
 </entry>

 <entry>
   <title>Famous Emacs People With Hand Injuries</title>
   <id>tag:xahlee.org,2010-06-28:104926</id>
   <updated>2010-06-28T03:49:26-07:00</updated>
   <summary>collection of stories</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_hand_pain_celebrity.html"/>
 </entry>

 <entry>
   <title>Emacs Formfeed (^L) Display Suggestion and Tips</title>
   <id>tag:xahlee.org,2010-06-24:120138</id>
   <updated>2010-06-24T05:01:38-07:00</updated>
   <summary>tips</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/modernization_formfeed.html"/>
 </entry>

 <entry>
   <title>Emacs Switching to Guile Scheme Lisp?</title>
   <id>tag:xahlee.org,2010-06-23:125516</id>
   <updated>2010-06-23T05:55:16-07:00</updated>
   <summary>commentary</summary>
  <link rel="alternate" href="http://xahlee.org/UnixResource_dir/writ/emacs_switch_to_scheme.html"/>
 </entry>

 <entry>
   <title>Emacs byte compile incompability on 23.1 vs 23.2</title>
   <id>tag:xahlee.org,2010-06-22:130502</id>
   <updated>2010-06-22T06:28:37-07:00</updated>
   <summary>commentary</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/elisp_byte_compile_problem.html"/>
 </entry>

 <entry>
   <title>new version of bbcode mode and unicode browser mode</title>
   <id>tag:xahlee.org,2010-06-21:115605</id>
   <updated>2010-06-21T04:56:05-07:00</updated>
   <summary>announcement</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>A new version of <a href="xbbcode-mode.html">bbcode-mode</a>. Also a new version of <a href="unicode-browser.html">xub Unicode Browser mode</a>.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>Xub Unicode Browser mode for Emacs</title>
   <id>tag:xahlee.org,2010-06-20:132124</id>
   <updated>2010-06-20T06:21:24-07:00</updated>
   <summary>new emacs major mode</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/unicode-browser.html"/>
 </entry>

 <entry>
   <title>Emacs cua-mode Problems</title>
   <id>tag:xahlee.org,2010-06-20:033135</id>
   <updated>2010-06-19T20:31:35-07:00</updated>
   <summary>commentary; essay; emacs modernization</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/modernization_cua-mode.html"/>
 </entry>

 <entry>
   <title>arrows in unicode</title>
   <id>tag:xahlee.org,2010-06-19:094634</id>
   <updated>2010-06-19T02:46:48-07:00</updated>
   <summary>collection of unicode characters</summary>
  <link rel="alternate" href="http://xahlee.org/comp/unicode_arrows.html"/>
 </entry>

 <entry>
   <title>Text Editor's Cursor Movement Behavior (emacs, vi, Notepad++)</title>
   <id>tag:xahlee.org,2010-06-18:062044</id>
   <updated>2010-06-17T23:20:44-07:00</updated>
   <summary>commentary; essay; question</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/text_editor_cursor_behavior.html"/>
 </entry>

 <entry>
   <title>Keyboard Hardware's Influence on Keyboard Shortcut Design</title>
   <id>tag:xahlee.org,2010-06-16:233607</id>
   <updated>2010-06-16T16:36:07-07:00</updated>
   <summary>commentary; emacs; vi</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/keyboard_hardware_and_key_choices.html"/>
 </entry>

 <entry>
   <title>system wide ErgoEmacs keybinding for Mac OS X and Bash</title>
   <id>tag:xahlee.org,2010-06-15:173710</id>
   <updated>2010-06-15T10:37:10-07:00</updated>
   <summary>code, tips, commentary</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Spend 8 hours rewrote the article: <a href="osx_keybinding.html">How To Create Keybinding In Mac OS X</a>. Also, created a system wide ErgoEmacs keybinding for OS X and bash, for both Qwerty and Dvorak layout. Download at:
<a href="http://code.google.com/p/ergoemacs/source/browse/trunk/extra/">code.google.com</a>.
(Thanks to Brendan Miller for the initial work on bash binding)</p>

<p>Also, wrote another article: <a href="../comp/keyboard_key_ghosting.html">Keyboard Ghosting; How Many Keys Your Keyboard Can Take?</a>.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>keyboarding</title>
   <id>tag:xahlee.org,2010-06-14:164025</id>
   <updated>2010-06-14T09:40:25-07:00</updated>
   <summary>several new articles on keyboarding</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>A few new articles i wrote in the past few days on keyboarding that might be of interest to emacs users.</p>

<ul>
<li><a href="keyboard_Kinesis.html">Kinesis Contoured Keyboard Review and RSI</a></li>
<li><a href="keyboards_hacker_idiocy.html">The Idiocy of Hacker Keyboards</a></li>
<li><a href="../comp/keyboard_shortcut_design.html">Keyboard Shortcut Design: Dedicated keys, Special Buttons, Extra Keys</a></li>
</ul>

</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>emacs why line-move-visual</title>
   <id>tag:xahlee.org,2010-06-10:111223</id>
   <updated>2010-06-10T04:12:23-07:00</updated>
   <summary>essay; newsgroup flame</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_line_move_visual.html"/>
 </entry>

 <entry>
   <title>Emacs nxml-mode Fontification Changes</title>
   <id>tag:xahlee.org,2010-06-09:160010</id>
   <updated>2010-06-09T09:00:10-07:00</updated>
   <summary>some tech notes</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_23.2_nxml_fontification_changes.html"/>
 </entry>

 <entry>
   <title>All About Processing Lines in Emacs Lisp</title>
   <id>tag:xahlee.org,2010-06-08:103553</id>
   <updated>2010-06-08T03:35:53-07:00</updated>
   <summary>emacs lisp tips</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/elisp_all_about_lines.html"/>
 </entry>

 <entry>
   <title>ErgoEmacs 1.8.1 for Windows (emacs 23.2)</title>
   <id>tag:xahlee.org,2010-06-06:221452</id>
   <updated>2010-06-06T15:14:52-07:00</updated>
   <summary>new release announcement</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>ErgoEmacs 1.8.1 for Windows is out! This one is based on the shiny new Emacs 23.2. (See: <a href="emacs23.2_features.html">Emacs 23.2 Features</a>.) Check it out! Download at:
<a href="http://ergoemacs.googlecode.com/files/ErgoEmacs%201.8.1%20Setup.exe">googlecode.com ErgoEmacs 1.8.1 Setup.exe</a>. (Thanks to <a href="http://www.davidcapello.com.ar/">David Capello</a> for the C coding on Windows.)</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>Emacs 23.2 Features</title>
   <id>tag:xahlee.org,2010-06-02:223525</id>
   <updated>2010-06-02T15:35:25-07:00</updated>
   <summary>a report and some thoughts</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs23.2_features.html"/>
 </entry>

 <entry>
   <title>emacs incremental search suggestions</title>
   <id>tag:xahlee.org,2010-05-29:202145</id>
   <updated>2010-05-29T13:21:45-07:00</updated>
   <summary>essay and practical tip</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/modernization_isearch.html"/>
 </entry>

 <entry>
   <title>Emacs Spell Checker Problems</title>
   <id>tag:xahlee.org,2010-05-25:214132</id>
   <updated>2010-05-25T14:41:32-07:00</updated>
   <summary>criticism; short essay</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_spell_checker_problems.html"/>
 </entry>

 <entry>
   <title>copy and cut the current line</title>
   <id>tag:xahlee.org,2010-05-21:164517</id>
   <updated>2010-05-21T09:45:17-07:00</updated>
   <summary>tips</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Discovered a great tip to copy current line, or cut.</p>

<p>Last month, i wrote <a href="emacs_delete_whole_line.html">Emacs: Shortcut to Delete Whole Line</a>, because i find that deleting whole line is much frequently needed. But also, i didn't mention that i often find the need to copy the current line too. Usually, this meas moving the cursor to beginning of line, mark, move to end of line, then copy. This is 4 operations. The following code will make it just a single operation:</p>

<pre class="elisp">
(<span class="keyword">defadvice</span> <span class="function-name">kill-ring-save</span> (before slick-copy activate compile)
  <span class="doc">"When called interactively with no active region, copy the current line."</span>
  (interactive
   (<span class="keyword">if</span> mark-active
       (list (region-beginning) (region-end))
     (<span class="keyword">progn</span>
       (message <span class="string">"Current line is copied."</span>)
       (list (line-beginning-position) (line-end-position)) ) ) ))

(<span class="keyword">defadvice</span> <span class="function-name">kill-region</span> (before slick-copy activate compile)
  <span class="doc">"When called interactively with no active region, cut the current line."</span>
  (interactive
   (<span class="keyword">if</span> mark-active
       (list (region-beginning) (region-end))
     (<span class="keyword">progn</span>
       (message <span class="string">"Current line is cut."</span>)
       (list (line-beginning-position) (line-end-position)) ) ) ))
</pre>

<p>With the above code, when you do not have a text selection, copy will just copy the current line. Similar for cut. Super!</p>

<p>Thanks to
<a href="http://instantcallout.com/">Joseph O'Donnell</a> for mentioning this. The code is originally from
<a href="http://www.emacswiki.org/emacs/SlickCopy">emacswiki.org SlickCopy</a>.
Apparently, this behavior is default in VisualStudio, TextMate, SlickEdit.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>camelCase and Source Code Formatting</title>
   <id>tag:xahlee.org,2010-05-18:122900</id>
   <updated>2010-05-18T05:29:00-07:00</updated>
   <summary>opnion; essay</summary>
  <link rel="alternate" href="http://xahlee.org/UnixResource_dir/writ/camelCase_code_formatting.html"/>
 </entry>

 <entry>
   <title>command to delete current file</title>
   <id>tag:xahlee.org,2010-05-16:170547</id>
   <updated>2010-05-16T10:05:47-07:00</updated>
   <summary>emacs tip and elisp learning tutorial</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>A new convenient elisp function.</p>

<p>Sometimes you want to delete the file of the current buffer. How do you do it?
Here's a simple command that does it.</p>

<pre class="elisp">
(<span class="keyword">defun</span> <span class="function-name">delete-current-file</span> ()
  <span class="doc">"Delete the file associated with the current buffer."</span>
  (interactive)
  (<span class="keyword">let</span> (currentFile)
    (setq currentFile (buffer-file-name))
    (<span class="keyword">when</span> (yes-or-no-p (concat <span class="string">"Delete file: "</span> currentFile))
      (kill-buffer (current-buffer))
      (delete-file currentFile)
      (message (concat <span class="string">"Deleted file: "</span> currentFile))
      ) ) )
</pre>

<p>This is also a very simple command to learn elisp. The code is very easy to understand.  For more simple examples, see: <a href="elisp_examples.html">Emacs Lisp Examples</a>.</p>

</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>Emacs unfill-paragraph, unfill-region, compact-uncompact-block</title>
   <id>tag:xahlee.org,2010-05-13:043238</id>
   <updated>2010-05-12T21:32:38-07:00</updated>
   <summary>practical tips</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_unfill-paragraph.html"/>
 </entry>

 <entry>
   <title>Emacs Lisp list-matching-lines</title>
   <id>tag:xahlee.org,2010-05-11:050157</id>
   <updated>2010-05-10T22:01:57-07:00</updated>
   <summary>short emacs lisp tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/elisp_list_matching_lines_2.html"/>
 </entry>

 <entry>
   <title>Emacs Line Return And Dos, Unix, Mac, All That ^M ^J</title>
   <id>tag:xahlee.org,2010-05-08:004115</id>
   <updated>2010-05-07T17:41:15-07:00</updated>
   <summary>tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_line_ending_char.html"/>
 </entry>

 <entry>
   <title>Which Emacs to Download?</title>
   <id>tag:xahlee.org,2010-05-06:125623</id>
   <updated>2010-05-06T05:56:23-07:00</updated>
   <summary>This page is a guide on what emacs distributions are there, which one you should use, for Windows and Mac.</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/which_emacs.html"/>
 </entry>

 <entry>
   <title>List Matching Lines and Delete Matching Lines in Emacs</title>
   <id>tag:xahlee.org,2010-05-04:122629</id>
   <updated>2010-05-04T05:26:29-07:00</updated>
   <summary>tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/elisp_list_matching_lines.html"/>
 </entry>

 <entry>
   <title>emacs: deleting whole line</title>
   <id>tag:xahlee.org,2010-04-29:054134</id>
   <updated>2010-04-28T22:41:34-07:00</updated>
   <summary>tips + essay</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_delete_whole_line.html"/>
 </entry>

 <entry>
   <title>How to Define Optional Parameters in Emacs Lisp</title>
   <id>tag:xahlee.org,2010-04-26:061102</id>
   <updated>2010-04-25T23:11:02-07:00</updated>
   <summary>basic emacs lisp tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/elisp_optional_params.html"/>
 </entry>

 <entry>
   <title>emacs tip: editing file as root</title>
   <id>tag:xahlee.org,2010-04-23:151210</id>
   <updated>2010-04-23T08:33:22-07:00</updated>
   <summary>...</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Another little emacs tip. The tip is about how to edit files that requires admin privilege.</p>

<p>Often, you want to edit a file that requires admin privilege. So, either you start another emacs instance as root, or, modify the file's permission first with sudo then edit then modify it back. Both solutions are painful.</p>

<p>Starting another emacs instance is slower, and you also need to navigate to the dir path. Edit permission bits is error prone and dangerous.</p>

<p>When i was a full time unix sys admin, i usually always keep a instance of emacs as root, with different colored background. But this is also not a optimal solution.</p>

<p>Here's one short tip from the web:</p>

<pre class="elisp">
<span class="comment-delimiter">; </span><span class="comment">from newsgroup gnu.emacs.help, by Richard Riley, 2009-08-02 
</span>(<span class="keyword">defun</span> <span class="function-name">open-current-file-as-admin</span> ()
  <span class="doc">"Open the current buffer as unix root.
This command works on unixes only."</span>
  (interactive)
  (<span class="keyword">when</span> buffer-file-name
    (find-alternate-file
     (concat <span class="string">"/sudo:root@localhost:"</span>
           buffer-file-name))))
</pre>

<p>PS the above works in unixes only (including linuxes and Mac OS X). How does one do on Windows? If you know, please post! Concrete solution that you actually use is preferred.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>calculating dates in emacs</title>
   <id>tag:xahlee.org,2010-04-17:194357</id>
   <updated>2010-04-17T12:43:57-07:00</updated>
   <summary>little tips</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Little tips about calculating dates.</p>

<p>I needed to find the date of 2010-04-17 minus 200 days. How do you do it in emacs?</p>

<p>Start calendar mode by tying “<span class="kbd"><span class="key">Alt</span>+<span class="key">x</span></span> cale <span class="key">Enter</span>”. In calendar mode, the left arrow moves you back. But it also takes a universal argument of n to go back n days. So, type “C-u 200 ←” will put you 200 days back.</p>

<p>When your cursor is in the calender pane, there are these new menus: Scroll, Goto, Holidays, Diary, Sun/Moon. Check them out! I've been using emacs for 12 years, but never realized this!</p>

<p>PS thanks to people on
<a class="sorc" href="http://groups.google.com/group/comp.emacs/browse_frm/thread/0daa90546fb4bfba" title="accessed:2010-04-17">comp.emacs</a>, in particular Jason Rumney.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>Emacs Templates with YASnippet</title>
   <id>tag:xahlee.org,2010-04-13:162001</id>
   <updated>2010-04-13T09:20:01-07:00</updated>
   <summary>This page shows you a very useful and easy to use tool for inserting any type of templates for any programing language.</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_templates.html"/>
 </entry>

 <entry>
   <title>Best Unicode Fonts for Emacs</title>
   <id>tag:xahlee.org,2010-04-10:113819</id>
   <updated>2010-04-10T04:38:19-07:00</updated>
   <summary>tutorial; tips</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_unicode_fonts.html"/>
 </entry>

 <entry>
   <title>What's Emacs Custom System and Should You Use It?</title>
   <id>tag:xahlee.org,2010-04-07:105515</id>
   <updated>2010-04-07T03:55:15-07:00</updated>
   <summary>tutorial. what it is, how it works, the generated code, pros and cons.</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_custom_system.html"/>
 </entry>

 <entry>
   <title>emacs lisp tutorial in Chinese and Japanese</title>
   <id>tag:xahlee.org,2010-04-05:081820</id>
   <updated>2010-04-05T01:18:20-07:00</updated>
   <summary>...</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Some of my emacs lisp tutorial have been translated to Chinese and Japanese.</p>

<ul>
<li><a href="http://xahlee.org/emacs/elisp_idioms.html">Emacs Lisp Idioms</a> in Japanese: <span class="atlt">武蔵の日記 (Musashi's Diary)</span> (2009-01-18), By 武蔵, at <a class="sorc" href="http://d.hatena.ne.jp/sirocco634/20090118" title="accessed:2010-04-03">Source</a></li>
<li><a href="http://xahlee.org/emacs/elisp_basics.html">Emacs Lisp Basics</a> in Chinese: <span class="atlt">[elisp]EmacsLisp 基础</span> (2010-01-31), By laihj, at <a class="sorc" href="http://www.laihj.net/2010/01/elipsemacslisp-basi/" title="accessed:2010-04-03">Source</a></li>
</ul>

<p>Thanks people.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>Organize Your .emacs in 5 Minutes</title>
   <id>tag:xahlee.org,2010-04-03:120837</id>
   <updated>2010-04-03T05:08:37-07:00</updated>
   <summary>tips</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>This article shows you a quick way to organize your emacs init file.</p>

<p>Most emacs users, has tens or hundred lines in their emacs init file, accumulated over the years. Large emacs init files makes emacs startup slow, and is a problem when you upgrade emacs, or install a new package.</p>

<p>So, how do you organize it?  When it comes to organization, most of us, probably thinks of lots of times spend on it, or with some special principle, system, to keep the .emacs file clean. Personally, i find that elaborate rule or system or time spend on this is actually not productive.</p>

<p>...</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/organize_your_dot_emacs.html"/>
 </entry>

 <entry>
   <title>command to insert random number or date</title>
   <id>tag:xahlee.org,2010-03-28:033026</id>
   <updated>2010-03-27T20:30:26-07:00</updated>
   <summary>short tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>Emacs: What's Region, Active Region, transient-mark-mode?</title>
   <id>tag:xahlee.org,2010-03-26:070153</id>
   <updated>2010-03-26T00:01:53-07:00</updated>
   <summary>emacs lisp tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_region.html"/>
 </entry>

 <entry>
   <title>Count Words, Count Chars, Count Region</title>
   <id>tag:xahlee.org,2010-03-24:045536</id>
   <updated>2010-03-23T21:55:36-07:00</updated>
   <summary>emacs lisp tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/elisp_count-region.html"/>
 </entry>

 <entry>
   <title>Emacs: How to Turn a Mode on/off/toggle?</title>
   <id>tag:xahlee.org,2010-03-21:041313</id>
   <updated>2010-03-20T21:13:13-07:00</updated>
   <summary>tutorial; minor tip</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs-tip_mode_on_off_toggle.html"/>
 </entry>

 <entry>
   <title>Writing Outline with Emacs (org mode tutorial)</title>
   <id>tag:xahlee.org,2010-03-16:031047</id>
   <updated>2010-03-15T20:10:47-07:00</updated>
   <summary>basic tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_outline.html"/>
 </entry>

 <entry>
   <title>dired-jump: go to the dir the file is in</title>
   <id>tag:xahlee.org,2010-03-09:174022</id>
   <updated>2010-03-09T09:40:22-08:00</updated>
   <summary>tips</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Learned a new command: “dired-jump”.</p>

<p>If you have a file open and you need to go to the directory the file is in, you can just call dired-jump, and it'll take you to the dir and place your cursor on the file.</p>

<p>You could just use find-file (C-x C-f) then press Enter, because that opens the current dir and the current dir is usually the dir the file is in. However, if the dir has a hundred files, then you have to do a search command to locate the file. The “dired-jump” does all this for you.</p>

<p>In the past, i actually defined my own command for this:</p>

<pre class="elisp">
<span class="comment-delimiter">; </span><span class="comment">DON'T USE THIS COMMAND. use dired-jump instead.
</span>(<span class="keyword">defun</span> <span class="function-name">show-file-in-dired</span> ()
  <span class="doc">"Show the current file in dired.
DON'T USE THIS COMMAND. This command was written before i knew dired-jump."</span>
  (interactive)
  (<span class="keyword">let</span> (fname dname)
    (setq fname buffer-file-name)
    (setq dname (file-name-directory fname) )
    (dired dname)
    (search-forward (file-name-nondirectory fname))
    )
  )
</pre>

<p>If typing “dired-jump” is too much for you, you can define a alias
“(defalias 'dj 'dired-jump)”, or a shortcut (See: <a href="keyboard_shortcuts.html">How to Define Keyboard Shortcuts in Emacs</a>).</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>Why Emacs Is So Useful</title>
   <id>tag:xahlee.org,2010-03-04:190244</id>
   <updated>2010-03-04T11:02:44-08:00</updated>
   <summary>essay</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs_power_story.html"/>
 </entry>

 <entry>
   <title>How To Swap Caps Lock, Alt, Control Keys On Windows</title>
   <id>tag:xahlee.org,2010-02-27:173532</id>
   <updated>2010-02-27T09:35:32-08:00</updated>
   <summary>tip</summary>
  <link rel="alternate" href="http://xahlee.org/mswin/autohotkey_swap_capslock.html.html"/>
 </entry>

 <entry>
   <title>new version of AutoHotKey mode xahk-mode</title>
   <id>tag:xahlee.org,2010-02-17:112753</id>
   <updated>2010-02-17T03:27:53-08:00</updated>
   <summary>...</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml"><p>A new version of AutoHotKey Mode For Emacs is out. This version fixes a defect where if the source code contains “"C:\"”, then everything after is badly syntax colored.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/mswin/emacs_autohotkey_mode.html"/>
 </entry>

 <entry>
   <title>emacs command frequency report</title>
   <id>tag:xahlee.org,2010-02-14:030703</id>
   <updated>2010-02-13T19:07:03-08:00</updated>
   <summary>a new version ...</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml"><p>A new report. This report is a major update from the one in 2007, with data size that's 20 times larger. It took some 16+ hours to do this report, most time is spent on thinking and rewriting the python script that generates the report. (i thought it was just gonna be some 2 hours)</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/command-frequency.html"/>
 </entry>

 <entry>
   <title>New release: ErgoEmacs 1.7</title>
   <id>tag:xahlee.org,2010-01-29:023221</id>
   <updated>2010-01-28T18:32:21-08:00</updated>
   <summary>...</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>A new release of <a href="http://ergoemacs.org/">ErgoEmacs</a> is out, at version 1.7. (Thanks to David Capello)</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>frustration about using emacs dired and Windows Vista's VirtualStore</title>
   <id>tag:xahlee.org,2010-01-29:022718</id>
   <updated>2010-01-28T18:27:18-08:00</updated>
   <summary>minor tip</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml"><p>If your are running Microsoft Vista, and you use emacs to edit files in the “C:\Program Files\” or “c:\Program Files (x86)\” dir, and without admin privilege, Windows will automatically create them in “$HOME\AppData\Local\VirtualStore\”. This may be very confusing, because dired will show a certain file you have in the program dir, but it doesn't exist when you use shell to look for it.  For detail, see <a href="http://xahlee.org/UnixResource_dir/writ/hardlink_softlink_alias_junction_plague.html">File Aliases Considered A Plague</a>.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/UnixResource_dir/writ/hardlink_softlink_alias_junction_plague.html"/>
 </entry>

 <entry>
   <title>“Zen-Coding”, A Abbrev Expansion Template System For HTML</title>
   <id>tag:xahlee.org,2010-01-23:034421</id>
   <updated>2010-01-22T19:44:21-08:00</updated>
   <summary>...</summary>
  <link rel="alternate" href="http://xahlee.org/js/zen-coding.html"/>
 </entry>

 <entry>
   <title>Emacs Function's Inline Doc String Markups</title>
   <id>tag:xahlee.org,2010-01-13:111321</id>
   <updated>2010-01-13T03:13:21-08:00</updated>
   <summary>tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/inline_doc.html"/>
 </entry>

 <entry>
   <title>emacs bookmark feature</title>
   <id>tag:xahlee.org,2010-01-13:022641</id>
   <updated>2010-01-12T18:26:41-08:00</updated>
   <summary>tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/bookmark.html"/>
 </entry>

 <entry>
   <title>a new AutoHotKey mode</title>
   <id>tag:xahlee.org,2010-01-11:081348</id>
   <updated>2010-01-11T00:13:48-08:00</updated>
   <summary>new package announcement</summary>
  <link rel="alternate" href="http://xahlee.org/mswin/emacs_autohotkey_mode.html"/>
 </entry>

 <entry>
   <title>remove syntax coloring</title>
   <id>tag:xahlee.org,2010-01-09:190209</id>
   <updated>2010-01-09T11:02:09-08:00</updated>
   <summary>how to remove syntax coloring in some text</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Sometimes, i want take out all the syntax coloring of some text. Never knew how to do that... but today i discovered font-lock-unfontify-region. Unfortunately, it's a function not command, so you cannot call it with “Alt+x”. So, i make one:</p>

<pre class="elisp">
(<span class="keyword">defun</span> <span class="function-name">unfontify-region</span> (begin end)
  <span class="doc">"Unfontify text selection.
See also: `</span><span class="doc"><span class="constant">font-lock-fontify-block</span></span><span class="doc">', `</span><span class="doc"><span class="constant">font-lock-fontify-buffer</span></span><span class="doc">'."</span>
  (interactive <span class="string">"r"</span>)
  (font-lock-unfontify-region begin end)
  )
</pre>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>Emacs Ahk Mode Problems</title>
   <id>tag:xahlee.org,2010-01-09:124943</id>
   <updated>2010-01-09T04:49:43-08:00</updated>
   <summary>a detailed account on a particular emacs package</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/emacs-ahk_mode_problems.html"/>
 </entry>

 <entry>
   <title>elisp lesson: updating Atom webfeed</title>
   <id>tag:xahlee.org,2010-01-03:025534</id>
   <updated>2010-03-05T15:15:34-08:00</updated>
   <summary>tutorial</summary>
  <link rel="alternate" href="http://xahlee.org/emacs/elisp_update_atom.html"/>
 </entry>

 <entry>
   <title>elisp example: cycle state, lisp symbol property, setting font</title>
   <id>tag:xahlee.org,2010-01-02:234451</id>
   <updated>2010-01-02T15:44:51-08:00</updated>
   <summary>short tutorial</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Added a code snippet on <a href="elisp_examples2.html">More Elisp Examples</a>. The code shows you how to write a function that cycle thru states when called repeatedly, and also explains the concepts of lisp's “symbol property”, setting font in a frame.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/elisp_examples2.html"/>
 </entry>

 <entry>
   <title>customizing emacs syntax coloring</title>
   <id>tag:xahlee.org,2010-01-02:020322</id>
   <updated>2010-01-01T18:03:22-08:00</updated>
   <summary>customizing emacs syntax coloring</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml"><p>On Dec 26 2009, 8:50 pm, Ccming  wrote:</p>

<blockquote>
<p>I very like the default style of PHP lanuage on Notepad++, hope I can use them on GNU Emacs.</p>
</blockquote>

<p>Yes.</p>

<p>i don't recommend it because emacs's font style for programing lang keyword types are used across all langs. For example, function is blue, strings is a bit orange, coments are red, etc., for all langs. Also, emacs's font face coloring are designed so it's also usable when in 8-color terminal.</p>

<p>anyway, to do what you want, do Alt+x customize-group, then give “font-lock-faces”. There, you can use the mouse to select and change.</p>

<p>you can see a sample of how emacs coloring are for different languages here: <a href="../js/google-code-prettify/index.html">Google-code-prettify Examples</a>.</p>

</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>starting emacs blog</title>
   <id>tag:xahlee.org,2010-01-02:010657</id>
   <updated>2010-01-01T17:06:57-08:00</updated>
   <summary>first blog entry</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Am starting this emacs blog. Often, i have random tips or notes i
want to write down. Too small to be part of tutorial, but still useful
even to myself later. This blog also serve as news update for my
emacs tutorial. I have a main blog
<a href="../Periodic_dosage_dir/pd.html">Periodic Dosage of Xah Lee</a> but that
is not focused on emacs topic. Many people are interested in
my emacs news but not others. So, this emacs blog will help.
</p>

<p>What follows are emacs related stuff from my main blog in the past several months. I put them here to start with, and also gives some sense of the topics in this blog.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

 <entry>
   <title>don't use lambda in hook</title>
   <id>tag:xahlee.org,2010-01-02:010346</id>
   <updated>2010-03-29T07:12:51-07:00</updated>
   <summary>some tips</summary>
   <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Ok, here's first blog entry.</p>

<p>when you use a hook, it is best to define it as a function, then add that to hook, instead of using a lambda. Let me explain.</p>

<p>Here's what a hook most people would do:</p>

<pre class="elisp">
<span class="comment-delimiter">;; </span><span class="comment">modify nxml-mode's shortcut keys
</span>(add-hook 'nxml-mode-hook
 (<span class="keyword">lambda</span> ()
 (define-key nxml-mode-map (kbd <span class="string">"&lt;f8&gt;"</span>) 'browse-url-of-buffer)
 (define-key nxml-mode-map (kbd <span class="string">"&lt;tab&gt;"</span>) 'html-next-content)
 (define-key nxml-mode-map (kbd <span class="string">"S-&lt;tab&gt;"</span>) 'html-previous-content)))
</pre>

<p>However, it is better done like this:</p>

<pre class="elisp">
(<span class="keyword">defun</span> <span class="function-name">xah-xml-mode-keys</span> ()
  <span class="doc">"Modify keymaps used by xml-mode."</span>
  (interactive)
 (define-key nxml-mode-map (kbd <span class="string">"&lt;f8&gt;"</span>) 'browse-url-of-buffer)
 (define-key nxml-mode-map (kbd <span class="string">"&lt;tab&gt;"</span>) 'html-next-content)
 (define-key nxml-mode-map (kbd <span class="string">"S-&lt;tab&gt;"</span>) 'html-previous-content)
  )

(add-hook 'nxml-mode-hook 'xah-xml-mode-keys)
</pre>

<p>There are several advantage. One of them is that with a function name, you can now remove some of your hook stuff easily by calling “remove-hook”. Also, suppose you are using 
<a href="http://xahlee.org/emacs/command-frequency.html">command-frequency-mode</a> to know what commands you use the most. If you have lambda, the data will become unreadible with bunch of lambdas, instead of command names.</p>

<p>Of course, lambda in hook is so convenient, typically
just used once in your emacs init file, and you don't need to
manipulate it with remove-hook or others. But if you are using hooks
in your elisp code in a package, it's best to define functions instead
of using lambda in hooks.</p>
</div>
   </content>
  <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
 </entry>

</feed>
