<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>dialectical futurism, emacs</title>
 <link href="http://tychoish.com/feed/emacs.xml" rel="self"/>
 <link href="http://tychoish.com/"/>
 <updated>2010-09-01T13:21:32-04:00</updated>
 <id>http://tychoish.com</id>
 <author>
   <name>tycho garen</name>
   <email>garen@tychoish.com</email>
 </author>

 
































































































































<entry>
  <title>Decreasing Emacs Start Times</title>
  <link href="http://www.tychoish.com/2010/02/decreasing-emacs-start-times"/>
  <updated>2010-02-02T00:00:00-05:00</updated>
  <id>http://www.tychoish.com/2010/02/decreasing-emacs-start-times</id>
  <content type="html">&lt;p&gt;One oft made complaint about emacs is that it takes &lt;em&gt;forever&lt;/em&gt; to start up, particularly if you&amp;#8217;ve got a lot of packages to load it can take a few seconds for everything to start up. In a lot of respects this is an old problem, that isn&amp;#8217;t as relevant given contemporary hardware. Between improvements to emacs, and the fact that computers these days are &lt;em&gt;incredibly powerful&lt;/em&gt;, it&amp;#8217;s just not a major issue.&lt;/p&gt;

&lt;p&gt;Having said that, until recently an emacs instance took as much as 7 seconds to start up. I&amp;#8217;ve beaten it down to under two seconds, and using &lt;code&gt;emacsclient&lt;/code&gt; and starting emacs with &amp;#8221;&lt;code&gt;emacs --daemon&lt;/code&gt;&amp;#8221; makes the start up time much more manageable.&lt;/p&gt;

&lt;h2 id='step_one_manage_your_display_yourself'&gt;Step One: Manage your Display Yourself&lt;/h2&gt;

