Commits

Anonymous committed 9f1c423

browse-cltl2.el-1.1.4, metamail concat fix

  • Participants
  • Parent commits af81fab

Comments (0)

Files changed (4)

+1998-05-18  Damon Lipparelli  <lipp@primus.com>
+
+	* metamail.el: (metamail-region): replace bogus use of `concat'.
+
+1998-06-01  SL Baur  <steve@altair.xemacs.org>
+
+	* browse-cltl2.el: Synch with v1.1.4.
+
 1998-04-05  Tomasz Cholewo  <tjchol01@mecca.spd.louisville.edu>
 
 	* webster-www.el (webster-www-thesaurus): New function.
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-VERSION = 1.05
+VERSION = 1.06
 AUTHOR_VERSION =
 MAINTAINER = XEmacs Development Team <xemacs-beta@xemacs.org>
 PACKAGE = net-utils

File browse-cltl2.el

 ;;; browse-cltl2.el --- browse the hypertext-version of 
 ;;;                     "Common Lisp the Language, 2nd. Edition"
 
-;; Revision 1.1.2
-;; last edited on 18.2.1997
+;; Revision 1.1.4
+;; last edited on 19.5.1998
 
-;; Copyright (C) 1997 Holger Schauer
+;; Copyright (C) 1997, 1998 Holger Schauer
 
-;; Author: Holger Schauer <Holger.Schauer@gmd.de>
+;; Author: Holger Schauer <Holger.Schauer@gmx.de>
 ;; Keywords: utils lisp ilisp www
 
-;; This file is not part of Emacs.
+;; This file is part of XEmacs.
 
-;; Developed under XEmacs 19.14. Also tested on Emacs 19.32 and
-;; XEmacs 19.11. Should work with newer versions, too.
+;; Developed under XEmacs 19.14. Also tested on Emacs 19.29, 19.32 
+;; and XEmacs 19.11, 19.16, 20.3. Should work with newer versions, too.
 ;; Required: browse-url.el
 ;; Recommended: url.el
 
 ;; CLtL2 (which you can get from the normal hypertext-version at CMU),
 ;; so you need to point *cltl2-local-file-pos* and *cltl2-index-file-name*
 ;; to the place where you put it.
-;; Old versions of Emacs (XEmacs 19.11 for example):
+;; Old versions of Emacs (Emacs 19.29 and XEmacs 19.11 for example):
 ;; When you want to use a local copy (or a local copy of the index file)
 ;; check the documentation on find-file-noselect. If it doesn't mention
 ;; an option called RAWFILE set *cltl2-old-find-file-noselect* to 't.
 ;;
 ;; 18-02-97 HS: use compatible keybindings that work on Gnu Emacs and XEmacs.
 ;;         Made cltl2-lisp-mode-install an interactive function.
+;;
+;; 28-02-98 HS: use symbol-near-point to obtain a default value to
+;;         search for and added a history for already searched entries.
+;;
+;; 22-04-98 HS: added an error message if index-file does not exist.
+;;
+;; 27-04-98 HS: fixed a bug with the minibuffer history. Thanks to
+;;          Sam Mikes <smikes@alumni.hmc.edu> for pointing out the
+;;          existance of `minibuffer-history-minimum-string-length'
+;;
+;; 19-05-98 HS: changed #' to (function ... in order to make it work
+;;          with older emacsen. `minibuffer-history-minimum-string-length'
+;;          is also unknown to older emacsen. `read-string' had only
+;;          two arguments in Emacs 19.29.
+
+
 (defvar *cltl2-use-url* 'nil
  "Enables or disables retrieval of the index-file via WWW (or more
  exactly by the use of the function url-retrieve from url.el).
   of CLtL2. Note that you have to modify this and the 
   prepare-get-entry*-functions if you want to change the search.")
 
+(defvar *browse-cltl2-history* nil
+  "History of CLtL2-entries to lookup.")
+
 ;;; ******************************
 ;;; First of all: Compatibility stuff
 ;;; ******************************
  present, it will not be moved."
   (add-menu menu-path (car submenu) (cdr submenu) before)))
 
