1 ;; Copyright William F. Schelter. 1994
2 ;; Licensed by GNU public license.
4 ;; This file contains function find-ansi-doc which finds documentation in the
5 ;; standard common lisp ansi documentation (1350 pages!), and puts it on
6 ;; the screen at the correct page using xdvi. If there is more than one
7 ;; reference it successively finds them. You need dpANS2/*.dvi
8 ;; dpANS2/index.idx from parcftp.xerox.com (13.1.64.94) You also need
9 ;; xdvi. You may gzip the .dvi files and it will unzip them into tmp
13 (defvar ansi-doc-dir
"/usr/local/doc/dpANS2")
14 (defvar ansi-doc-alist nil
)
16 (defun create-index-el-from-index-idx ()
19 (cond ((not ansi-doc-alist
)
20 (setq tem
(concat ansi-doc-dir
"/index.el"))
21 (or (file-exists-p tem
)
24 (concat "echo '(setq ansi-doc-alist (quote (( ' > " tem
))
26 (concat "cat " ansi-doc-dir
"/index.idx "
28 " -e 's/\\!9\\([A-Z]\\):\\([^\\!]*\\)\\!\\!/)(\"\\2\" \\1/g' "
29 " -e 's:{$\\\\spLT \\$}:<:g' "
30 " -e 's:{$\\\\spGT $}:>:g' "
31 " -e 's:\\\\&:\\&:g' "
32 " -e 's:\\([0-9]\\),:\\1:g'"
33 " -e 's:\\([A0-9][0-9]*\\)--\\([0-9][0-9]*\\):(\\1 . \\2):g'"
36 (shell-command (concat "echo '))))' >> " tem
))))
39 (defun maybe-gzip-to-tmp (file &optional dir
)
40 "If file exists with .gz added to it, then unzip it to /tmp and
41 return that file otherwise return file"
43 (cond ((file-exists-p (concat file
".gz"))
45 (file-name-nondirectory file
))
46 (or (file-exists-p tmp-file
)
47 (progn (message "gzipping %s in /tmp for future use" file
)
48 (shell-command (concat "gzip -dc < " file
".gz > "
53 (defun find-ansi-doc ()
54 "Find the documentation in the ansi draft on a particular function
55 or topic. If there are several pieces of documentation then go through
56 them successively. Requires copying the "
58 (let (x tem name lis first chap tmp-chap
)
61 (create-index-el-from-index-idx )
62 (load (concat ansi-doc-dir
"/index.el"))))
63 (setq name
(completing-read "Doc on: " ansi-doc-alist nil t
))
64 (progn (setq ans nil
) (setq lis ansi-doc-alist
)
66 (cond ((equal (car (car lis
)) name
)
67 (setq ans
(append ans
(cdr (cdr (car lis
)))))))
71 (if (cdr tem
) (setq first
"First") (setq first
""))
74 (setq chap
(concat ansi-doc-dir
75 (downcase (format "/chap-%s.dvi" (car x
)))))
76 (setq chap
(maybe-gzip-to-tmp chap
))
77 (message "%s Doc in Chapter %s page %s) %s .." first
(car x
) (cdr x
))
78 (if (cdr tem
) (setq first
"Next") (setq next
"Final"))
79 (shell-command (concat "xdvi -expert -xoffset .2 -yoffset -.2 "
82 (or x-display-name
":0")
83 " -geometry -2-2 +" (+ (cdr x
) 2)" "