comparison lisp/utils/browse-cltl2.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents 8fc7fe29b841
children
comparison
equal deleted inserted replaced
23:0edd3412f124 24:4103f0995bd7
1 ; -*- Mode: Emacs-Lisp -*- 1 ; -*- Mode: Emacs-Lisp -*-
2 ;;; browse-cltl2.el --- browse the hypertext-version of 2 ;;; browse-cltl2.el --- browse the hypertext-version of
3 ;;; "Common Lisp the Language, 2nd. Edition" 3 ;;; "Common Lisp the Language, 2nd. Edition"
4 4
5 ;; Revision 1.1.1 5 ;; Revision 1.1.2
6 ;; last edited on 29.1.1997 6 ;; last edited on 18.2.1997
7 7
8 ;; Copyright (C) 1997 Holger Schauer 8 ;; Copyright (C) 1997 Holger Schauer
9 9
10 ;; Author: Holger Schauer <Holger.Schauer@gmd.de> 10 ;; Author: Holger Schauer <Holger.Schauer@gmd.de>
11 ;; Keywords: utils lisp ilisp 11 ;; Keywords: utils lisp ilisp www
12 12
13 ;; This file is not part of Emacs. 13 ;; This file is not part of Emacs.
14 14
15 ;; Developed under XEmacs 19.14. Also tested on Emacs 19.32 and 15 ;; Developed under XEmacs 19.14. Also tested on Emacs 19.32 and
16 ;; XEmacs 19.11. Should work with newer versions, too. 16 ;; XEmacs 19.11. Should work with newer versions, too.
91 ;; 29-01-97 HS: included conditionalized versions of the required 91 ;; 29-01-97 HS: included conditionalized versions of the required
92 ;; functions match-string and buffer-live-p. 92 ;; functions match-string and buffer-live-p.
93 ;; Suggested by Simon Marshall <Simon.Marshall@esrin.esa.it>. 93 ;; Suggested by Simon Marshall <Simon.Marshall@esrin.esa.it>.
94 ;; Included new variable *cltl2-use-url* with which one can 94 ;; Included new variable *cltl2-use-url* with which one can
95 ;; specify if he has url.el or not. Introduced variable 95 ;; specify if he has url.el or not. Introduced variable
96 ;; *cltl2-old-find-file-noselect*. 96 ;; *cltl2-old-find-file-noselect*.
97 ;;
98 ;; 05-02-97 HS: added two variables for the key-bindings,
99 ;; *cltl2-vfd-key* *cltl2-vi-key*.
100 ;;
101 ;; 18-02-97 HS: use compatible keybindings that work on Gnu Emacs and XEmacs.
102 ;; Made cltl2-lisp-mode-install an interactive function.
97 (defvar *cltl2-use-url* 'nil 103 (defvar *cltl2-use-url* 'nil
98 "Enables or disables retrieval of the index-file via WWW (or more 104 "Enables or disables retrieval of the index-file via WWW (or more
99 exactly by the use of the function url-retrieve from url.el). 105 exactly by the use of the function url-retrieve from url.el).
100 Default is 't.") 106 Default is 't.")
101 107
165 "Older versions of Emacs (at least XEmacs 19.11) don't support the 171 "Older versions of Emacs (at least XEmacs 19.11) don't support the
166 option RAWFILE with the function FIND-FILE-NO-SELECT. Set this variable 172 option RAWFILE with the function FIND-FILE-NO-SELECT. Set this variable
167 to 't if you have such an old version. It will cause fontification and 173 to 't if you have such an old version. It will cause fontification and
168 other useless stuff on the buffer in which the index is fetched. If 174 other useless stuff on the buffer in which the index is fetched. If
169 you don't use a local copy (of the index) this won't bother you.") 175 you don't use a local copy (of the index) this won't bother you.")
176
177 (defvar *cltl2-vfd-key*
178 (if (featurep 'ilisp)
179 '[(control z) h]
180 '[(control c) b])
181 "Shortcut for accessing cltl2-view-function-definition. Use meaningful
182 setting with Ilisp.")
183
184 (defvar *cltl2-vi-key*
185 (if (featurep 'ilisp)
186 '[(control z) H]
187 '[(control c) B])
188 "Shortcut for accessing cltl2-view-index. Use meaningful
189 setting with Ilisp.")
170 190
171 (defvar *browse-cltl2-ht* (make-hash-table 0)) 191 (defvar *browse-cltl2-ht* (make-hash-table 0))
172 (defconst *cltl2-search-regexpr* 192 (defconst *cltl2-search-regexpr*
173 "<a href=\"\\(.+\\)\"><code>\\(.+\\)</code></a>" 193 "<a href=\"\\(.+\\)\"><code>\\(.+\\)</code></a>"
174 "A regular expression how to check for entries in the index-file 194 "A regular expression how to check for entries in the index-file
342 362
343 ;;; ****************************** 363 ;;; ******************************
344 ;;; Hooking into lisp mode and ilisp-mode 364 ;;; Hooking into lisp mode and ilisp-mode
345 ;;; ****************************** 365 ;;; ******************************
346 (defun cltl2-lisp-mode-install () 366 (defun cltl2-lisp-mode-install ()
347 "Not to be called by the user - just for lisp-mode-hook and ilisp-mode-hook. 367 "Adds browse-cltl2 to lisp-mode. If you use ilisp (installed via a hook
348 368 on lisp-mode) add browse-cltl2 to ilisp. Check the variables *cltl2-vfd-key*
349 Adds browse-cltl2 to lisp-mode. If you use ilisp (installed via a hook 369 and *cltl2-vi-key* for the keybindings. Under XEmacs we will add ourself to
350 on lisp-mode) add browse-cltl2 to ilisp. Under Ilisp we use C-zb and C-zB 370 the corresponding menus if there exists one."
351 and without Ilisp we use C-cb and C-cB for calling the cltl2-view-functions. 371 (interactive)
352 Under XEmacs we will add ourself to the corresponding menus if there exists
353 one.."
354 ; set key bindings 372 ; set key bindings
355 (cond ((featurep 'ilisp) 373 (local-set-key *cltl2-vfd-key* 'cltl2-view-function-definition)
356 (local-set-key "\C-zb" 'cltl2-view-function-definition) 374 (local-set-key *cltl2-vi-key* 'cltl2-view-index)
357 (local-set-key "\C-zB" 'cltl2-view-index))
358 (t
359 (local-set-key "\C-cb" 'cltl2-view-function-definition)
360 (local-set-key "\C-cB" 'cltl2-view-index)))
361 ; under XEmacs hook ourself into the menu if there is one 375 ; under XEmacs hook ourself into the menu if there is one
362 (when (string-match "XEmacs\\|Lucid" emacs-version) 376 (when (string-match "XEmacs\\|Lucid" emacs-version)
363 ; this is for the menu as provided by ilisp-easy-menu 377 (cond ((and (featurep 'ilisp-easy-menu)
364 (cond ((not (null (car (find-menu-item current-menubar '("ILisp"))))) 378 ; this is for the menu as provided by ilisp-easy-menu
379 (not (null (car (find-menu-item current-menubar '("ILisp"))))))
365 (add-submenu 380 (add-submenu
366 '("ILisp" "Documentation") 381 '("ILisp" "Documentation")
367 '("Browse CLtL2" 382 '("Browse CLtL2"
368 [ "View entry" cltl2-view-function-definition t] 383 [ "View entry" cltl2-view-function-definition t]
369 [ "View index" cltl2-view-index t] ))) 384 [ "View index" cltl2-view-index t] )))
385 ; perhaps an other Ilisp-Menu is there ?
386 ((not (null (car (find-menu-item current-menubar '("ILisp")))))
387 (add-submenu
388 '("Lisp")
389 '("Browse CLtL2"
390 [ "View entry" cltl2-view-function-definition t]
391 [ "View index" cltl2-view-index t] )))
392 ; or at least a Lisp-Menu ?
370 ((not (null (car (find-menu-item current-menubar '("Lisp"))))) 393 ((not (null (car (find-menu-item current-menubar '("Lisp")))))
371 (add-submenu 394 (add-submenu
372 '("Lisp") 395 '("Lisp")
373 '("Browse CLtL2" 396 '("Browse CLtL2"
374 [ "View entry" cltl2-view-function-definition t] 397 [ "View entry" cltl2-view-function-definition t]