comparison lisp/paths.el @ 30019:918a23f7ac93

(prune-directory-list): New function. (Info-default-directory-list): Rewritten to more methodically enumerate a big list of possible info directories (based on the list used by the standalone info reader).
author Miles Bader <miles@gnu.org>
date Tue, 04 Jul 2000 04:48:49 +0000
parents 6fd90e67194f
children 6620d0fff158
comparison
equal deleted inserted replaced
30018:c7243fc7bcb6 30019:918a23f7ac93
1 ;;; paths.el --- define pathnames for use by various Emacs commands. 1 ;;; paths.el --- define pathnames for use by various Emacs commands.
2 2
3 ;; Copyright (C) 1986, 1988, 1994, 1999 Free Software Foundation, Inc. 3 ;; Copyright (C) 1986, 1988, 1994, 1999, 2000 Free Software Foundation, Inc.
4 4
5 ;; Maintainer: FSF 5 ;; Maintainer: FSF
6 ;; Keywords: internal 6 ;; Keywords: internal
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
34 34
35 ;; Docstrings in this file should, where reasonable, follow the 35 ;; Docstrings in this file should, where reasonable, follow the
36 ;; conventions described in bindings.el, so that they get put in the 36 ;; conventions described in bindings.el, so that they get put in the
37 ;; DOC file rather than in memory. 37 ;; DOC file rather than in memory.
38 38
39 (defun prune-directory-list (dirs &optional keep reject)
40 "Returns a copy of DIRS with all non-existant directories removed.
41 The optional argument KEEP is a list of directories to retain even if
42 they don't exist, and REJECT is a list of directories to remove from
43 DIRS, even if they exist; REJECT takes precedence over KEEP.
44
45 Note that membership in REJECT and KEEP is checked using simple string
46 comparision."
47 (apply #'nconc
48 (mapcar (lambda (dir)
49 (and (not (member dir reject))
50 (or (member dir keep) (file-directory-p dir))
51 (list dir)))
52 dirs)))
53
39 (defvar Info-default-directory-list 54 (defvar Info-default-directory-list
40 (let* ((start (list "/usr/local/lib/info/" 55 (let* ((config
41 ;; This comes second so that, if it is the same 56 (list (file-name-as-directory configure-info-directory)))
42 ;; as configure-info-directory (which is usually true) 57 (unpruned-prefixes
43 ;; and Emacs has been installed (also usually true) 58 ;; Directory trees that may not exist at installation time, and
44 ;; then the list will end with two copies of this; 59 ;; so shouldn't be pruned based on existance.
45 ;; which means that the last dir file Info-insert-dir 60 '("/usr/local/"))
46 ;; finds will be the one in this directory. 61 (prefixes
47 "/usr/local/info/")) 62 ;; Directory trees in which to look for info subdirectories
48 ;; Typically on a GNU system, installed info files are found 63 (prune-directory-list '("/usr/local/" "/usr/" "/opt/" "/")
49 ;; in /usr/info, but the default prefix is /usr/local. 64 unpruned-prefixes))
50 ;; (Standalone info has a long list of alternative 65 (suffixes
51 ;; directories to search; perhaps we should try to be more 66 ;; Subdirectories in each directory tree that may contain info
52 ;; consistent.) 67 ;; directories.
53 (usrdir "/usr/info") 68 '("" "share/" "gnu/" "gnu/lib/" "gnu/lib/emacs/"
54 (sysdir (and (file-directory-p usrdir) 69 "emacs/" "lib/" "lib/emacs/")))
55 (not (string= configure-info-directory usrdir)) 70 (nconc
56 (list usrdir))) 71 (apply #'nconc
57 (configdir (file-name-as-directory configure-info-directory))) 72 (mapcar (lambda (pfx)
58 ;; configdir comes last so that we can identify it as such, but we 73 (let ((dirs
59 ;; also we override sysdir, hence the two occurrences. 74 (mapcar (lambda (sfx) (concat pfx sfx "info/"))
60 (setq start (nconc start (list configdir) sysdir (list configdir))) 75 suffixes)))
61 start) 76 (if (member pfx unpruned-prefixes)
77 dirs
78 (prune-directory-list dirs config))))
79 prefixes))
80 config))
62 "Default list of directories to search for Info documentation files. 81 "Default list of directories to search for Info documentation files.
63 They are searched in the order they are given in the list. 82 They are searched in the order they are given in the list.
64 Therefore, the directory of Info files that come with Emacs 83 Therefore, the directory of Info files that come with Emacs
65 normally should come last (so that local files override standard ones). 84 normally should come last (so that local files override standard ones).
66 85