Wednesday, September 23, 2009

Windows command window title

Did you know you could change the title in the window of a command prompt using the title command? Example:

title Poop ha ha

Now that's only really useful for making windows with rude words in their title bars right? Well actually, I've found a great use for it. If you have a bunch of command prompt windows open then you have no idea which one is which on the Windows taskbar, once they are stacked. So naming them is a really useful habit since once named you can see which window is which.






Thursday, September 10, 2009

Making emacs growl

Roaring lion

I've always wished emacs could notify me of it's doings. For example the message function just pops up text in the minibuffer and is easy to miss, and impossible to see when the window is not in focus. So I was pleased when looking through the
twit.el code to find out about todochiku, and emacs interface to Growl.

Download Growl for windows and set it up. Send yourself a test growl at the command prompt like this:

"C:/Progra~1/Growlf~1/growlnotify.exe" /T:"title" "message"

Once that's working you can send notifications from emacs. todochiku is an emacs package for sending notifications to growl, snarl or whatever you have. In our case we have growl. Unfortunately the windows default is to use snarl, and there's no support for growl. I've made a few modifications to the original to get that working and uploaded the new file here. (Ideally I should make it so it searches both for windows and for growl or snarl being installed but for now the choice is made manually)

heyes-jones.com/todochiku.el

Download the elisp file into a directory in your emacs load-path (or add it) and add the (require 'todochiku) command to your .emacs file. Reload emacs, or just hit C-x e after the (require command in your .emacs)

You will need (require 'cl) somewhere before this is loaded (.emacs perhaps)

Customize the variables for the program using M-x customize-group todochiku

You'll need to set the `todochiku command' to something like this:

C:/Progra~1/Growlf~1/growlnotify.exe

Use "Dir /x *" in a folder to find out what the 8 character name is.

If you want icons that come with todochiku then download them from the todochiku wiki page and point to them with the variable `todochiku icons directory'. For example mine is set to:

~/localemacs/todochiku-icons

Finally you can do a growl... try this

(growl "Emacs" "Hello")



There's also `todochiku-message' which let's you specify an icon. This can be an image filename, and url, or an icon symbol from the built in list of icons you can find by the variable `todochiku-icons'.

(todochiku-message "Emacs" "You're growlingnow" 'social)

(todochiku-message "Emacs" "You're growlingnow" "http://www.growlforwindows.com/gfw/images/downloadlatest.gif")

(todochiku-message "Emacs" "You're growlingnow"
"c:/cygwin/home/Justin/localemacs/todochiku-icons/binary.png")

There's a command `todochiku-in' which will send you a notification from emacs in a set number of minutes.

(todochiku-in "hello" 3)


If you use twit.el you should find that todochiku automatically notifying you of tweets if you have called `show-recent-tweets'.

It's very simple to use todochiku and growl so you should find all kinds of applications for this. Have fun!



Tuesday, September 8, 2009

Directional window movement in emacs

One thing I sometimes miss about the text editor Brief, which I stopped using a decade ago, is being able to move between windows easily by pressing a function key and then an arrow key to switch to a window in that direction.

In emacs I only knew how to move between windows using `other-window', mapped to C-x o and that only cycles around the windows, and if you have a few windows open and possibly you're also editing the mini-buffer, that's quite a round trip.

I just learned about `M-x windmove-default-keybindings', which binds a set of commands that do exactly the kind of directional movement I'm talking about (`windmove-right', `windmove-up' and so on) to the cursor keys (with shift key held).

Tuesday, September 1, 2009

Handful of emacs tips

keep-lines
flush-lines

These handy functions prompt you for a regular expression and will either remove every line that does not contain that expression (keep) or remove the ones that do (flush
).

finder-list-keywords

This function shows all the keywords used in the packages within emacs. In other words you can find a lot of stuff in emacs that you never knew was there.