Tuesday, November 2, 2010

Just browsing

It's handy in emacs to be able to go straight to your browser to view a page, and you can do fancy stuff with `webjump' as I mentioned in a previous post.

Another handy function is `browse-url' which will prompt for the url but default to whatever your point is at.

If you're in a html file and you'd like to open that with your browser then `browse-url-of-file' will open it up.

Finally, and I just found this today, if you have some html code in a buffer that isn't even a file, you can open that in your browser to using `browse-url-of-buffer' and emacs will write it to a temporary file and open that in the browser for you.


Tuesday, October 19, 2010

rgrep on windows 7 for emacs

I lost an hour configuring this, so seems worthy of a blog post.

A fresh install of emacs for windows will have functionality that does not work because it depends on unix style utilities.

One very useful example is the command rgrep, which searches files recursively through subfolders looking for a regular expression in those files.

Under the hood it uses the unix command line tools find, and egrep. Unfortunately the windows version of find takes entirely different parameters and will not function. In fact you will get an error that looks like this:

FIND: Wrong parameter format

Using the set of native ports of Unix command line tools UnxUtils you can easily fix this:

  1. Download the zip file and extract it to c:\unxutils
  2. Add the following path to the very front of your path by editing your system environment variables C:\unxutils\usr\local\wbin\;
That's it. You can run rgrep now and hopefully you're up and running.

If not make sure you have restarted emacs so it picks up the new setting of PATH. Open a shell in emacs and type 'find --version'. You should see something like this if your path is configured correctly:

c:\find --version
find --version
GNU find version 4.1

and if not you will see:

C:\Windows\system32>find --help
FIND: Parameter format not correct