&lt;p&gt;I&amp;#8217;ve written about this before, but really even a 2 second start time feels absurd, if I had to start a new emacs session each time I needed to look into a file. &amp;#8221;&lt;code&gt;emacs --daemon&lt;/code&gt;&amp;#8221; and &lt;code&gt;emacsclient&lt;/code&gt; mean that each time you &amp;#8220;run&amp;#8221; emacs rather than start a new emacs instance, it just opens a new frame on the existing instance. Quicker start up times. It means you can open a bunch of buffers in one frame, settle into work on one file, and then open a second buffer and edit one of the previous files you opened. Good stuff. The quirk is that if you&amp;#8217;ve set up your emacs files to load the configuration for your window displays late in game, the windows won&amp;#8217;t look right. I have a file in my emacs files called &lt;code&gt;gui-init.el&lt;/code&gt;, and it looks sort of like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  (provide &amp;#39;gui-init)

  (defun tychoish-font-small ()
    (interactive)
    (setq default-frame-alist &amp;#39;((font-backend . &amp;quot;xft&amp;quot;)(font . &amp;quot;Inconsolata-08&amp;quot;) 
          (vertical-scroll-bars . 0) (menu-bar-lines . 0) (tool-bar-lines . 0)
          (left-fringe . 1) (right-fringe . 1)
          (alpha 86 84)))
    (tool-bar-mode -1)
    (scroll-bar-mode -1)
  )

  (if (string-match &amp;quot;laptop&amp;quot; system-name)
      (tychoish-font-big))&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Modifying, of course, the system name, and the settings to match your tastes and circumstances. The &lt;code&gt;(if)&lt;/code&gt; statement allows you to have a couple of these &lt;code&gt;-font-&lt;/code&gt; functions defined and then toggle between them based on which machine you load emacs on. Then in your init file (e.g. &lt;code&gt;.emacs&lt;/code&gt;), make sure the first two lines are:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  (setq load-path (cons &amp;quot;~/confs/emacs&amp;quot; load-path)) 
  (require &amp;#39;gui-init)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Establish the load path first so that emacs knows where to look for your required files, and then use the &lt;code&gt;(require)&lt;/code&gt; sexep to load in the file. Bingo.&lt;/p&gt;

&lt;h2 id='package_things_yourself'&gt;Package Things Yourself&lt;/h2&gt;

&lt;p&gt;We saw this above, but as much as possible avoid using the &lt;code&gt;load&lt;/code&gt; function. When you use &lt;code&gt;load&lt;/code&gt; emacs has to (I&amp;#8217;m pretty sure) do a fairly expensive file system operation and then load the file and then compile and load the file. This takes time. Using the &lt;code&gt;require&lt;/code&gt; function is not without it&amp;#8217;s own cost, but it does save some time compared to &lt;code&gt;load&lt;/code&gt; because it lets you take advantage of the work emacs does with the library loading. At least in my experience.&lt;/p&gt;

&lt;p&gt;In your various &lt;code&gt;.el&lt;/code&gt; files, insert the following statement:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  (provide &amp;#39;package)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And then in your .emacs, use the following statement&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  (require &amp;#39;package)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To load it in. You&amp;#8217;re probably already familiar with using these to configure packages that you download. Better yet, don&amp;#8217;t require at all, but use the &lt;code&gt;auto-load&lt;/code&gt; function. This just creates a little arrow inside of emacs that says &amp;#8220;when this function is called, load this file, and hopefully the &amp;#8216;real&amp;#8217; function by this name will be in there.&amp;#8221; This lets you avoid loading packages that you don&amp;#8217;t use frequently until you actually need them. The following example provides an auto-load for the identica-mode:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;   (autoload &amp;#39;identica-mode &amp;quot;identica-mode.el&amp;quot; &amp;quot;Mode for Updating Identi.ca Microblog&amp;quot; t)&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id='byte_compile_files_as_much_as_you_can'&gt;Byte Compile files as much as you can.&lt;/h2&gt;

&lt;p&gt;Contrary to whatever you&amp;#8217;ve been told, emacs isn&amp;#8217;t a text editor, as much as it is a virtual machine with a good deal of low level functions established for interacting with text and textual environments &lt;em&gt;and&lt;/em&gt; some editing-based interfaces. But really at the core, it&amp;#8217;s just virtual machine that interprets a quirky Lisp dialect.&lt;/p&gt;

&lt;p&gt;The execution model is pretty simple and straightforward, particularly to people who are used to Java and Python: you load source files, emacs imports them and compiles them half way, they&amp;#8217;re not the kind of thing that you could read on your own or would want to write, but it&amp;#8217;s not quite machine code either. Byte-compiled files are easier for the machine to read, and quicker to process, but they&amp;#8217;re not human intelligible. Then when you need to do something with the function that it&amp;#8217;s byte-compiled, emacs compiles it the rest of the way into machine code and executes it. Usually this all happens too fast that we don&amp;#8217;t really notice it.&lt;/p&gt;

&lt;p&gt;One tried and true means of speeding up emacs load times is to byte-compile files manually so that emacs doesn&amp;#8217;t have to do it itself when it loads. The emacs-lisp libraries are byte compiled when emacs installs itself, but &lt;em&gt;your&lt;/em&gt; files probably aren&amp;#8217;t. Now generally, only byte-compile files that you&amp;#8217;re not going to be editing yourself regularly. Byte compiled files have an &lt;code&gt;.elc&lt;/code&gt; extension, and as soon as there&amp;#8217;s a &lt;code&gt;.el&lt;/code&gt; file and a &lt;code&gt;.elc&lt;/code&gt; of the same name in a directory, emacs will ignore the &lt;code&gt;.el&lt;/code&gt; file even if there have been changes made. To byte compile an emacs-lisp file, simply type &lt;code&gt;M-x&lt;/code&gt; to get the &lt;code&gt;execute-extended-command&lt;/code&gt; prompt, and then run the function &lt;code&gt;byte-compile&lt;/code&gt; (i.e. &amp;#8221;&lt;code&gt;M-x byte-compile&lt;/code&gt;&amp;#8221;). Viola!&lt;/p&gt;

&lt;p&gt;I hope these all help you all and lead to a slightly more efficient emacs experience.&lt;/p&gt;</content>
</entry>















<entry>
  <title>Beyond Lists in Org Mode</title>
  <link href="http://www.tychoish.com/2010/01/beyond-lists-in-org-mode"/>
  <updated>2010-01-19T00:00:00-05:00</updated>
  <id>http://www.tychoish.com/2010/01/beyond-lists-in-org-mode</id>
  <content type="html">&lt;p&gt;I&amp;#8217;ve written about this problem in &lt;a href='http://orgmode.org'&gt;org-mode&lt;/a&gt;, the &lt;a href='http://www.gnu.org/software/emacs/emacs.html'&gt;emacs&lt;/a&gt; outlining and organization tool that I us, before, but I&amp;#8217;m readdressing it for my benefit as well as yours.&lt;/p&gt;

&lt;p&gt;Org mode is an outlining tool, fundamentally. It provides a nice interface for editing and manipulating information arranged in an outline format. Additionally, and this is the part that everyone is drawn to, it makes it &lt;em&gt;very&lt;/em&gt; easy to mark and treat arbitrary items in the outline as &amp;#8220;actionable,&amp;#8221; or todo items in need of done. The brilliance of org-mode, I think, is the fact that you spend all your time working on building useful outlines and then it has a tool which takes all this information and compiles it into a useful todo list. How awesome is that. For more information on org-mode, including good demonstrations, check out this &lt;a href='http://www.youtube.com/watch?v=oJTwQvgfgMM'&gt;video&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The problem is a common and recurring one for me. I basically live in the agenda mode&amp;#8211;that compiled list of todo items&amp;#8211;and I don&amp;#8217;t so much use org-mode for making outlines. Truth is, I have a &amp;#8220;Tasks&amp;#8221; heading in most org files, and I use the automatic capture option (e.g. org-remember) to stuff little notes into the files, and beyond that, I mostly don&amp;#8217;t interact with the outlines themselves.&lt;/p&gt;

&lt;p&gt;This isn&amp;#8217;t a bad thing, I suppose, but it means that org-mode can&amp;#8217;t really help you, and you&amp;#8217;ve short-circuted the ability of org-mode to improve the organization. Under ideal circumstances, org allows you to embed and extract todo lists from the recorded record of your thought process. If you&amp;#8217;re not actively maintaining your thoughts in your org-mode files, it&amp;#8217;s just another todo list. That isn&amp;#8217;t without merit, but it doesn&amp;#8217;t allow the creation of tasks and the flow of a project to spring organically from your thoughts about the project, which is the strength of org mode.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Intermission:&lt;/strong&gt; I took a break from writing this post to go and reorganize my org files. What follows are a list of &amp;#8220;things I&amp;#8217;ve been doing wrong&amp;#8221; and &amp;#8220;things I hope to improve.&amp;#8221;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;I don&amp;#8217;t think I had enough org-files. There are lots of approaches to organizing information in org: one giant file, lots of small files for individual projects, a few mid to large files for each &amp;#8220;sphere&amp;#8221; of your life.&lt;/p&gt;

&lt;p&gt;Initially I took the &amp;#8220;medium sized files for major ongoing projects.&amp;#8221; I had a writing file, and a work file, and a writing file, and files for the fiction projects that I&amp;#8217;m working on, and a notes file, and a clippings file, and so forth. Say about 8-10 files. It works, but I think the thing it did was it caused me to use the org-remember functions to just dump things in a &amp;#8220;tasks&amp;#8221; heading, and then work from the agenda buffer, and not ever really have to touch the files themselves. &lt;em&gt;Org files need to be specific enough that you would want to keep them open in another window while you&amp;#8217;re working on a project.&lt;/em&gt; I think the point where you know you&amp;#8217;ve gone too far is when the first level headings start to replicate organization that might better be handled by the file-system.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Use the scheduling and deadline functions to filter the todo list into something that is workable. It&amp;#8217;s easy to just look at the task list and say &amp;#8220;oh no, I don&amp;#8217;t want to work on this task right now because it depends on too many things that aren&amp;#8217;t done, and there are other things that I could work on.&amp;#8221; Scheduling an item, if not setting a deadline, forces me (at least) to think practically about the scope of a given project, what kind of time I&amp;#8217;ll have to work on it, and what other tasks depend upon it.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;When you&amp;#8217;re using org to manage huge blocks of text&amp;#8211;or any system, really&amp;#8211;it can be difficult if you have multiple hierarchies and depths of greater than two or three. It just gets hard to manage and keep track of things and figure out where things are, particularly given how useful and prevalent search tools are.&lt;/p&gt;

&lt;p&gt;Having said that, When you&amp;#8217;re organizing tasks in org, that limitation, one that I find myself imposing upon myself doesn&amp;#8217;t really work terribly well, and leads to files that might actually be more difficult to read and to work out of.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;I started using the &amp;#8220;org-archive-subree&amp;#8221; function for archiving content when I was through with parts of the outline, This sends the archive to a separate file and while it works, I find it&amp;#8230; less than useful. I&amp;#8217;ve since discovered &amp;#8220;org-archive-to-archive-sibling&amp;#8221; which is a great deal of awesome, and I recommend using it exclusively.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Write content in org mode when possible. Though some people (hi Matt!) are keen on using org as a publication system, I&amp;#8217;m not sure if this is the right answer, but I do think that its good during very creative phases of projects to do the work in org, mostly as I think it facilitates focusing on the current problem (through collapsing of the tree to show you just what you&amp;#8217;re working on,) and also for working non-linearly as you can leave yourself TODO items for later action.&lt;/p&gt;

&lt;p&gt;At the same time, if you tend to maintain org files that contain planning for more than one project, I find it cumbersome to also draft in these files. So I think &amp;#8220;keep smaller very focused org files, and maybe do drafting in them if appropriate.&amp;#8221;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That&amp;#8217;s a start at least. I&amp;#8217;ve made these changes&amp;#8211;which are really quite subtle&amp;#8211;and I like the way it feels, but we&amp;#8217;ll have to see how things shake down in a few weeks. As much as I want to avoid tinkering with things&amp;#8211;because tinkering isn&amp;#8217;t the same as getting things done&amp;#8211;I really do find it helpful to review processes from time to time and make sure that I&amp;#8217;m really working as effectively as I can.&lt;/p&gt;</content>
</entry>
































































 
</feed>
