index

accessing gnome api html docs from inside emacs (or from command line)

problem:

i have the gnome api docs in /usr/share/gtk-doc/html/ and want to access the function/enum/type/variable descriptions quickly. (From inside emacs, for example)

Fast solution: try it to see if it's ok for you.

you need either $BROWSER or lynx (for the last step), and wget

wget  http://www.ruska.it/comp/activity/scheme/text/references
mv  references  ~/.gnome-api-references
wget  http://www.ruska.it/comp/activity/shell/gnome-doc
chmod +x gnome-doc 
gnome-doc gtk_main

described solution:

steps:

1/ we need a mapping: C symbol -> filename of the html document.

gtk.scm (a scsh script) generates such 'index' files by scanning gtk+-2.2.4/docs/reference/*/*-sections.txt files

these files will contain a mapping s"c symbol" -> filename. Then I mix all such index files (into one big).

if you're really that lazy (or not interested in running scsh, and adding new API indexes), this is my current one: http://www.ruska.it/comp/activity/scheme/text/references

2/ a shell script, given a c symbol name, greps in the index file, and then tries:

elinks "${filename}#$section"

(where section is the symbol name, "_" ->"-" modified)

(If you don't use Emacs), you can still use this from command like:

gnome-doc gtk_main
gnome-doc

3/ make it invokable from emacs:

note: interesting, that the html files names contain "-" instead of "_"

from my my-c-mode.el:

(defun gtk-doc (symbol)
  "grab the symbol under the point (interpret it as a gtk+ function name),
and invoke a html browser to display the relevant api docs  "
  (interactive (list (thing-at-point 'symbol)))
  (if (string-match "-" symbol)
      (setq symbol (replace-regexp-in-string "-" "_" symbol)))
  (xterm nil (format "/x/activity/shell/gnome-doc %s" symbol) symbol))

xterm is a function here: my-xterm.el

4/ under vim:

if you save the 'references' file, and place the gnome-doc shell script, you can use the this tool under vim too:

nnoremap <silent> <F3> :!aterm -e /home/cairo/gnome-doc <C-r><C-w><cr>
inoremap <silent> <F3> <ESC>:!aterm -e /home/cairo/gnome-doc <C-r><C-w><cr>