<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>shellarchive</title>
    <link>http://www.shellarchive.co.uk/index.html</link>
    <description>Stuff and stuff.</description>
    <language>en-us</language>
    <generator>Emacs Muse</generator>

<item>
<title> ETest</title>
<link>http://www.shellarchive.co.uk/index.html#%20ETest</link>
<description><![CDATA[
<p>I think ETest is ready for real world. From the header of etest.el:</p>

<pre class="src">
etest lets you define tests in a domain specific, hierarchical
manner and gather results in a simple, structure of the same shape.
</pre>

<ul>
<li>Read the manual <a href="content/etest.html">here</a>.</li>
<li>Get it like this: <code>git clone http://repo.or.cz/r/ETest.git etest</code></li>
<li>Comment on ETest at the <a href="http://www.emacswiki.org/cgi-bin/wiki/ETest">wiki</a>.</li>
</ul>

]]></description>
<author>Phil Jackson</author>
<pubDate>Sat, 09 Aug 2008 17:03:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20ETest</guid>

</item>

<item>
<title> stumpwm: Control emms</title>
<link>http://www.shellarchive.co.uk/index.html#%20stumpwm%3A%20Control%20emms</link>
<description><![CDATA[
<p>Control emms from the <code>root-map</code> by putting the following into your stumpwmrc:</p>

<pre class="src">
(<span style="color: #00afff;">defvar</span> <span style="color: #87af87;">*my-emms-bindings*</span>
  '((<span style="color: #ffaf00;">"n"</span> <span style="color: #ffaf00;">"emms-next"</span>)
    (<span style="color: #ffaf00;">"p"</span> <span style="color: #ffaf00;">"emms-previous"</span>)
    (<span style="color: #ffaf00;">"s"</span> <span style="color: #ffaf00;">"emms-stop"</span>)
    (<span style="color: #ffaf00;">"P"</span> <span style="color: #ffaf00;">"emms-pause"</span>)))

(stumpwm:define-key stumpwm:*root-map* (stumpwm:kbd <span style="color: #ffaf00;">"m"</span>)
  (<span style="color: #00afff;">let</span> ((m (stumpwm:make-sparse-keymap)))
    (map nil #'(<span style="color: #00afff;">lambda</span> (x)
                 (stumpwm:define-key m (stumpwm:kbd (car x))
                   (concat <span style="color: #ffaf00;">"exec emacsclient -e '("</span> (cadr x) <span style="color: #ffaf00;">")'"</span>)))
         *my-emms-bindings*)
    m))
</pre>

<p>Which (by default) gives you:</p>

<ul>
<li><code>C-a m n</code> - next</li>
<li><code>C-a m p</code> - previous</li>
<li><code>C-a m s</code> - stop</li>
<li><code>C-a m P</code> - pause</li>
</ul>

]]></description>
<author>Phil Jackson</author>
<pubDate>Sat, 19 Jul 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20stumpwm%3A%20Control%20emms</guid>

</item>

<item>
<title> Org mode in Google</title>
<link>http://www.shellarchive.co.uk/index.html#%20Org%20mode%20in%20Google</link>
<description><![CDATA[
<p>Carsten Dominik was invited
<a href="http://www.youtube.com/watch?v=oJTwQvgfgMM">to Google to chat about his org-mode package</a>. It's very interesting,
especially to watch Carsten speak as he's emblematic of excellent OSS
project management.</p>

<p>Anyway, the video makes for a good tutorial should you be looking to
get into org.</p>

]]></description>
<author>Phil Jackson</author>
<pubDate>Thu, 17 Jul 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20Org%20mode%20in%20Google</guid>

</item>