+; stolen from XEmacs 19.15 syntax.el
+(if (not (fboundp (function symbol-near-point)))
+    (defun symbol-near-point ()
+      "Return the first textual item to the nearest point."
+      (interactive)
+	;alg stolen from etag.el
+      (save-excursion
+	(if (not (memq (char-syntax (preceding-char)) '(?w ?_)))
+	    (while (not (looking-at "\\sw\\|\\s_\\|\\'"))
+	      (forward-char 1)))
+	(while (looking-at "\\sw\\|\\s_")
+	  (forward-char 1))
+	(if (re-search-backward "\\sw\\|\\s_" nil t)
+	    (regexp-quote
+	     (progn (forward-char 1)
+		    (buffer-substring (point)
+				      (progn (forward-sexp -1)
+					     (while (looking-at "\\s'")
+					       (forward-char 1))
+					     (point)))))
+	  nil))))
+
+; needed for 19.11, I think
+(if (not (fboundp (function url-lazy-message)))
+  (defun url-lazy-message (&rest args)
+    "Just like `message', but is a no-op if called more than once a second.
+Will not do anything if url-show-status is nil."
+    (if (or (null url-show-status)
+	    (= url-lazy-message-time
+	       (setq url-lazy-message-time (nth 1 (current-time)))))
+	nil
+      (apply 'message args))))
+
 ; old find-file-noselect has no RAWFILE argument
 (if *cltl2-old-find-file-noselect*
     (unless (boundp 'cltl2-old-find-file-noselect-func)
       (setf (symbol-value 'cltl2-old-find-file-noselect-func)
 	    (symbol-function 'find-file-noselect))
       (setf (symbol-function 'find-file-noselect)
-	    #'(lambda (file &optional nowarn rawfile)
-		(funcall cltl2-old-find-file-noselect-func file nowarn)))))
+	    (function 
+	     (lambda (file &optional nowarn rawfile)
+	       (funcall cltl2-old-find-file-noselect-func file nowarn))))))
   
 ;;; ******************************
 ;;; Functions for fetching the index file
 ;; fetch methods
 (defun cltl2-fetch-index-by-file ()
   "Fetch the index from disk."
+  (if (not (file-readable-p *cltl2-index-home*))
+      (error "CLtL2 index file not readable: %s." *cltl2-index-home*))
+
   (setf *cltl2-index-buffer-name*
-	(find-file-noselect *cltl2-index-home* 'nil 't))
-)
+	(find-file-noselect *cltl2-index-home* 'nil 't)))
 
 (defun cltl2-fetch-index-by-www ()
  "Fetch the index via WWW."
   "First checks if function can be found in the CLtL2-index-file.
  If it can be found, uses the function browse-url to have a look
  at the corresponding documentation from CLtL2."
-  (interactive "sCLtL2-Entry to lookup:")
+  (interactive 
+   (let ((ol-hist-val (if (boundp 'minibuffer-history-minimum-string-length)
+			  minibuffer-history-minimum-string-length
+			nil))
+	 (entry-val nil))
+     (setq minibuffer-history-minimum-string-length nil)
+     (setq entry-val
+	   (list (read-from-minibuffer
+		  (concatenate 'string
+			       "CLtL2-Entry to lookup (default " 
+			       (symbol-near-point) "):")
+		  nil nil nil
+		  '*browse-cltl2-history*)))
+     (setq minibuffer-history-minimum-string-length ol-hist-val)
+     entry-val))
+	   
+  (cond ((equal "" entry)
+	 (setf entry (symbol-near-point))
+	 (setf *browse-cltl2-history*
+	       (push entry *browse-cltl2-history*))))
+
   (when (cltl2-index-unprepared-p)
     (cltl2-fetch-index))
   
  ; under XEmacs hook ourself into the menu if there is one
  (when (string-match "XEmacs\\|Lucid" emacs-version)
    (cond ((and (featurep 'ilisp-easy-menu)
-	       ;; this may be redundant:
-	       (featurep 'menubar)
 	       ; this is for the menu as provided by ilisp-easy-menu
 	       (not (null (car (find-menu-item current-menubar '("ILisp"))))))
 	  (add-submenu
 	(buffer-read-only nil)
 	(metafile (make-temp-name "/tmp/metamail"))
 	(option-environment
-	 (list (concat "EMACS_VIEW_MODE=" 
+	 (list (format "EMACS_VIEW_MODE=%s" 
 		       (if (numberp viewmode) viewmode 1)))))
     (save-excursion
       ;; Gee!  Metamail does not ouput to stdout if input comes from