Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!sun-barr!newstop!sun!rberlin From: rberlin@birdland.sun.com (Rich Berlin) Newsgroups: gnu.emacs Subject: Re: MANPATH Message-ID: Date: 2 Dec 89 02:00:23 GMT References: <8911212118.AA29799@sn1987a.compass.com> Sender: news@sun.Eng.Sun.COM Distribution: gnu Organization: Sun Microsystems Lines: 49 In-reply-to: compass!worley@EDDIE.MIT.EDU's message of 21 Nov 89 21:18:22 GMT This ought to fill the bill. -- Rich ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; manpath.el --- find /cat? directories using MANPATH environment variable. ;; Author : Rich Berlin ;; Created On : Thu Sep 1 16:52:15 1988 ;; Last Modified By: Rich Berlin ;; Last Modified On: Thu Nov 16 16:25:17 1989 ;; Update Count : 5 ;; Status : In daily use, probably OK. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; This is a handy way to keep up-to-date with the MANPATH in your .cshrc. ;; I use this by loading this file, and then doing ;; (setq manual-formatted-dirlist (search-manpath-for-cat-directories)) ;; ;; Of some interest is csh-path-to-list, which you may want to use ;; for other purposes. (defun search-manpath-for-cat-directories () "Return a list of all 'cat' directories in the current path specified\n\ by the 'MANPATH' environment variable." (search-path-for-files-matching (csh-path-to-list (getenv "MANPATH")) "cat.+")) (defun csh-path-to-list (string) (if (null string) (setq string "/usr/man")) (let ((path nil) index) (while (setq index (string-match ":" string)) (setq path (append path (list (substring string 0 index)))) (setq string (substring string (1+ index)))) (setq path (append path (list string))))) (defun search-path-for-files-matching (path regexp) (if (null path) (list regexp) (let (curr-dir directory-list) (setq regexp (format "^%s$" regexp)) ; So files MATCH regexp, instead (while path ; of just CONTAINING regexp. (setq curr-dir (car path)) (setq path (cdr path)) (if (file-exists-p curr-dir) (setq directory-list (append directory-list (directory-files curr-dir t regexp))))) directory-list))) Brought to you by Super Global Mega Corp .com