Announcing Dizzee

Dizzee is an Emacs library for managing subprocesses.
This is it’s initial release!

From the docs:

Dizzee is a pleasant way to manage your project’s subprocesses in Emacs.
You have a project.
In order to get an instance running and start working, you have to manually launch say… 4 processes in 4 different shells.
This is Not Fun.
Thankfully it is also a definable, repeatable process – which means that we can Use Programming.
At worst, this is More Fun than doing it yourself every time.

This all came about when I started my current job – of the three product stacks I work on, none can be run from source without launching multiple processes in separate shells. Terminator helps (and is generally awesome) but being able to start work on a bug all with one command, and build in code reloading without having to build it into the source & go through the process of getting the relevant buy-in for that, was a massive win.

Bugs/feature requests & docs via github.

Enjoy.

Love regards etc

For those moments when you want fast access to “~/.something” – what nicer than M-x .thatsomething

(defmacro dotfile (filename)
  "Define the function `filename' to edit the dotfile in question"
  (let ((filestr (symbol-name filename)))
    `(progn
       (defun ,(intern filestr) ()
         ,(format "Open %s for editing" filestr)
         (interactive)
         (find-file ,(concat "~/" filestr))))))

With which we can define a M-x .emacs function with:

(dotfile .emacs)

Love regards etc

Doing a lot of work with interpreters that need semi-colons to tell them when a line ends recently – and making flymake be quiet about it involves a whole sequence of C-e … ; … what was I thinking about again?

So thanks to this, C-M-; now colonizes the line and leaves me happily where I was

 
(defun colonize ()
  "For languages that insist on putting a colon at the end of a line,
do that. But stay where you're thinking is at."
  (interactive)
  (save-excursion
    (move-end-of-line nil)
    (insert ";")))
 
(global-set-key (kbd "C-M-;") 'colonize)

Love regards etc

As much as I love the version control integration of the bug trackers I use (Redmine and Trac) I find myself forgetting to include the issue reference more often than I’d like to admit.

Add to this the merry dance you have to go through to ammend commit messages in Mercurial and things get even worse. (Oh how I’d love for hg to implement something similar to git’s $ git commit –amend )

Hence, a Pre-transaction-commit hook for hg that will ask me if I’m sure I want to commit without an issue number. If want to commit anyway, it’s just two extra keystrokes, and saves a whole lot of rollback/apply nonsense.

#!/usr/bin/env python
import os
import re
import subprocess
import sys
 
cmd = subprocess.Popen(['hg', 'log', '-vr', os.environ['HG_NODE']],
                       stdout=subprocess.PIPE).communicate()[0]
msg = cmd.split('description:')[1]
issue_regexes = [
    # Trac
    r'#\d+',
    # Redmine
    r'fixes #\d+',
    r'refs #\d+',
    ]
if not filter(lambda x: re.search(x, msg), issue_regexes):
    print "No issue ref or fix... message is:"
    print msg
    sys.stdout.write("Continue? [y/n] ")
    resp = raw_input().lower()
    if resp == 'n':
        sys.exit(9)

Then add the following to your project’s .hg/hgrc:

[hooks]
pretxncommit = path/to/your/pretxncommit.py

Saving you endless embarrassment:

davidmiller@pascal:~/src/buggy_repo$ hg commit -m "A context-less void"
No issue ref or fix... message is:
 
A context-less void
 
 
 
Continue? [y/n] n
transaction abort!
rollback completed
abort: pretxncommit hook exited with status 9

Love regards etc