🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.misc.discuss
Article #2163

Re: texinfo

#2163
From: Simon E Spero
Date: Mon, 29 Oct 1990 17:46
396 lines
14813 bytes
In-reply-to: kdr@doc.ic.ac.uk's message of 27 Oct 90 19:11:39 GMT

In article <KDR.90Oct27201139@tcsun4.doc.ic.ac.uk> kdr@doc.ic.ac.uk (K D Rigotti) writes:

>In article <9010251319.AA01254@coyote.draper.com> mal%coyote.draper.com@RELAY.CS.NET (Mark Lamourine) writes:

>>>K D Rigotti <mcsun!ukc!icdoc!gould!kdr@uunet.uu.net> writes:

>>>  ... I use a locally hacked version of info.el that
>>>allows you to have multiple info file directories, with the result that mere
>>> mortals like me can install their own info files.  This is something that
>>> should be included in any 'upgraded' info reader, methinks.


> I did think of posting it but..

>1. The author (Simon Spero, sispero@cix.uucp) has now graduated and may (?)
>have net access so it would be good manners if nothing else to ask him first.

Gone but not forgotten! I about to mutate to something@technion.il, but 
sispero@cix.compulink.co.uk will reach me.

>2. As it stands it is just a bolt-on and could really do with tidying up so
>that it can actually replace the old one, I intend to do this when I get
>time...

Done! I just went through and added some stuff to handle multiple dir
files properly. See docs for details. At least I'm not the last IC
lisp hacker :-)

>To be honest I'm surprised Simon didn't post it himself, maybe he's shy :-)

It did go out about a year ago on the epoch mailing list as part of my
epoch-info package. The support hooks for this won't affect non-epoch 
users. There now follows diffs to info.el (version 18.55). All GPLed,
with the extra condition that these enhancements may not be used by 
any member of the Iraqi government or by any member of the Apple board
of directors, if not covered by the first clause. They are still free to
distribute , but use is prohibited until Saddam abandons Look
and Feel lawsuits, and Sculley withdraws from Kuwait. Or vice versa. 

Disclaimer: Not an official anything. It works for me. Hassle Kevin :-)
Manual:

To configure this package, set the variable Info-directory-list to 
a list directories containing info files. Each such directory should
have a 'dir' file containing only one node, which should itself
contain a menu. This menu will be extracted when info-directory is called.
This means that if you visit an info file, and want to return to the
directory, you should press 'd' instead of going up from the top node
of the file. Really ought to be fixed, but not really vital.

You may find it helpful to copy 'dir' from {}/emacs/info into
each of your info directories, and edit the menu there. Note that the 
preamble is taken from the first dir file found.

If you have any problems with the multiple dir files feature, you can revert
Info-directory to the 18.55 version, and simply have one big dir file 
covering all info files in all your Info directories. Info'll still find 
them; however you'll miss any new files unless you update your own dir.

Let me know if you find any bugs.
--- have fun --- 

	Simon

*** /usr/local/emacs/lisp/info.el	Wed Jul 27 04:44:58 1988
--- /home/albion/zmacx07/emacs/lisp/info.el	Mon Oct 29 16:12:09 1990
***************
*** 17,25 ****
  ;; can know your rights and responsibilities.  It should be in a
  ;; file named COPYING.  Among other things, the copyright notice
  ;; and this notice must be preserved on all copies.
  
