[comp.emacs] A tiny info front end

setzer@nails.gsfc.nasa.gov (William Setzer) (07/03/90)

I have written a tiny front end to info that allows you to view
info files that are not in the system path.  I post it for two
reasons -- first, I hope it will be of use to others; and
secondly, I would like comments on it, as I believe it needs
some improvements (most notably, it needs some way to recognize
the validity of info format files -- try ^U - M-x my-info on
a file that is not in info format).

8<-8<- Cut 8<-8<-
;  A tiny front end to info.

(defvar original-Info-directory Info-directory
  "Holds the pathname to the system's info tree.")

(defun my-info (&optional arg)
  "Enter Info, the documentation browser.  With positive argument,
prompt for directory containing 'dir' file.  With argument of zero,
use system default info directory.  With negative argument,
prompt for file in info format."
  (interactive "P")
  (and arg (setq arg (prefix-numeric-value arg)))
  (cond
   ((null arg)
    (info))
   ((> arg 0)
    (setq Info-directory (read-file-name "Info directory: "
					 nil default-directory 0))
    (Info-directory))
   ((= arg 0)
    (setq Info-directory original-Info-directory)
    (Info-directory))
   ((< arg 0)
    (Info-find-node (read-file-name "Info filename: "
				    nil default-directory 0) "Top"))
   (t (message "Wow!  Trichotomy doesn't exist!"))))
	 
(global-set-key "\C-hi" 'my-info)

8<-8<- Cut 8<-8<-
--
William Setzer
setzer@nails.gsfc.nasa.gov