Wednesday, February 6, 2008

Emacs Config: Search for Unix function on Open Group site

At the moment I am developing in C, often referencing to Open Group Unix specification from their site for description of networking *nix functions.

To simplify searching, Ctrl-F1 accelerator have been added in .emacs for searching keyword in Open Group index.

Corresponding part of my emacs config is:


%<--------

;; Manually edited part
(require 'w3m-load)
(setq browse-url-browser-function 'w3m-browse-url)

(defun browse-url-other-buffer(x)
"browse url wrapper; switches to other buffer; than browses"
(interactive)
(progn
(switch-to-buffer-other-window(other-buffer))
(browse-url x)))

(defun lookup-producer (x)
"used to produce function for looking up the
word under cursor in a browser."
(interactive)
(browse-url-other-buffer
(concat x
(thing-at-point 'word))))

(defun search-current-word-opengroup()
"search current word definition in opengroup UNIX spec"
(interactive)
(mapcar (lambda(x) (lookup-producer x) )
(list "http://www.opengroup.org/cgi-bin/kman?value=")))

(global-set-key (kbd "< C-f1>") 'search-current-word-opengroup)
---------->%

prerequisites:

w3m have to be installed.
get tar.gz from site of w3m development, gunzip; tar -xf.

Install process is your configuration specific.
Read README from root of untared directory.

For me (emacs 21.2.4 under cygwin, winXP) installation was:
./configure
./make install

No comments: