Friday, February 27, 2009

CSS and standards

Sometimes I want to launch my keyboard through the screen. I knew it was a mistake to listen to latest fads. It now seems my attempts at using "standards compliant" CSS was a waste of time and effort. Why? Because bloody IE 5, 5.5 and 6 do not show up my (basic) low bandwidth html export from org-mode. And not so much as a hint as to why not. Gah. OK, standards move, and old SW does not, but still. I hate coding with target viewer switches : it's error prone, dirty and duplication of effort. Mind you, while I redit this post I see that blogger doesn't work with ie 5.5 either. Ha.

Wednesday, February 18, 2009


I just came across this wonderful article about using Cedet.

Well worth reading for those looking for code completion in C and C++ yet are somewhat confused by CEDET documentation.

Tuesday, February 10, 2009

Splitting mail with BBDB and Gnus

I'm currently taking a lookt at splitting email using gnus. It would be a client side replacement for procmail. The advantage being ALL email downloaded at the server would be ing a single IMAP onbox so its's easier to see ALL from more limited clients, and that the splitting into seperate folders is more easily controlled using regexps on the Gnus client side. Anyway, more to come soon as I just got it working - here's the bookmark page:

And, woohoo, I just got it working so that emails from BBDB entries tagged with gnus-private get stored in special folders as specified by that BBDB field. And all with IMAP. Wonderful stuff once more.

Thursday, February 5, 2009

Speeding up your Emacs - autoloads

Following a bit of re-structuring I was pleasantly surprised to see how easy it is to generate your own autoloads in order to speed up Emacs. Simply put, autoloads mean you do not load files or functions until you need them. Instead you read in a catalog of stubs which tell the system what to load if and when certain functions are called. And it's incredibly easy to use.

The first you do is make use of the "magic comment". All that is a special format line prior to your defun lines. e.g

  • ;;;###autoload
  • (defun rgr/anything ()
  • "default to thing at point for anything"
  • (interactive)
  • (anything nil (region-or-word-at-point)))
Here the ";;;###autoload" tells the autload generator to include the following functions. Then having set the necessary autoload file name, you can generate your autoload file which is commonly, but not necessarily, called "loaddefs.el". Here I use "my-autoload.el":

  • ;; Generate autoload for locally downloaded and developed elisp files
  • ;;;###autoload
  • (defun my-autoloads nil
  • (interactive)
  • "Generate autoloads for code in ~/.emacs.d/."
  • (interactive)
  • (let ((generated-autoload-file "~/.emacs.d/my-autoload.el"))
  • (update-directory-autoloads "~/.emacs.d")))
Then call my-autoloads and bobs your uncle. The main thing to consider is keeping your functions seperate from the key definitions (as one example) which call them since you would need to load that file to install the key binding thus slightly defeating the object!

I don't need to mention that you need to load the autoload file do I?

  • (require 'my-autoload)

Wednesday, February 4, 2009

Anything - more Emacs goodies

While restructuring my emacs files for faster load times I remembered that I had not really played too much with the wonderful anything. To put it simply anything calls up a bunch of functions provides a list of results that they return. Each return element has a context sensitive action menu. So for example, I call "anything" and type "riley". Because I have the anything-c-source-bbdb plugin set I see my bbdb entries which contain "riley". Also I have anything-c-source-w3m-bookmarks so I see any w3m bookmarks containing that word. Even more useful is anything-c-source-man-pages. There are hosts of plugins out there and more being developed. Give it a go. Here's my set up:


  • (autoload 'anything "my-anything" nil t)


  • (require 'anything-extension)
  • (require 'anything-config)

  • (setq anything-sources
  • (list
  • anything-c-source-man-pages
  • anything-c-source-bbdb
  • anything-c-source-locate
  • anything-c-source-w3m-bookmarks
  • anything-c-source-occur)
  • anything-idle-delay 0.2
  • anything-samewindow t
  • anything-input-idle-delay 0.2
  • anything-candidate-number-limit 10)
  • (provide 'my-anything)
And finally a key binding and a wrapper:

  • (global-set-key (kbd "") 'rgr/anything)
  • (defun rgr/anything ()
  • "default to thing at point for anything"
  • (interactive)
  • (anything nil (region-or-word-at-point)))

Monday, February 2, 2009

Speeding Up Emacs Loading

Wow. I just reduced my emacs startup time from 10 or more seconds to about 1. The secret is autoloading and eval-after-load. See the init files at my emacs config pages for more details. The main offenders were the programming modes, w3m, gnus and bbdb. I autload the packages when I call there access functions now and, not susprisingly, the start up is considerably faster.