! (provide 'info)
  
  (defvar Info-history nil
    "List of info nodes user has visited.
  Each element of list is a list (FILENAME NODENAME BUFFERPOS).")
--- 17,45 ----
  ;; can know your rights and responsibilities.  It should be in a
  ;; file named COPYING.  Among other things, the copyright notice
  ;; and this notice must be preserved on all copies.
+ ;;
+ ;; All rights to any enhancements made to this file by Simon E Spero are herewith 
+ ;; transferred to the Free Software Foundation. 
  
! ;; $Log:	info.el,v $
! ; Revision 1.2  89/10/17  00:34:15  zmacx07
! ; Added facility to use multiple paths.
! ; Added Info-expand-file-name.
! ; 
! ; Revision 1.3 90/01/24  13:11:59 zmacx07
! ; Added call to epoch-info-select-hooks in info-select
! ; 
! ; Revision 1.4 90/05/21  16:01:03 zmacx09
! ; Converted to epoch-3.1. Added call to epoch-info-startup-hooks in
! ; Info-find-node
!  
!  (provide 'info)
  
+ ;; If we are using epoch then  bung in the buttons (ses)
+ 
+ (if (boundp 'epoch::version)
+     (require 'epoch-info))
+ 
  (defvar Info-history nil
    "List of info nodes user has visited.
  Each element of list is a list (FILENAME NODENAME BUFFERPOS).")
***************
*** 31,44 ****
    "Non-nil allows Info to execute Lisp code associated with nodes.
  The Lisp code is executed when the node is selected.")
  
! (defvar Info-directory nil
!   "Default directory for Info documentation files.")
  
  (defvar Info-current-file nil
    "Info file that Info is now looking at, or nil.")
  
  (defvar Info-current-subfile nil
!   "Info subfile that is actually in the *info* buffer now,
  or nil if current info file is not split into subfiles.")
  
  (defvar Info-current-node nil
--- 51,68 ----
    "Non-nil allows Info to execute Lisp code associated with nodes.
  The Lisp code is executed when the node is selected.")
  
! (defvar  Info-directory nil
!   "The directory  to search  for info files
!    OBSOLETE. See Info-directory-list")
! (defvar Info-directory-list (list Info-directory)
!   "The list of directories to search through for info files
!    multi directory facility added by ses (sispero@cix.uucp (..!mcsun!ukc!slxsys!cix!sispero)")
  
  (defvar Info-current-file nil
    "Info file that Info is now looking at, or nil.")
  
  (defvar Info-current-subfile nil
!   "Info subfile that is actually in the info buffer now,
  or nil if current info file is not split into subfiles.")
  
  (defvar Info-current-node nil
***************
*** 51,58 ****
  (defun info ()
    "Enter Info, the documentation browser."
    (interactive)
!   (if (get-buffer "*info*")
!       (switch-to-buffer "*info*")
      (Info-directory)))
  
  ;; Go to an info node specified as separate filename and nodename.
--- 75,82 ----
  (defun info ()
    "Enter Info, the documentation browser."
    (interactive)
!   (if (get-buffer "info")
!       (switch-to-buffer "info")
      (Info-directory)))
  
  ;; Go to an info node specified as separate filename and nodename.
***************
*** 61,81 ****
  (defun Info-find-node (filename nodename &optional no-going-back)
    ;; Convert filename to lower case if not found as specified.
    ;; Expand it.
!   (if filename
!       (let (temp)
! 	(setq filename (substitute-in-file-name filename))
! 	(setq temp (expand-file-name filename
! 				     ;; Use Info's default dir
! 				     ;; unless the filename starts with `./'.
! 				     (if (not (string-match "^\\./" filename))
! 					 Info-directory)))
! 	(if (file-exists-p temp)
! 	    (setq filename temp)
! 	  (setq temp (expand-file-name (downcase filename) Info-directory))
! 	  (if (file-exists-p temp)
! 	      (setq filename temp)
! 	    (error "Info file %s does not exist"
! 		   (expand-file-name filename Info-directory))))))
    ;; Record the node we are leaving.
    (if (and Info-current-file (not no-going-back))
        (setq Info-history
--- 85,93 ----
  (defun Info-find-node (filename nodename &optional no-going-back)
    ;; Convert filename to lower case if not found as specified.
    ;; Expand it.
!   (setq filename (Info-expand-file-name filename))
! 	       
! 
    ;; Record the node we are leaving.
    (if (and Info-current-file (not no-going-back))
        (setq Info-history
***************
*** 82,88 ****
  	    (cons (list Info-current-file Info-current-node (point))
  		  Info-history)))
    ;; Go into info buffer.
!   (switch-to-buffer "*info*")
    (or (eq major-mode 'Info-mode)
        (Info-mode))
    (widen)
--- 94,101 ----
  	    (cons (list Info-current-file Info-current-node (point))
  		  Info-history)))
    ;; Go into info buffer.
!   (switch-to-buffer "info")
!   (run-hooks 'epoch-info-startup-hooks)
    (or (eq major-mode 'Info-mode)
        (Info-mode))
    (widen)
***************
*** 143,149 ****
  			;; If this is an indirect file,
  			;; determine which file really holds this node
  			;; and read it in.
! 			(if (not (eq (current-buffer) (get-buffer "*info*")))
  			    (setq guesspos
  				  (Info-read-subfile guesspos))))
  		    (error "No such node: \"%s\"" nodename))))
--- 156,162 ----
  			;; If this is an indirect file,
  			;; determine which file really holds this node
  			;; and read it in.
! 			(if (not (eq (current-buffer) (get-buffer "info")))
  			    (setq guesspos
  				  (Info-read-subfile guesspos))))
  		    (error "No such node: \"%s\"" nodename))))
***************
*** 187,199 ****
  	      (throw 'foo t))
  	  (setq lastfilename thisfilename)
  	  (setq lastfilepos thisfilepos))))
!     (set-buffer (get-buffer "*info*"))
      (or (equal Info-current-subfile lastfilename)
  	(let ((buffer-read-only nil))
  	  (setq buffer-file-name nil)
  	  (widen)
  	  (erase-buffer)
! 	  (insert-file-contents lastfilename)
  	  (set-buffer-modified-p nil)
  	  (setq Info-current-subfile lastfilename)))
      (goto-char (point-min))
--- 200,212 ----
  	      (throw 'foo t))
  	  (setq lastfilename thisfilename)
  	  (setq lastfilepos thisfilepos))))
!     (set-buffer (get-buffer "info"))
      (or (equal Info-current-subfile lastfilename)
  	(let ((buffer-read-only nil))
  	  (setq buffer-file-name nil)
  	  (widen)
  	  (erase-buffer)
! 	  (insert-file-contents (Info-expand-file-name lastfilename))
  	  (set-buffer-modified-p nil)
  	  (setq Info-current-subfile lastfilename)))
      (goto-char (point-min))
***************
*** 227,232 ****
--- 240,246 ----
  				  (setq active-expression
  					(read (current-buffer))))))
  			 (point-max)))
+      (run-hooks 'epoch-info-select-hooks)
       (if Info-enable-active-nodes (eval active-expression)))))
  
  (defun Info-set-mode-line ()
***************
*** 377,387 ****
      (Info-find-node filename nodename)
      (setq Info-history (cdr Info-history))
      (goto-char opoint)))
  
  (defun Info-directory ()
!   "Go to the Info directory node."
    (interactive)
!   (Info-find-node "dir" "top"))
  
  (defun Info-follow-reference (footnotename)
    "Follow cross reference named NAME to the node it refers to.
--- 391,426 ----
      (Info-find-node filename nodename)
      (setq Info-history (cdr Info-history))
      (goto-char opoint)))
+ (defun Info-grab-menu (file )
+ (let(
+      ( x (find-file-noselect file))
+      z
+      )
+ 	
+     (set-buffer x)
+     (search-forward "* Menu:"  nil t)
+     (beginning-of-line 2)
  
+     (setq z (buffer-substring  (point) (point-max)))
+     (set-buffer "info")
+     (goto-char (point-max))
+     (insert z)
+     (kill-buffer x)))
+ 
+ 
  (defun Info-directory ()
!   "Go to the Info directory node. Builds node from menus in all dir nodes it
! can find"
    (interactive)
!   (Info-find-node "dir" "top")
!   (toggle-read-only)
!   (save-excursion
!   (mapcar '(lambda (x) 
! 	     (Info-grab-menu x))
! 	  (cdr (Info-expand-file-name "dir" Info-directory-list t)))
!   (set-buffer-modified-p nil)
!   (toggle-read-only)
!   ))
  
  (defun Info-follow-reference (footnotename)
    "Follow cross reference named NAME to the node it refers to.
***************
*** 556,562 ****
    "Display a brief summary of all Info commands."
    (interactive)
    (save-window-excursion
!     (switch-to-buffer "*Help*")
      (erase-buffer)
      (insert (documentation 'Info-mode))
      (goto-char (point-min))
--- 595,601 ----
    "Display a brief summary of all Info commands."
    (interactive)
    (save-window-excursion
!     (switch-to-buffer "*Help*")
      (erase-buffer)
      (insert (documentation 'Info-mode))
      (goto-char (point-min))
***************
*** 696,698 ****
--- 735,773 ----
    (and (marker-position Info-tag-table-marker)
         (buffer-modified-p)
         (message "Tags may have changed.  Use Info-tagify if necessary")))
+ 
+ (defun filter (f l)
+   "Naive filter: returns f(x) for all x member l ,f(x) =/= nil"
+   (if (null l)
+       nil
+     (let ((x (funcall f (car l))))
+       (if x 
+ 	  (cons x (filter f (cdr l)))
+ 	(filter f (cdr l))))))
+ 
+ (defun Info-expand-file-name (filename &optional path return-all)
+   "Finds a file from within the directorys listed in Info-directory-list"
+ 
+ (if (not path) (setq path Info-directory-list))
+ (if filename
+       (let (temp the-list)
+ 	(setq filename (substitute-in-file-name filename))
+ 	(setq the-list (filter '(lambda (x)
+ 				  (Info-expand-one x filename))
+ 			       path))
+ 	    (if  return-all
+ 		the-list
+ 	    (if the-list
+ 		(car the-list)
+ 		(error "Info file %s does not exist" filename))))))
+ 
+ (defun Info-expand-one (dir filename)
+   (let (temp)
+     (setq temp (expand-file-name filename dir))
+     (if (file-exists-p temp)
+ 	temp
+       (progn
+ 	(setq temp (expand-file-name (downcase filename) x))
+ 	(if (file-exists-p temp)
+ 	    temp
+ 	 nil)))))





--
 sispero@compulink.cix.co.uk 		       ..!mcsun!ukc!slxsys!cix!sispero
------------------------------------------------------------------------------
The Poll Tax.    | Saddam Hussein runs     | +44-(0)81-500-3000 
I'm Not. Are you?| Lotus 123 on Apple Macs |"Read my lips. No Nuke Tactics"

--
 sispero@compulink.cix.co.uk 		       ..!mcsun!ukc!slxsys!cix!sispero
------------------------------------------------------------------------------
The Poll Tax.    | Saddam Hussein runs     | +44-(0)81-500-3000 
I'm Not. Are you?| Lotus 123 on Apple Macs |"Read my lips. No Nuke Tactics"
Technical Details
Message-ID: <ZMACX07.90Oct29174628@asun6.asunfs.doc.ic.ac.uk>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!ukc!icdoc!zmacx07
References: <KDR.90Oct27201139@tcsun4.doc.ic.ac.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 107729,e32ae2743cebc3fa,start
X-Google-Attributes: gid107729,public
X-Google-Thread: 1025b4,80c2b24a20ce851b
X-Google-Attributes: gid1025b4,public
X-Google-ArrivalTime: 1990-10-29 09:46:28 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!ukc!icdoc!zmacx07
From: zmacx07@asunfs.doc.ic.ac.uk (Simon E Spero)
Newsgroups: gnu.misc.discuss,gnu.emacs.sources
Subject: Re: texinfo
Message-ID: <ZMACX07.90Oct29174628@asun6.asunfs.doc.ic.ac.uk>
Date: 29 Oct 90 17:46:28 GMT
References: <KDR.90Oct27201139@tcsun4.doc.ic.ac.uk>
Sender: news@doc.ic.ac.uk
Distribution: gnu
Organization: The Society of the Department of Computing, Imperial College
Lines: 396
Posted: Mon Oct 29 18:46:28 1990
In-reply-to: kdr@doc.ic.ac.uk's message of 27 Oct 90 19:11:39 GMT