~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to elisp/ansi-doc.el

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;; Copyright  William F. Schelter.   1994
 
2
;; Licensed by GNU public license.
 
3
 
 
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
 
10
;; as needed.
 
11
 
 
12
 
 
13
(defvar ansi-doc-dir "/usr/local/doc/dpANS2")
 
14
(defvar ansi-doc-alist nil)
 
15
 
 
16
(defun create-index-el-from-index-idx ()
 
17
  (interactive)
 
18
  (let (tem)
 
19
    (cond ((not ansi-doc-alist)
 
20
           (setq tem (concat ansi-doc-dir "/index.el"))
 
21
           (or (file-exists-p tem)
 
22
               (progn
 
23
                 (shell-command
 
24
                  (concat "echo '(setq ansi-doc-alist (quote (( ' > " tem))
 
25
                 (shell-command
 
26
                  (concat "cat " ansi-doc-dir "/index.idx "
 
27
                          "| sed "
 
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'"
 
34
                          " | sort -r  "
 
35
                          " >> " tem))
 
36
                 (shell-command (concat "echo '))))' >>  " tem))))
 
37
           
 
38
           ))))
 
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"
 
42
  (let (tmp-file)
 
43
    (cond  ((file-exists-p (concat file ".gz"))
 
44
            (setq tmp-file
 
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 > "
 
49
                                              tmp-file ))))
 
50
            tmp-file)
 
51
           (t file))))
 
52
 
 
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 "
 
57
  (interactive )
 
58
  (let (x tem name lis first chap tmp-chap)
 
59
    (or ansi-doc-alist
 
60
        (progn
 
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)
 
65
            (while lis
 
66
              (cond ((equal (car  (car lis)) name)
 
67
                     (setq ans (append ans (cdr  (cdr (car lis)))))))
 
68
              (setq lis (cdr lis)))
 
69
            )       
 
70
    (setq tem ans)
 
71
    (if (cdr tem) (setq first "First") (setq first ""))
 
72
    (while tem
 
73
      (setq x (car tem))
 
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 "
 
80
                             " -paper 7.2x8.5 "
 
81
                             " -display "
 
82
                             (or x-display-name ":0")
 
83
                             "  -geometry -2-2 +" (+ (cdr x) 2)" "
 
84
                             chap
 
85
                             ))
 
86
      (setq tem (cdr tem))
 
87
 
 
88
      )
 
89
    )
 
90
  (message nil)
 
91
  
 
92
  )