home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / misc / my-info.el < prev    next >
Encoding:
Text File  |  1990-07-22  |  1.9 KB  |  57 lines

  1. ;From utkcs2!emory!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!dftsrv!setzer Tue Jul  3 07:51:11 EDT 1990
  2. ;Article 4559 of comp.emacs:
  3. ;Path: utkcs2!emory!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!dftsrv!setzer
  4. ;>From: setzer@nails.gsfc.nasa.gov (William Setzer)
  5. ;Newsgroups: comp.emacs
  6. ;Subject: A tiny info front end
  7. ;Message-ID: <SETZER.90Jul2180819@nails.gsfc.nasa.gov>
  8. ;Date: 2 Jul 90 22:08:19 GMT
  9. ;Sender: news@dftsrv.gsfc.nasa.gov
  10. ;Organization: Goddard Space Flight Center
  11. ;Lines: 42
  12. ;
  13. ;I have written a tiny front end to info that allows you to view
  14. ;info files that are not in the system path.  I post it for two
  15. ;reasons -- first, I hope it will be of use to others; and
  16. ;secondly, I would like comments on it, as I believe it needs
  17. ;some improvements (most notably, it needs some way to recognize
  18. ;the validity of info format files -- try ^U - M-x my-info on
  19. ;a file that is not in info format).
  20. ;
  21. ;8<-8<- Cut 8<-8<-
  22. ;  A tiny front end to info.
  23.  
  24. (defvar original-Info-directory Info-directory
  25.   "Holds the pathname to the system's info tree.")
  26.  
  27. (defun my-info (&optional arg)
  28.   "Enter Info, the documentation browser.  With positive argument,
  29. prompt for directory containing 'dir' file.  With argument of zero,
  30. use system default info directory.  With negative argument,
  31. prompt for file in info format."
  32.   (interactive "P")
  33.   (and arg (setq arg (prefix-numeric-value arg)))
  34.   (cond
  35.    ((null arg)
  36.     (info))
  37.    ((> arg 0)
  38.     (setq Info-directory (read-file-name "Info directory: "
  39.                      nil default-directory 0))
  40.     (Info-directory))
  41.    ((= arg 0)
  42.     (setq Info-directory original-Info-directory)
  43.     (Info-directory))
  44.    ((< arg 0)
  45.     (Info-find-node (read-file-name "Info filename: "
  46.                     nil default-directory 0) "Top"))
  47.    (t (message "Wow!  Trichotomy doesn't exist!"))))
  48.      
  49. (global-set-key "\C-hi" 'my-info)
  50.  
  51. ;8<-8<- Cut 8<-8<-
  52. ;--
  53. ;William Setzer
  54. ;setzer@nails.gsfc.nasa.gov
  55.  
  56.  
  57.