annotate lisp/utils/browse-cltl2.el @ 151:59463afc5666 r20-3b2

Import from CVS: tag r20-3b2
author cvs
date Mon, 13 Aug 2007 09:37:19 +0200
parents 4103f0995bd7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
1 ; -*- Mode: Emacs-Lisp -*-
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
2 ;;; browse-cltl2.el --- browse the hypertext-version of
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
3 ;;; "Common Lisp the Language, 2nd. Edition"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
4
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
5 ;; Revision 1.1.2
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
6 ;; last edited on 18.2.1997
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
7
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
8 ;; Copyright (C) 1997 Holger Schauer
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
9
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
10 ;; Author: Holger Schauer <Holger.Schauer@gmd.de>
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
11 ;; Keywords: utils lisp ilisp www
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
12
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
13 ;; This file is not part of Emacs.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
14
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
15 ;; Developed under XEmacs 19.14. Also tested on Emacs 19.32 and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
16 ;; XEmacs 19.11. Should work with newer versions, too.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
17 ;; Required: browse-url.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
18 ;; Recommended: url.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
19
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
20 ;; This program is free software; you can redistribute it and/or modify
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
21 ;; it under the terms of the GNU General Public License as published by
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
22 ;; the Free Software Foundation; either version 2 of the License, or
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
23 ;; (at your option) any later version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
24 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
25 ;; This program is distributed in the hope that it will be useful,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
26 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
27 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
28 ;; GNU General Public License for more details.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
29 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
30 ;; You should have received a copy of the GNU General Public License
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
31 ;; along with this program; if not, write to the Free Software
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
32 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
33
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
34 ;;; Commentary:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
35 ;; This gives you two top-level-functions useful when programming lisp:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
36 ;; cltl2-view-function-definition and cltl2-view-index
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
37 ;; cltl2-view-function-definition asks you for a name of a lisp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
38 ;; function (or variable) and will open up your favourite browser
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
39 ;; (as specified by `browse-url-browser-function') loading the page
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
40 ;; which documents it.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
41
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
42 ;;; Installation: (as usual)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
43 ;; Put browse-cltl2.el somewhere where emacs can find it.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
44 ;; browse-cltl2.el requires a working browse-url, url and cl.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
45 ;; Insert the following lines in your .emacs:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
46 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
47 ;; (autoload 'cltl2-view-function-definition "browse-cltl2")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
48 ;; (autoload 'cltl2-view-index "browse-cltl2")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
49 ;; (autoload 'cltl2-lisp-mode-install "browse-cltl2")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
50 ;; (add-hook 'lisp-mode-hook 'cltl2-lisp-mode-install)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
51 ;; (add-hook 'ilisp-mode-hook 'cltl2-lisp-mode-install)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
52 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
53 ;; This should also add the needed hooks to lisp-mode (and ilisp-mode).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
54
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
55 ;; Gnu Emacs:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
56 ;; For Gnu Emacs there doesn't seem to be a lisp-mode-hook so you're
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
57 ;; on your own with the key-settings.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
58 ;; No url.el:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
59 ;; If you don't have url.el set *cltl2-use-url* to nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
60 ;; and set *cltl2-fetch-method* to 'local or 'local-index-only.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
61 ;; This implies that you need a local copy of the index page of
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
62 ;; CLtL2 (which you can get from the normal hypertext-version at CMU),
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
63 ;; so you need to point *cltl2-local-file-pos* and *cltl2-index-file-name*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
64 ;; to the place where you put it.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
65 ;; Old versions of Emacs (XEmacs 19.11 for example):
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
66 ;; When you want to use a local copy (or a local copy of the index file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
67 ;; check the documentation on find-file-noselect. If it doesn't mention
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
68 ;; an option called RAWFILE set *cltl2-old-find-file-noselect* to 't.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
69
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
70
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
71 ;;; Customization:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
72 ;; By default, browse-cltl2 will use a local copy of CLtL2, looking
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
73 ;; for it in /usr/doc/html/cltl. This can be modified with the help
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
74 ;; of the following variables:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
75 ;; *cltl2-fetch-method*, *cltl2-url*, *cltl-local-file-pos*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
76 ;; See the documentation on this variables for more info.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
77 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
78 ;;; TODO:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
79 ;; In this version we can't separate between functions, variables,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
80 ;; constants and loop clauses. This is not that hard to change,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
81 ;; but it is more difficult to distinguish what the user is
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
82 ;; looking for. Until I receive several requests for it, I won't
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
83 ;; implement it, because there are not that much constructs like * and +
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
84 ;; which have two (or more) semantics.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
85
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
86 ;;; Changes:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
87 ;; 28-01-97: HS: now we're using cl-puthash all over the place because
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
88 ;; this is common on XEmacs 19.11 and upwards and Gnu Emacs.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
89 ;; Added information on how to install without url.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
90 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
91 ;; 29-01-97 HS: included conditionalized versions of the required
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
92 ;; functions match-string and buffer-live-p.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
93 ;; Suggested by Simon Marshall <Simon.Marshall@esrin.esa.it>.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
94 ;; Included new variable *cltl2-use-url* with which one can
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
95 ;; specify if he has url.el or not. Introduced variable
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
96 ;; *cltl2-old-find-file-noselect*.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
97 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
98 ;; 05-02-97 HS: added two variables for the key-bindings,
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
99 ;; *cltl2-vfd-key* *cltl2-vi-key*.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
100 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
101 ;; 18-02-97 HS: use compatible keybindings that work on Gnu Emacs and XEmacs.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
102 ;; Made cltl2-lisp-mode-install an interactive function.
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
103 (defvar *cltl2-use-url* 'nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
104 "Enables or disables retrieval of the index-file via WWW (or more
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
105 exactly by the use of the function url-retrieve from url.el).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
106 Default is 't.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
107
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
108 ;; needed things
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
109 (require 'cl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
110 (require 'browse-url)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
111
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
112 (when (not *cltl2-use-url*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
113 (require 'url))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
114
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
115 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
116 ;;; Some variable and constant definitions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
117 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
118 (defvar *cltl2-fetch-method* 'local
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
119 "This sets the method by which the index-file will be fetched. Three
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
120 methods are possible: 'local assumes that all files are local.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
121 'local-index-only assumes that just the index-file is locally but
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
122 all other files will be fetched via www. 'www means that the index-file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
123 will be fetched via WWW, too. Don't change the value of this variable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
124 after loading.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
125
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
126 (defvar *cltl2-url*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
127 "http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
128 "The url where the hypertext-version of Common Lisp the Language
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
129 can be found. Note that this assumes to be the top-level of the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
130 directory structure which should be the same as in the hypertext
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
131 version as provided by the CMU AI Repository. Defaults to
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
132 http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
133 Note the / at the end.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
134
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
135 (defvar *cltl2-local-file-pos* "/usr/doc/html/cltl/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
136 "A directory where the CLtl2 can be found. Note that this assumes
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
137 to be the top-level of the directory structure which should be the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
138 same as in the hypertext version as provided by the CMU AI Repository.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
139 Defaults to /usr/doc/html/cltl/ Note the / at the end.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
140
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
141 (defconst *cltl2-index-file-name* "clm/index.html"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
142 "The name of the index-file, typically with directory on front.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
143 Defaults to clm/index.html, as this is the momentary position from
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
144 the top-level directory of the CLtL2-home. Defaults to clm/index.html.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
145 Note that there is no leading /.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
146
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
147 (defvar *cltl2-index-home*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
148 (concatenate 'string
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
149 (case *cltl2-fetch-method*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
150 ('local *cltl2-local-file-pos*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
151 ('local-index-only *cltl2-local-file-pos*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
152 ('www *cltl2-url*))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
153 *cltl2-index-file-name*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
154 "The absolute path which will be used to fetch the index.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
155
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
156 (defvar *cltl2-home*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
157 (concatenate
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
158 'string
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
159 (case *cltl2-fetch-method*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
160 ('local *cltl2-local-file-pos*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
161 ('local-index-only *cltl2-url*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
162 ('www *cltl2-url*))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
163 "clm/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
164 "This specifies the home-position of the CLtL2. The value of this variable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
165 will be concatenated with the name of the nodes of the CLtL2.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
166
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
167 (defvar *cltl2-index-buffer-name* "*cltl2-index*"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
168 "The name of the buffer which holds the index for CLtL2.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
169
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
170 (defvar *cltl2-old-find-file-noselect* 'nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
171 "Older versions of Emacs (at least XEmacs 19.11) don't support the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
172 option RAWFILE with the function FIND-FILE-NO-SELECT. Set this variable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
173 to 't if you have such an old version. It will cause fontification and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
174 other useless stuff on the buffer in which the index is fetched. If
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
175 you don't use a local copy (of the index) this won't bother you.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
176
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
177 (defvar *cltl2-vfd-key*
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
178 (if (featurep 'ilisp)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
179 '[(control z) h]
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
180 '[(control c) b])
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
181 "Shortcut for accessing cltl2-view-function-definition. Use meaningful
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
182 setting with Ilisp.")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
183
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
184 (defvar *cltl2-vi-key*
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
185 (if (featurep 'ilisp)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
186 '[(control z) H]
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
187 '[(control c) B])
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
188 "Shortcut for accessing cltl2-view-index. Use meaningful
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
189 setting with Ilisp.")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
190
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
191 (defvar *browse-cltl2-ht* (make-hash-table 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
192 (defconst *cltl2-search-regexpr*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
193 "<a href=\"\\(.+\\)\"><code>\\(.+\\)</code></a>"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
194 "A regular expression how to check for entries in the index-file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
195 of CLtL2. Note that you have to modify this and the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
196 prepare-get-entry*-functions if you want to change the search.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
197
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
198 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
199 ;;; First of all: Compatibility stuff
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
200 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
201 ; no match-string in old versions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
202 (if (not (fboundp (function match-string)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
203 (defun match-string (num &optional string)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
204 "Return string of text matched by last search.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
205 NUM specifies which parenthesized expression in the last regexp.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
206 Value is nil if NUMth pair didn't match, or there were less than NUM pairs.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
207 Zero means the entire text matched by the whole regexp or whole string.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
208 STRING should be given if the last search was by `string-match' on STRING."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
209 (if (match-beginning num)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
210 (if string
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
211 (substring string (match-beginning num) (match-end num))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
212 (buffer-substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
213 (match-beginning num) (match-end num))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
214
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
215 ; no buffer-live-p in old versions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
216 (if (not (fboundp (function buffer-live-p)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
217 (defun buffer-live-p (buf-or-name)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
218 "Checks if BUF-OR-NAME is a live buffer. Returns non-nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
219 if BOF-OR-NAME is an editor buffer which has not been deleted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
220 Imitating a built-in function from newer Emacs versions."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
221 (let ((object (if (bufferp buf-or-name)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
222 buf-or-name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
223 (get-buffer buf-or-name))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
224 (and (bufferp object) (buffer-name object)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
225
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
226 ; no add-submenu in old versions of XEmacs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
227 (if (and (string-match "XEmacs\\|Lucid" emacs-version)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
228 (not (fboundp 'add-submenu)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
229 (defun add-submenu (menu-path submenu &optional before)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
230 "Add a menu to the menubar or one of its submenus.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
231 If the named menu exists already, it is changed.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
232 MENU-PATH identifies the menu under which the new menu should be inserted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
233 It is a list of strings; for example, (\"File\") names the top-level \"File\"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
234 menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\".
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
235 If MENU-PATH is nil, then the menu will be added to the menubar itself.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
236 SUBMENU is the new menu to add.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
237 See the documentation of `current-menubar' for the syntax.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
238 BEFORE, if provided, is the name of a menu before which this menu should
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
239 be added, if this menu is not on its parent already. If the menu is already
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
240 present, it will not be moved."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
241 (add-menu menu-path (car submenu) (cdr submenu) before)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
242
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
243 ; old find-file-noselect has no RAWFILE argument
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
244 (if *cltl2-old-find-file-noselect*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
245 (unless (boundp 'cltl2-old-find-file-noselect-func)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
246 (setf (symbol-value 'cltl2-old-find-file-noselect-func)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
247 (symbol-function 'find-file-noselect))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
248 (setf (symbol-function 'find-file-noselect)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
249 #'(lambda (file &optional nowarn rawfile)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
250 (funcall cltl2-old-find-file-noselect-func file nowarn)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
251
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
252 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
253 ;;; Functions for fetching the index file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
254 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
255 (defun cltl2-fetch-index ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
256 "Fetches the index page of the CLtl2 and puts it in its own
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
257 buffer called *cltl2-index*."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
258 ;; if the index isn't here load it into a buffer
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
259 (when (or (not (get-buffer *cltl2-index-buffer-name*))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
260 (not (buffer-live-p *cltl2-index-buffer-name*)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
261 (message "Fetching the CLtL2 index file ...")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
262 (case *cltl2-fetch-method*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
263 ('local
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
264 (cltl2-fetch-index-by-file))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
265 ('local-index-only
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
266 (cltl2-fetch-index-by-file))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
267 ('www
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
268 (cltl2-fetch-index-by-www))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
269
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
270 (cltl2-prepare-index)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
271 )
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
272
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
273 ;; fetch methods
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
274 (defun cltl2-fetch-index-by-file ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
275 "Fetch the index from disk."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
276 (setf *cltl2-index-buffer-name*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
277 (find-file-noselect *cltl2-index-home* 'nil 't))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
278 )
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
279
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
280 (defun cltl2-fetch-index-by-www ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
281 "Fetch the index via WWW."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
282 (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
283 (let ((old-url-working-buffer url-working-buffer))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
284 (setf url-working-buffer *cltl2-index-buffer-name*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
285 (url-retrieve *cltl2-index-home*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
286 (setf url-working-buffer old-url-working-buffer))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
287
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
288
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
289 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
290 ;;; Main functions for viewing
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
291 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
292 (defun cltl2-view-function-definition (entry)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
293 "First checks if function can be found in the CLtL2-index-file.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
294 If it can be found, uses the function browse-url to have a look
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
295 at the corresponding documentation from CLtL2."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
296 (interactive "sCLtL2-Entry to lookup:")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
297 (when (cltl2-index-unprepared-p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
298 (cltl2-fetch-index))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
299
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
300 (let ((entry-url (cltl2-find-url-for-function (intern entry))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
301 (when entry-url
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
302 (message "Loading found entry for %s into browser.." entry)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
303 (browse-url
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
304 (concatenate 'string *cltl2-home* entry-url)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
305
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
306 (defun cltl2-find-url-for-function (entry)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
307 "Checks if we can find a page for function ENTRY and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
308 constructs an URL from it."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
309 (let ((entry-url (gethash entry *browse-cltl2-ht*)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
310 (when (not entry-url)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
311 (error "No entry in CLtL2 for %s" entry))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
312 entry-url))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
313
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
314 (defun cltl2-view-index ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
315 "Browse-urls the index file."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
316 (interactive)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
317 (browse-url *cltl2-index-home*))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
318
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
319 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
320 ;;; Preparing the index (the hashtable)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
321 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
322 (defun cltl2-prepare-index ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
323 "Jumps to the *cltl2-index* buffer and scans it, creating a hashtable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
324 for all entries."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
325 (message "Preparing CLtL2 index.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
326 (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
327 (set-buffer *cltl2-index-buffer-name*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
328 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
329
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
330 ; search for entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
331 (do ((point (re-search-forward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
332 *cltl2-search-regexpr*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
333 nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
334 (re-search-forward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
335 *cltl2-search-regexpr*
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
336 nil t)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
337 ; until we can't find anymore
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
338 ((null point)); (format "Index-preparation done."))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
339 ; put found entry in hash-table
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
340 (cl-puthash
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
341 (cltl2-prepare-get-entry-name)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
342 (cltl2-prepare-get-entry-url)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
343 *browse-cltl2-ht*))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
344
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
345 (defun cltl2-prepare-get-entry-name ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
346 "Get the enrty name from the last match of regexp-search for entries."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
347 (let ((name-string (intern (match-string 2))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
348 (format "%s" name-string)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
349 name-string))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
350
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
351 (defun cltl2-prepare-get-entry-url ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
352 "Get the enrty url from the last match of regexp-search for entries."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
353 (let ((url (match-string 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
354 (format "%s" url)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
355 url))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
356
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
357 (defun cltl2-index-unprepared-p ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
358 "Check if the index is already prepared."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
359 ; If the hashtable has entries the index is prepared.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
360 (not (and (hash-table-p *browse-cltl2-ht*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
361 (>= (hash-table-count *browse-cltl2-ht*) 1))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
362
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
363 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
364 ;;; Hooking into lisp mode and ilisp-mode
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
365 ;;; ******************************
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
366 (defun cltl2-lisp-mode-install ()
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
367 "Adds browse-cltl2 to lisp-mode. If you use ilisp (installed via a hook
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
368 on lisp-mode) add browse-cltl2 to ilisp. Check the variables *cltl2-vfd-key*
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
369 and *cltl2-vi-key* for the keybindings. Under XEmacs we will add ourself to
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
370 the corresponding menus if there exists one."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
371 (interactive)
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
372 ; set key bindings
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
373 (local-set-key *cltl2-vfd-key* 'cltl2-view-function-definition)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
374 (local-set-key *cltl2-vi-key* 'cltl2-view-index)
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
375 ; under XEmacs hook ourself into the menu if there is one
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
376 (when (string-match "XEmacs\\|Lucid" emacs-version)
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
377 (cond ((and (featurep 'ilisp-easy-menu)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
378 ; this is for the menu as provided by ilisp-easy-menu
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
379 (not (null (car (find-menu-item current-menubar '("ILisp"))))))
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
380 (add-submenu
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
381 '("ILisp" "Documentation")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
382 '("Browse CLtL2"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
383 [ "View entry" cltl2-view-function-definition t]
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
384 [ "View index" cltl2-view-index t] )))
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
385 ; perhaps an other Ilisp-Menu is there ?
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
386 ((not (null (car (find-menu-item current-menubar '("ILisp")))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
387 (add-submenu
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
388 '("Lisp")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
389 '("Browse CLtL2"
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
390 [ "View entry" cltl2-view-function-definition t]
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
391 [ "View index" cltl2-view-index t] )))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
392 ; or at least a Lisp-Menu ?
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
393 ((not (null (car (find-menu-item current-menubar '("Lisp")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
394 (add-submenu
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
395 '("Lisp")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
396 '("Browse CLtL2"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
397 [ "View entry" cltl2-view-function-definition t]
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
398 [ "View index" cltl2-view-index t] )))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
399 )
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
400
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
401 (add-hook 'lisp-mode-hook 'cltl2-lisp-mode-install)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
402 (add-hook 'ilisp-mode-hook 'cltl2-lisp-mode-install)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
403
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
404 ;;; Providing ourself.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
405 (provide 'ilisp-browse-cltl2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
406 ;;; browse-cltl2.el ends here.