<item>
<title> Prettify emms</title>
<link>http://www.shellarchive.co.uk/index.html#%20Prettify%20emms</link>
<description><![CDATA[
<p><a class="image-link" href="images/pretty-emms.png">
<img src="images/thumb-pretty-emms.png"></a></p>

<p><a href="http://www.gnu.org/software/emms/">emms</a> is the emacs multimedia system and in true emacs fashion its very
configurable and very powerful.</p>

<p>This <a href="images/pretty-emms.png">screenshot</a> shows what mine looks like at the moment. Here is the
portion of the code that should get you started with customising the
look and feel.</p>

<p>The columns (in the playlist) are play count, title, artist, last play
time and album. The buffer could do with a header line I suppose.</p>

<p><em>Warning: I don't know if setting <code>emms-track-description-function</code> is
the right thing to do as it's not just the playlist that uses it. If I
find it isn't I'll follow up.</em></p>

<pre class="src">
  (setq emms-browser-info-genre-format <span style="color: #ffaf00;">"%i&#9679; %n"</span>
        emms-browser-info-artist-format <span style="color: #ffaf00;">"%i&#9679; %n"</span>
        emms-browser-info-album-format <span style="color: #ffaf00;">"%i&#9678; %n"</span>
        emms-browser-info-title-format <span style="color: #ffaf00;">"%i&#9834; %n"</span>)

  (setq emms-last-played-format-alist
        '(((emms-last-played-seconds-today) . <span style="color: #ffaf00;">"Today at %H:%M"</span>)
          (604800                           . <span style="color: #ffaf00;">"%a at %H:%M"</span>)
          ((emms-last-played-seconds-month) . <span style="color: #ffaf00;">"%d"</span>)
          ((emms-last-played-seconds-year)  . <span style="color: #ffaf00;">"%m-%d"</span>)
          (t                                . <span style="color: #ffaf00;">""</span>)))

  (<span style="color: #00afff;">defun</span> <span style="color: #87d75f;">prettyfy-string</span> (string <span style="color: #00cd00;">&amp;optional</span> after)
    <span style="color: #ffaf00;">"Strip starting and ending whitespace and replace any chars
after AFTER with '...'"</span>
    (<span style="color: #00afff;">let</span> ((replace-map (list
                        (cons <span style="color: #ffaf00;">"^[ \t]*"</span> <span style="color: #ffaf00;">""</span>)
                        (cons <span style="color: #ffaf00;">"[ \t]*$"</span> <span style="color: #ffaf00;">""</span>)
                        (cons (concat <span style="color: #ffaf00;">"^</span><span style="color: #ffaf00; background-color: #3a3a3a;">\\</span><span style="color: #ffaf00; background-color: #3a3a3a;">(</span><span style="color: #ffaf00;">.\\{"</span>
                                      (or (number-to-string after) <span style="color: #ffaf00;">"10"</span>)
                                      <span style="color: #ffaf00;">"\\}</span><span style="color: #ffaf00; background-color: #3a3a3a;">\\</span><span style="color: #ffaf00; background-color: #3a3a3a;">)</span><span style="color: #ffaf00;">.*"</span>)
                              <span style="color: #ffaf00;">"\\1&#8230;"</span>))))
      (<span style="color: #00afff;">dolist</span> (replace replace-map)
        (<span style="color: #00afff;">when</span> (string-match (car replace) string)
          (setq string (replace-match (cdr replace) nil nil string))))
      string))

  (<span style="color: #00afff;">defun</span> <span style="color: #87d75f;">phil/emms-info-track-description</span> (track)
    <span style="color: #ffaf00;">"Return a description of the current track."</span>
    (<span style="color: #00afff;">let</span> ((artist (emms-track-get track 'info-artist))
          (title (emms-track-get track 'info-title))
          (album (emms-track-get track 'info-album))
          (last-played (or (emms-track-get track 'last-played) '(0 0 0)))
          (play-count (or (emms-track-get track 'play-count) 0)))
      (format <span style="color: #ffaf00;">"%3d &#9474; %-20s %-17s &#9474; %-14s &#9474; %-30s"</span>
              play-count
              (prettyfy-string title 19)
              (prettyfy-string artist 16)
              (emms-last-played-format-date last-played)
              (prettyfy-string album 29))))

  (setq emms-track-description-function
        'phil/emms-info-track-description))
</pre>

]]></description>
<author>Phil Jackson</author>
<pubDate>Fri, 04 Jul 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20Prettify%20emms</guid>

</item>

<item>
<title> Webkit in emacs</title>
<link>http://www.shellarchive.co.uk/index.html#%20Webkit%20in%20emacs</link>
<description><![CDATA[
<p>An emacs hacker called Joakim Verona has built preliminary support for
the embedding of GTK widgets into a buffer (of a GTK linked emacsen)
which <a href="http://lists.gnu.org/archive/html/emacs-devel/2008-06/msg01684.html">opens up the possibility of embedding webkit</a> into emacs. This
sounds very cool, especially what with Webkit gaining popularity so
quickly. Web-browsing is just about the only (important) thing left
that emacs can't <em>really</em> do.</p>

]]></description>
<author>Phil Jackson</author>
<pubDate>Tue, 24 Jun 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20Webkit%20in%20emacs</guid>

</item>

<item>
<title> Merge directory contents (with links)</title>
<link>http://www.shellarchive.co.uk/index.html#%20Merge%20directory%20contents%20</link>
<description><![CDATA[
<p>I wrote this as part of my dotfiles installation procedure. If you
have directories 1, 2 and 3 all with files you want to link into
<code>${HOME}</code> then running:</p>

<pre class="src">
link-files 1 <span style="color: #ffaf00;">"${HOME}"</span> <span style="color: #ffaf00;">\</span>
    &amp;&amp; link-files 2 <span style="color: #ffaf00;">"${HOME}"</span> <span style="color: #ffaf00;">\</span>
    &amp;&amp; link-files 3 <span style="color: #ffaf00;">"${HOME}"</span>
</pre>

<p>Will do the trick, assuming this is defined:</p>

<pre class="src">
<span style="color: #00afff;">function</span> <span style="color: #87d75f;">link-files</span> {
    <span style="color: #87af87;">from</span>=<span style="color: #ffaf00;">"${1}"</span>; <span style="color: #87af87;">to</span>=<span style="color: #ffaf00;">"${2}"</span>

    <span style="color: #d75f5f;"># </span><span style="color: #d75f5f;">first we need the same directory structure
</span>    ( <span style="color: #afd7d7;">cd</span> <span style="color: #ffaf00;">"${from}"</span> &amp;&amp; find . <span style="color: #ffaf00;">\(</span> <span style="color: #ffaf00;">\(</span> -name <span style="color: #ffaf00;">"..?"</span> -or -name <span style="color: #ffaf00;">\*</span>.elc <span style="color: #ffaf00;">\)</span> <span style="color: #ffaf00;">\</span>
        -prune -or -true <span style="color: #ffaf00;">\)</span> -type d -exec mkdir -p <span style="color: #ffaf00;">"${to}/"\{\}</span> <span style="color: #ffaf00;">\;</span> )

    <span style="color: #d75f5f;"># </span><span style="color: #d75f5f;">now link the files to "to"
</span>    ( <span style="color: #afd7d7;">cd</span> <span style="color: #ffaf00;">"${from}"</span> &amp;&amp; find . -type f -exec ln -fs <span style="color: #ffaf00;">\</span>
        <span style="color: #ffaf00;">"${from}/"\{\}</span> <span style="color: #ffaf00;">"${to}/"\{\}</span> <span style="color: #ffaf00;">\;</span> )
}
</pre>

]]></description>
<author>Phil Jackson</author>
<pubDate>Sat, 31 May 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20Merge%20directory%20contents%20</guid>

</item>

<item>
<title> Find file in project for project-root.el</title>
<link>http://www.shellarchive.co.uk/index.html#%20Find%20file%20in%20project%20for%20project%2Droot%2Eel</link>
<description><![CDATA[
<p>Today a chap I know begged me to add project specific find-file
support to <a href="content/lisp/project-root.el">project-root.el</a>, so, once I realised what he was talking
about (he's from foreign and so talks all funny like) I added
<code>project-root-find-file</code>. All you need to do to use it is set
<code>project-root-default-find-command</code> to the find command you want to use
and then when you <code>M-x project-root-find-file</code> you will get a list of
all files matched by the find, all wrapped up in <a href="http://www.emacswiki.org/cgi-bin/wiki/InteractivelyDoThings">ido</a> goodness. The
files in the list appear relative to the current project's root
directory.</p>

<p>To be honest, I thought it would be too slow but tested it on a few
medium sized projects and it actually performs OK.</p>

]]></description>
<author>Phil Jackson</author>
<pubDate>Tue, 20 May 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20Find%20file%20in%20project%20for%20project%2Droot%2Eel</guid>

</item>

<item>
<title> Add filenames to log-edit</title>
<link>http://www.shellarchive.co.uk/index.html#%20Add%20filenames%20to%20log%2Dedit</link>
<description><![CDATA[
<p>I bind this to <code>C-c C-f</code> in <code>log-edit-mode</code>. It will insert the list of
edited files with a colon after the filename. One of those small,
simple macros that I use all of the time, and thought I might share.</p>

<pre class="src">
(<span style="color: #00afff;">defun</span> <span style="color: #87d75f;">insert-edited-files</span> ()
  (interactive)
  (<span style="color: #00afff;">let</span> ((pos (point)))
    (insert (mapconcat
             (<span style="color: #00afff;">lambda</span> (x)
               (concat (file-name-nondirectory x) <span style="color: #ffaf00;">": "</span>))
             (log-edit-files) <span style="color: #ffaf00;">"\n"</span>))
    (align-regexp pos (point) <span style="color: #ffaf00;">": "</span> 0 2)))
</pre>

]]></description>
<author>Phil Jackson</author>
<pubDate>Wed, 14 May 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20Add%20filenames%20to%20log%2Dedit</guid>

</item>

<item>
<title> Project Root</title>
<link>http://www.shellarchive.co.uk/index.html#%20Project%20Root</link>
<description><![CDATA[
<p>I realise there is already many an effort to implement 'projects' in
emacs but I've decided to <a href="content/lisp/project-root.el">have a stab at it myself</a>. What I've ended up
with is a really simple module that is configurable purely via elisp
(meaning no files needed in the root of your project). So, buried in
my startup, I have this:</p>

<pre class="src">
(with-library 'project-root
  (setq project-roots
        '((<span style="color: #ffaf00;">"Generic Perl Project"</span>
           <span style="color: #afd7d7;">:root-contains-files</span> (<span style="color: #ffaf00;">"t"</span> <span style="color: #ffaf00;">"lib"</span>)
           <span style="color: #afd7d7;">:on-hit</span> (<span style="color: #00afff;">lambda</span> (p)
                     (project-root-setup-ack p)))))
  (add-hook 'cperl-mode-hook 'project-root-fetch)
  (add-hook 'dired-mode-hook 'project-root-fetch)
  (define-key dired-mode-map (kbd <span style="color: #ffaf00;">"r"</span>) 'project-root-goto-root))
</pre>

<p><code>with-library</code> looks like this by the way:</p>

<pre class="src">
(<span style="color: #00afff;">defmacro</span> <span style="color: #87d75f;">with-library</span> (symbol <span style="color: #00cd00;">&amp;rest</span> body)
  `(<span style="color: #00afff;">when</span> (<span style="color: #00afff;">require</span> ,symbol nil t)
     ,@body))
</pre>

<p>At the moment I only use this for anything resembling Perl projects,
this being determined by the <code>:root-contains-files</code> property. You can
also use <code>:path-matches</code> to pull out a path where the first match group
is the root:</p>

<pre class="src">
<span style="color: #ffaf00;">"</span><span style="color: #ffaf00; background-color: #3a3a3a;">\\</span><span style="color: #ffaf00; background-color: #3a3a3a;">(</span><span style="color: #ffaf00;">/home/someone/work/projects/blah</span><span style="color: #ffaf00; background-color: #3a3a3a;">\\</span><span style="color: #ffaf00; background-color: #3a3a3a;">)</span><span style="color: #ffaf00;">"</span>
</pre>

<p>The function given to <code>:on-hit</code> will execute when a match for the root
is found, so in my case I setup <a href="content/lisp/ack.el">ack</a> to <code>cd</code> to the root of the project
first.</p>

<p>I'd love to get some feedback on how use(ful|less) this is to people,
even in its early state.</p>

]]></description>
<author>Phil Jackson</author>
<pubDate>Thu, 08 May 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20Project%20Root</guid>

</item>

<item>
<title> Keeping your configuration in check</title>
<link>http://www.shellarchive.co.uk/index.html#%20Keeping%20your%20configuration%20in%20check</link>
<description><![CDATA[
<p>I used to pile stuff into my <code>.emacs</code> which whilst convenient for moving
between sites was a nightmare to maintain. What I use now is an init
style system which is kicked of with this in my <code>.emacs</code>:</p>

<pre class="src">
(<span style="color: #00afff;">defun</span> <span style="color: #87d75f;">load-dir</span> (dir)
  (mapc 'load
        (mapcar (<span style="color: #00afff;">lambda</span> (file)
                  (<span style="color: #00afff;">if</span> (file-exists-p (concat file <span style="color: #ffaf00;">"c"</span>)) (concat file <span style="color: #ffaf00;">"c"</span>) file))
                (directory-files dir t <span style="color: #ffaf00;">"\\.el$"</span>))))
</pre>

<p>Which will load all of the files in <code>dir</code> favouring compiled lisp. Each
of the files is named to reflect its function. Here is my <code>lisp.d</code>:</p>

<pre class="src">
001-definitions.el      030-org-mode.el
002-init-load-path.el   030-sql.el
010-initial-buffers.el  040-lang-lisp.el
030-dvc.el              040-lang-perl.el
030-erc.el              060-third-party-lisp.el
030-eshell.el           070-defaults.el
030-ibuffer.el          080-environment.el
030-muse.el
</pre>

]]></description>
<author>Phil Jackson</author>
<pubDate>Sun, 13 Apr 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20Keeping%20your%20configuration%20in%20check</guid>

</item>

<item>
<title> Gnus at work</title>
<link>http://www.shellarchive.co.uk/index.html#%20Gnus%20at%20work</link>
<description><![CDATA[
<p>For the first time conditions have been met that allow me to use <a href="http://gnus.org/">Gnus</a>
at work. It's great not to have to use Outlook, or even worse Notes. I
wonder if the whole gnus/<a href="http://bbdb.sourceforge.net/">bbdb</a>/<a href="http://orgmode.org">org</a> system will make me more organised
in that area?</p>

]]></description>
<author>Phil Jackson</author>
<pubDate>Tue, 08 Apr 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20Gnus%20at%20work</guid>

</item>

<item>
<title> How that tab bar works</title>
<link>http://www.shellarchive.co.uk/index.html#%20How%20that%20tab%20bar%20works</link>
<description><![CDATA[
<p>Two (the grand total of my readership?) people have asked how I make
the tabs above this content stay active depending on the content
(considering I use <a href="http://mwolson.org/projects/EmacsMuse.html">Muse Mode</a>). I would love to say it was a
masterpiece of code and ingenuity but I'm afraid it's just a simple
hack.</p>

<p>Within the <code>header.muse</code> file which all pages use as their header is
this snippet (in <code>&lt;lisp&gt;</code> brackets of course):</p>

<pre class="src">
(mapconcat
 (<span style="color: #00afff;">lambda</span> (x)
   (concat <span style="color: #ffaf00;">"&lt;li"</span>
           (<span style="color: #00afff;">when</span> (string= (muse-publishing-directive <span style="color: #ffaf00;">"menu-name"</span>) (car x))
             <span style="color: #ffaf00;">" id=\"current\""</span>)
           <span style="color: #ffaf00;">"&gt;&lt;a href=\""</span> (cdr x) <span style="color: #ffaf00;">"\"&gt;&lt;span&gt;"</span>
           (car x) <span style="color: #ffaf00;">"&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;"</span>))
 muse/web-menu-alist <span style="color: #ffaf00;">"\n"</span>)
</pre>

<p>This depends on setting a directive in each page called <code>menu-name</code>. As
the code loops through the items in <code>muse/web-menu-alist</code> it will print
out the link, if the <code>(car)</code> of the alist matches <code>menu-name</code> it will be
given the &quot;current&quot; css property. This is what makes the current tab
appear highlighted.</p>

<p>This is what <code>muse/web-menu-alist</code> looks like:</p>

<pre class="src">
(setq muse/web-menu-alist
      '((<span style="color: #ffaf00;">"home"</span> . <span style="color: #ffaf00;">"/index.html"</span>)
        (<span style="color: #ffaf00;">"shell"</span> . <span style="color: #ffaf00;">"/content/shell.html"</span>)
        (<span style="color: #ffaf00;">"emacs"</span> . <span style="color: #ffaf00;">"/content/emacs.html"</span>)
        (<span style="color: #ffaf00;">"contact"</span> . <span style="color: #ffaf00;">"mailto:web@shellarchive.co.uk"</span>)))
</pre>

<p>It's really that simple I'm afraid.</p>

]]></description>
<author>Phil Jackson</author>
<pubDate>Sat, 05 Apr 2008 00:00:00 BST</pubDate>
<guid>http://www.shellarchive.co.uk/index.html#%20How%20that%20tab%20bar%20works</guid>

</item>

  </channel>
</rss>
