webjump by Neil Van Dyke is part of emacs and Xemacs, and gives you a way to assign memorable names to web site urls, and to build simple search queries. It then opens the website using emacs' built in browse-url function.
Set up is easy. All you need to add something like this to .emacs:
(require 'webjump)
(global-set-key [f2] 'webjump)
(setq webjump-sites
(append '(
("Reddit Search" .
[simple-query "www.reddit.com" "http://www.reddit.com/search?q=" ""])
("Google Image Search" .
[simple-query "images.google.com" "images.google.com/images?hl=en&q=" ""])
("Flickr Search" .
[simple-query "www.flickr.com" "flickr.com/search/?q=" ""])
)
webjump-sample-sites))
The first line just makes sure the feature is loaded, and then I bind the webjump function to F2 in the second line.
To use webjump, just press F2, and press TAB to expand the sample sites that are built in, and the ones we just added above. Type Flickr Search for example, and then you get a prompt for the search string. Once you enter that your browser should open with flickr showing the search.
I've added Reddit, Flickr, and Google image search above, but it's easy to add your own as follows:
Each entry in the jump list takes the form (name . url|builtin), where the simplest shortcut is just a name, url pair like this:
("astar algorithm" . "http://www.heyes-jones.com/astar")
There are some builtin functions that you can use. For example simple-query lets you enter some text that will be inserted between two strings. The format is:
("Reddit Search" .
[simple-query "www.reddit.com" "http://www.reddit.com/search?q=" ""])
When doing something more clever than an url you pass in a vector (hence the []'s), where the first argument is the function, the second is the default url (if the user doesn't enter anything, and the third and forth arguments are the prefix and the postfix wrapped around the users input to make the search work. In this case the last argument is the empty string.
You can provide your own functions to do something really fancy if you need to.
1 comment:
This is really sweet. Had no idea that webjump existed.
Thanks for posting.
Post a Comment