]> code.delx.au - gnu-emacs/blob - lisp/paths.el
Add coding cookie
[gnu-emacs] / lisp / paths.el
1 ;;; paths.el --- define pathnames for use by various Emacs commands
2
3 ;; Copyright (C) 1986, 1988, 1994, 1999-2012 Free Software Foundation, Inc.
4
5 ;; Maintainer: FSF
6 ;; Keywords: internal
7 ;; Package: emacs
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24 ;;; Commentary:
25
26 ;; These are default settings for names of certain files and directories
27 ;; that Emacs needs to refer to from time to time.
28
29 ;; If these settings are not right, override them with `setq'
30 ;; in site-init.el. Do not change this file.
31
32 ;;; Code:
33
34 ;; This is a defcustom largely so that we can get the benefit
35 ;; of custom-initialize-delay. Perhaps it would work to make it a
36 ;; defvar and explicitly give it a standard-value property, and
37 ;; call custom-initialize-delay on it.
38 (defcustom Info-default-directory-list
39 (let* ((config-dir
40 (file-name-as-directory
41 ;; Self-contained NS build with info/ in the app-bundle.
42 (or (and (featurep 'ns)
43 (let ((dir (expand-file-name "../info" data-directory)))
44 (if (file-directory-p dir) dir)))
45 configure-info-directory)))
46 (prefixes
47 ;; Directory trees in which to look for info subdirectories
48 (prune-directory-list '("/usr/local/" "/usr/" "/opt/" "/")))
49 (suffixes
50 ;; Subdirectories in each directory tree that may contain info
51 ;; directories. Most of these are rather outdated.
52 ;; It ought to be fine to stop checking the "emacs" ones now,
53 ;; since this is Emacs and we have not installed info files
54 ;; into such directories for a looong time...
55 '("share/" "" "gnu/" "gnu/lib/" "gnu/lib/emacs/"
56 "emacs/" "lib/" "lib/emacs/"))
57 (standard-info-dirs
58 (apply #'nconc
59 (mapcar (lambda (pfx)
60 (let ((dirs
61 (mapcar (lambda (sfx)
62 (concat pfx sfx "info/"))
63 suffixes)))
64 (prune-directory-list dirs)))
65 prefixes)))
66 ;; If $(prefix)/share/info is not one of the standard info
67 ;; directories, they are probably installing an experimental
68 ;; version of Emacs, so make sure that experimental version's Info
69 ;; files override the ones in standard directories.
70 (dirs
71 (if (member config-dir standard-info-dirs)
72 ;; FIXME? What is the point of adding it again at the end
73 ;; when it is already present earlier in the list?
74 (nconc standard-info-dirs (list config-dir))
75 (cons config-dir standard-info-dirs))))
76 (if (not (eq system-type 'windows-nt))
77 dirs
78 ;; Include the info directory near where Emacs executable was installed.
79 (let* ((instdir (file-name-directory invocation-directory))
80 (dir1 (expand-file-name "../info/" instdir))
81 (dir2 (expand-file-name "../../../info/" instdir)))
82 (cond ((file-exists-p dir1) (append dirs (list dir1)))
83 ((file-exists-p dir2) (append dirs (list dir2)))
84 (t dirs)))))
85
86 "Default list of directories to search for Info documentation files.
87 They are searched in the order they are given in the list.
88 Therefore, the directory of Info files that come with Emacs
89 normally should come last (so that local files override standard ones),
90 unless Emacs is installed into a non-standard directory. In the latter
91 case, the directory of Info files that come with Emacs should be
92 first in this list.
93
94 Once Info is started, the list of directories to search
95 comes from the variable `Info-directory-list'.
96 This variable `Info-default-directory-list' is used as the default
97 for initializing `Info-directory-list' when Info is started, unless
98 the environment variable INFOPATH is set.
99
100 Although this is a customizable variable, that is mainly for technical
101 reasons. Normally, you should either set INFOPATH or customize
102 `Info-additional-directory-list', rather than changing this variable."
103 :initialize 'custom-initialize-delay
104 :type '(repeat directory)
105 :group 'info)
106
107
108 ;;; paths.el ends here