Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!bird.agharta.DE!not-for-mail From: e...@agharta.de (Dr. Edmund Weitz) Newsgroups: comp.lang.lisp Subject: Re: format question Date: 01 Dec 2001 08:41:12 +0100 Lines: 137 Sender: e...@bird.agharta.de Message-ID: References: <9u3rgt$l5k$0@216.39.145.192> NNTP-Posting-Host: bird.agharta.de (62.159.208.85) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: fu-berlin.de 1007192483 7470647 62.159.208.85 (16 [15706]) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 e...@agharta.de (Dr. Edmund Weitz) writes: > I include a quick fix with this article (see below). Er, here's an improved version. It was too late yesterday... :) Edi. ;;; hyperspec.el --- Browse documentation from the Common Lisp HyperSpec ;; Copyright 1997 Naggum Software ;; Author: Erik Naggum ;; Keywords: lisp ;; This file is not part of GNU Emacs, but distributed under the same ;; conditions as GNU Emacs, and is useless without GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; Kent Pitman and the Harlequin Group have made the text of American ;; National Standard for Information Technology -- Programming Language -- ;; Common Lisp, ANSI X3.226-1994 available on the WWW, in the form of the ;; Common Lisp HyperSpec. This package makes it convenient to peruse this ;; documentation from within Emacs. ;;; Code: (require 'cl) (require 'browse-url) ;you need the Emacs 20 version (require 'thingatpt) (defvar common-lisp-hyperspec-root "http://www.xanalys.com/software_tools/reference/HyperSpec/" "The root of the Common Lisp HyperSpec URL. If you copy the HyperSpec to your local system, set this variable to something like \"file:/usr/local/doc/HyperSpec/\".") ;;; Added variable for CLHS symbol table. See details below. ;;; ;;; 20011201 Edi Weitz (defvar common-lisp-hyperspec-symbol-table "/usr/local/lib/LispWorksPersonal/lib/4-1-0-0/manual/online/web/CLHS/Data/Map_Sym.txt" "The HyperSpec symbol table file. Must be a local file.") (defvar common-lisp-hyperspec-history nil "History of symbols looked up in the Common Lisp HyperSpec.") ;;if only we had had packages or hash tables..., but let's fake it. (defvar common-lisp-hyperspec-symbols (make-vector 67 0)) ;;; Removed facility for multiple definition because the symbol table ;;; has only one entry per SYMBOL-NAME ;;; ;;; 20011201 Edi Weitz (defun common-lisp-hyperspec (symbol-name) "View the documentation on SYMBOL-NAME from the Common Lisp HyperSpec. The Common Lisp HyperSpec is the full ANSI Standard Common Lisp, provided by Kent Pitman and the Harlequin Group. By default, the Harlequin WWW site is visited to retrieve the information. The Harlequin Group allows you to transfer the entire Common Lisp HyperSpec to your own site under certain conditions. Visit http://www.harlequin.com/books/HyperSpec/ for more information. If you copy the HyperSpec to another location, customize the variable `common-lisp-hyperspec-root' to point to that location." (interactive (list (let ((symbol-at-point (thing-at-point 'symbol))) (if (and symbol-at-point (intern-soft (downcase symbol-at-point) common-lisp-hyperspec-symbols)) symbol-at-point (completing-read "Look up symbol in Common Lisp HyperSpec: " common-lisp-hyperspec-symbols #'boundp t symbol-at-point 'common-lisp-hyperspec-history))))) (browse-url (concat common-lisp-hyperspec-root "Body/" (let ((symbol (intern-soft (downcase symbol-name) common-lisp-hyperspec-symbols))) (if (and symbol (boundp symbol)) (symbol-value symbol) (error "The symbol `%s' is not defined in Common Lisp" symbol-name)))))) ;;; Added the following just to provide a common entry point according ;;; to the various 'hyperspec' implementations. ;;; ;;; 19990820 Marco Antoniotti (eval-when (load eval) (setf (symbol-function 'hyperspec-lookup) (symbol-function 'common-lisp-hyperspec))) ;;; Replaced hard-coded look-up table with loop through CLHS symbol table ;;; after reading KMP's posting to comp.lang.lisp: ;;; ;;; ;;; 20011201 Edi Weitz (let ((index-buffer (find-file-noselect common-lisp-hyperspec-symbol-table))) (labels ((one-item () (delete ?\n (delete ?\r (thing-at-point 'line))))) (save-excursion (set-buffer index-buffer) (goto-char (point-min)) (while (< (point) (point-max)) (let ((symbol (intern (downcase (one-item)) common-lisp-hyperspec-symbols)) relative-url) (forward-line) (setq relative-url (one-item)) (forward-line) (set symbol (subseq relative-url (1+ (position ?\/ relative-url :from-end t))))))))) (provide 'hyperspec) ;;; hyperspec.el ends here