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

<channel>
	<title>Bugfree.dk - Ronnie Holm&#039;s blog &#187; Emacs</title>
	<atom:link href="http://www.bugfree.dk/blog/tag/emacs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bugfree.dk/blog</link>
	<description>Not anti-anything, just pro-quality</description>
	<lastBuildDate>Mon, 28 Nov 2011 07:32:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Configuring Emacs through Emacs Lisp</title>
		<link>http://www.bugfree.dk/blog/2010/04/15/configuring-emacs-through-emacs-lisp/</link>
		<comments>http://www.bugfree.dk/blog/2010/04/15/configuring-emacs-through-emacs-lisp/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 20:50:02 +0000</pubDate>
		<dc:creator>Ronnie Holm</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://www.bugfree.dk/blog/?p=1046</guid>
		<description><![CDATA[I’ve been an Emacs fanboy for close to 15 years. For a long time I used Emacs solely on Linux because of it’s ubiquity. But written in C and Emacs Lisp, Emacs has great cross-platform support, and now I use it daily on Windows too. Installing Emacs on Windows is as straightforward as downloading and [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been an Emacs fanboy for close to 15 years. For a long time I used Emacs solely on Linux because of it’s ubiquity. But written in C and <a href="http://en.wikipedia.org/wiki/Emacs_Lisp">Emacs Lisp</a>, Emacs has great cross-platform support, and now I use it daily on Windows too. <a href="http://www.gnu.org/software/emacs/windows/Getting-Emacs.html">Installing Emacs</a> on Windows is as straightforward as downloading and extracting the <a href="http://ftp.gnu.org/gnu/emacs/windows/">most recent Zip file</a>.</p>
<h4>Code equals data</h4>
<p>Configuring the editor is done by placing Emacs Lisp code in the .emacs file. Whenever Emacs starts, it looks for this file in the directory specified by the HOME environment variable and executes its content. Unlike the XML configuration files of .NET and Java, with Emacs there’s no intermediate configuration format. There’s no extra language to learn and no limitation in the expressiveness of the configuration language. With this interchangeability of code and data, every behavior of Emacs can be hooked into and tailored and every global variable redefined.</p>
<h4>Starting Emacs from the Windows taskbar</h4>
<p>On my machine, I like everything Emacs-related to reside in the directory that I extracted Emacs to, yet I want to be able to start Emacs from the taskbar. I do this by pinning cmd.exe to the taskbar and modifying its destination so it defines HOME for this instance before spawning Emacs. This way the HOME of Emacs doesn’t conflict with the HOME of other applications.</p>
<pre>    cmd.exe /C &quot;set HOME=...\emacs-23.1&amp;&amp;...\emacs-23.1\bin\runemacs.exe&quot;</pre>
<p>My .emacs isn’t too esoteric. Nevertheless, here it is for posterity. Reading on, keep in mind that unless otherwise noted, all referenced packages come with Emacs 23.1.</p>
<h4>General settings</h4>
<p>I start off redefining a couple of global variables. Much functionality relies on the user name and mail address to be known in advance. I then remove the toolbar at the top of the Emacs window, because I use menus or keyboard shortcuts anyway. Next I disable the splash screen on startup, and redefine a few global variables governing Emacs’ scrolling behavior. By default scrolling isn’t line by line, but chuck by chuck of text. I find this behavior confusing.</p>
<pre>    (setq user-full-name &quot;Ronnie Holm&quot;)
    (setq user-mail-address &quot;foo@bar.baz&quot;)

    (tool-bar-mode nil)                            ;; don't show the toolbar

    (setq inhibit-startup-message t                ;; don't show ...
          inhibit-startup-echo-area-message t)     ;; ... startup messages

    (setq scroll-margin 1                          ;; do smooth scrolling
          scroll-conservatively 100000
          scroll-up-aggressively 0.01
          scroll-down-aggressively 0.01)</pre>
<p>Next I turn on automatic syntax highlighting and commands specific to known file types. Following that I turn the blinking square cursor into a solid and less distracting one. Also, I instruct Emacs not to retain backups of files that I edit or save. I don’t discount the value of backups, but I also don’t like having to remove backup and auto-save files when they clutter my folders. Instead&#160; Emacs should move these files to the Windows Recycle Bin. Lastly, I enable <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Iswitchb.html">iswitchb-mode</a>, which makes switching buffers easier by providing on-the-fly suggestions.</p>
<pre>    (global-font-lock-mode t)                      ;; always do syntax highlighting
    (blink-cursor-mode 0)                          ;; don't blink cursor
    (setq backup-inhibited t)                      ;; no backup files
    (setq delete-by-moving-to-trash t)             ;; delete moves to recycle bin
    (iswitchb-mode t)                              ;; easy buffer switching</pre>
<p>The last of the general settings involve modifications to the modeline at the bottom of the Emacs window. By default it displays the buffer name, the line number, and the modes Emacs is in. I extend the modeline with the column cursor position and the size of the current buffer.</p>
<pre>    (column-number-mode t)                         ;; show column numbers
    (size-indication-mode t)                       ;; show file size</pre>
<h4>Package settings</h4>
<p>Oftentimes I find myself editing the same set of files every day. So having the cursor move to where I left it editing the file the last time is handy. This is done by <a href="http://www.emacswiki.org/cgi-bin/wiki/SavePlace">save-place mode</a>. Behind the scenes it stores a file name/offset mapping in a file below HOME.</p>
<pre>    (setq save-place-file &quot;~/.emacs.d/saveplace&quot;)  ;; location of saveplace file
    (setq-default save-place t)                    ;; activate for all buffer
    (require 'saveplace)</pre>
<p>As hinted by <a href="http://www.bugfree.dk/blog/2009/11/05/getting-organized-with-emacs-org-mode/">Getting organized with Emacs Org-mode</a>, I very much enjoy using <a href="http://orgmode.org">Org-mode</a> for keeping notes, maintaining lists, and much more. The next section of my .emacs is therefore dedicated to customizing org-mode. Firstly, to make documents easier to read, instead of displaying all the asterisks that designate an indentation level, only display the last one. Secondly, align each indentation level by always adding two asterisks on indentation. Thirdly, when clocking time, have Emacs remember what I was doing and for how long across restarts. But remove clocked time less than one minute.</p>
<pre>    (setq org-hide-leading-stars t)                ;; hide but one star in outline
    (setq org-add-levels-only t)                   ;; align items nicely
    (setq org-clock-persist t)                     ;; keep track of time ...
    (org-clock-persistence-insinuate)              ;; ... across sessions
    (setq org-clock-out-remove-zero-time-clocks t) ;; remove 0-duration clocked</pre>
<p>The default Emacs color theme looks kind of dull. So I downloaded the <a href="http://www.emacswiki.org/emacs/ColorTheme">color-theme</a> package and selected a more aesthetically pleasing theme. After downloading color-theme, place its Lisp files in ~/site-lisp. That’s one of the places where Emacs will automatically look for packages. The 300 or so packages that come with Emacs are in the ~/lisp folder.</p>
<pre>    (require 'color-theme)                         ;; use a color theme
    (color-theme-initialize)
    (color-theme-arjen)</pre>
<p>My last additions to .emacs involve Haskell. Emacs doesn’t support Haskell out-of-the-box. But a <a href="http://www.haskell.org/haskell-mode">haskell-mode</a> is available for download. It turns Emacs into a decent Haskell development environment. Besides syntax highlighting and code formatting capabilities, it adds to Emacs commands for interacting with the Haskell compiler and Haskell interactive.</p>
<pre>    (load &quot;~/site-lisp/haskell-mode-2.6.4/haskell-site-file&quot;)
    (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
    (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)</pre>
<p>This concludes my .emacs. Quite a few of these settings I picked up reading the <a href="http://emacs-fu.blogspot.com">emacs-fu</a> blog.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.bugfree.dk%2Fblog%2F2010%2F04%2F15%2Fconfiguring-emacs-through-emacs-lisp%2F&amp;title=Configuring%20Emacs%20through%20Emacs%20Lisp" id="wpa2a_2"><img src="http://www.bugfree.dk/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.bugfree.dk/blog/2010/04/15/configuring-emacs-through-emacs-lisp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting organized with Emacs Org-mode</title>
		<link>http://www.bugfree.dk/blog/2009/11/05/getting-organized-with-emacs-org-mode/</link>
		<comments>http://www.bugfree.dk/blog/2009/11/05/getting-organized-with-emacs-org-mode/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 21:42:02 +0000</pubDate>
		<dc:creator>Ronnie Holm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Logging]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Tool]]></category>

		<guid isPermaLink="false">http://www.bugfree.dk/blog/?p=694</guid>
		<description><![CDATA[It&#8217;s been four months and 350 clocked work-hours since I started using Org-mode for Emacs. I use Org-mode, mixed with some of the Pomodoro principles, to maintain my task lists at work and home. In a nutshell Org-mode is a plug-in for Emacs that makes taking notes, maintaining lists, clocking time, and many other tasks [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been four months and 350 clocked work-hours since I started using <a href="http://orgmode.org">Org-mode</a> for <a href="http://www.gnu.org/software/emacs/">Emacs</a>. I use Org-mode, mixed with some of the <a href="http://www.pomodorotechnique.com">Pomodoro principles</a>, to maintain my task lists at work and home.</p>
<p>In a nutshell Org-mode is a plug-in for Emacs that makes taking notes, maintaining lists, clocking time, and many other tasks more straightforward. The mode works by adding features on top of Emacs for editing plain text files. Features that enrich the interaction with the underlying text buffer by parsing and adding (meta-)information to it.</p>
<p>With Org-mode you group items into a hierarchical structure. A path to the item to work on is then formed by unfolding items in a way analogous to how you navigate the file system with Explorer.</p>
<p><img alt="" src="http://www.bugfree.dk/blog/wp-content/uploads/2009/11/Org-mode-example1.png" /></p>
<p>To efficiently work with items, Org-mode supports moving items around the hierarchy. Items may also be tagged (buy, work, phone, etc.) or associated with a state (done, waiting, started, etc.). Additional meta-information may include a deadline, an estimate, or time spent working on a task. The clocking of time is accomplished by Org-mode adding a timestamp to the item. On completion, another timestamp and the elapsed time is calculated and added.</p>
<p>Below is an example of an expanded and a collapsed item containing clocked times and estimates.</p>
<p><img alt="" src="http://www.bugfree.dk/blog/wp-content/uploads/2009/11/Org-mode-example2.png" /></p>
<p>With a few keystrokes, Org-mode is able to correlate estimates with time spent on an item-by-item basis. This truly short-circuits the estimation feedback cycle. Imagine doing this on a file containing a large hierarchy of items and the transparency it brings.</p>
<p><img alt="" src="http://www.bugfree.dk/blog/wp-content/uploads/2009/11/Org-mode-example3.png" /></p>
<p>If you want to keep track of billable hours, it may make sense to clock all your time using Org-mode and generate timesheets from the clocking information. Especially since the billing context is automatically provided by the item storing the timestamp, and since you&#8217;re free to organize the file in any way you see fit. Few other tools manage to compete with the flexibility of a plain text buffer.</p>
<p>This post only scratches the surface of Org-mode. To get a sense of the possibilities, the <a href="http://orgmode.org/org.pdf">manual</a> amounts to 184 pages. However, for a quick introduction I encourage you to watch the <a href="http://orgmode.org/GoogleTech.html">Google Tech Talk on Org-mode</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.bugfree.dk%2Fblog%2F2009%2F11%2F05%2Fgetting-organized-with-emacs-org-mode%2F&amp;title=Getting%20organized%20with%20Emacs%20Org-mode" id="wpa2a_4"><img src="http://www.bugfree.dk/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.bugfree.dk/blog/2009/11/05/getting-organized-with-emacs-org-mode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

