Mercurial > emacs
comparison lisp/info.el @ 25145:784d7bc2a991
(info-initialize): New function.
(info): Call info-initialize.
(Info-directory-list): Initialize to nil,
so info-initialize will set it up for real.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 01 Aug 1999 12:17:46 +0000 |
parents | a78f0c2654d6 |
children | 5a57e11d78c9 |
comparison
equal
deleted
inserted
replaced
25144:edfd929009d5 | 25145:784d7bc2a991 |
---|---|
76 (defcustom Info-fontify-maximum-menu-size 30000 | 76 (defcustom Info-fontify-maximum-menu-size 30000 |
77 "*Maximum size of menu to fontify if `Info-fontify' is non-nil." | 77 "*Maximum size of menu to fontify if `Info-fontify' is non-nil." |
78 :type 'integer | 78 :type 'integer |
79 :group 'info) | 79 :group 'info) |
80 | 80 |
81 (defvar Info-directory-list | 81 (defvar Info-directory-list nil |
82 (let ((path (getenv "INFOPATH")) | |
83 (source (expand-file-name "info/" source-directory)) | |
84 (sibling (if installation-directory | |
85 (expand-file-name "info/" installation-directory))) | |
86 alternative) | |
87 (if path | |
88 (split-string path (regexp-quote path-separator)) | |
89 (if (and sibling (file-exists-p sibling)) | |
90 (setq alternative sibling) ; uninstalled, Emacs builddir != srcdir | |
91 (setq alternative source)) ; uninstalled, builddir != srcdir | |
92 (if (or (member alternative Info-default-directory-list) | |
93 (not (file-exists-p alternative)) | |
94 ;; On DOS/NT, we use movable executables always, | |
95 ;; and we must always find the Info dir at run time. | |
96 (if (or (eq system-type 'ms-dos) (eq system-type 'windows-nt)) | |
97 nil | |
98 ;; Use invocation-directory for Info only if we used it for | |
99 ;; exec-directory also. | |
100 (not (string= exec-directory | |
101 (expand-file-name "lib-src/" | |
102 installation-directory))))) | |
103 Info-default-directory-list | |
104 ;; `alternative' contains the Info files that came with this | |
105 ;; version, so we should look there first. `Info-insert-dir' | |
106 ;; currently expects to find `alternative' first on the list. | |
107 (cons alternative | |
108 (reverse (cdr (reverse Info-default-directory-list))))))) | |
109 "List of directories to search for Info documentation files. | 82 "List of directories to search for Info documentation files. |
110 nil means not yet initialized. In this case, Info uses the environment | 83 nil means not yet initialized. In this case, Info uses the environment |
111 variable INFOPATH to initialize it, or `Info-default-directory-list' | 84 variable INFOPATH to initialize it, or `Info-default-directory-list' |
112 if there is no INFOPATH variable in the environment. | 85 if there is no INFOPATH variable in the environment. |
113 The last element of `Info-default-directory-list' is the directory | 86 The last element of `Info-default-directory-list' is the directory |
149 (defvar Info-index-alternatives nil | 122 (defvar Info-index-alternatives nil |
150 "List of possible matches for last Info-index command.") | 123 "List of possible matches for last Info-index command.") |
151 | 124 |
152 (defvar Info-standalone nil | 125 (defvar Info-standalone nil |
153 "Non-nil if Emacs was started solely as an Info browser.") | 126 "Non-nil if Emacs was started solely as an Info browser.") |
154 | 127 |
155 (defvar Info-suffix-list | 128 (defvar Info-suffix-list |
156 ;; The MS-DOS list should work both when long file names are | 129 ;; The MS-DOS list should work both when long file names are |
157 ;; supported (Windows 9X), and when only 8+3 file names are available. | 130 ;; supported (Windows 9X), and when only 8+3 file names are available. |
158 (if (eq system-type 'ms-dos) | 131 (if (eq system-type 'ms-dos) |
159 '( (".gz" . "gunzip") | 132 '( (".gz" . "gunzip") |
263 (coding-system-for-write 'no-conversion) | 236 (coding-system-for-write 'no-conversion) |
264 (default-directory (or (file-name-directory fullname) | 237 (default-directory (or (file-name-directory fullname) |
265 default-directory))) | 238 default-directory))) |
266 (call-process-region (point-min) (point-max) decoder t t))) | 239 (call-process-region (point-min) (point-max) decoder t t))) |
267 (insert-file-contents fullname visit)))) | 240 (insert-file-contents fullname visit)))) |
241 | |
242 ;; Initialize Info-directory-list, if that hasn't been done yet. | |
243 (defun info-initialize () | |
244 (unless Info-directory-list | |
245 (let ((path (getenv "INFOPATH")) | |
246 (source (expand-file-name "info/" source-directory)) | |
247 (sibling (if installation-directory | |
248 (expand-file-name "info/" installation-directory))) | |
249 alternative) | |
250 (setq Info-directory-list | |
251 (if path | |
252 (split-string path (regexp-quote path-separator)) | |
253 (if (and sibling (file-exists-p sibling)) | |
254 ;; Uninstalled, Emacs builddir != srcdir. | |
255 (setq alternative sibling) | |
256 ;; Uninstalled, builddir == srcdir | |
257 (setq alternative source)) | |
258 (if (or (member alternative Info-default-directory-list) | |
259 (not (file-exists-p alternative)) | |
260 ;; On DOS/NT, we use movable executables always, | |
261 ;; and we must always find the Info dir at run time. | |
262 (if (memq system-type '(ms-dos windows-nt)) | |
263 nil | |
264 ;; Use invocation-directory for Info | |
265 ;; only if we used it for exec-directory also. | |
266 (not (string= exec-directory | |
267 (expand-file-name "lib-src/" | |
268 installation-directory))))) | |
269 Info-default-directory-list | |
270 ;; `alternative' contains the Info files that came with this | |
271 ;; version, so we should look there first. `Info-insert-dir' | |
272 ;; currently expects to find `alternative' first on the list. | |
273 (cons alternative | |
274 (reverse (cdr (reverse Info-default-directory-list)))))))))) | |
268 | 275 |
269 ;;;###autoload | 276 ;;;###autoload |
270 (defun info-other-window (&optional file) | 277 (defun info-other-window (&optional file) |
271 "Like `info' but show the Info buffer in another window." | 278 "Like `info' but show the Info buffer in another window." |
272 (interactive (if current-prefix-arg | 279 (interactive (if current-prefix-arg |
288 The search path for Info files is in the variable `Info-directory-list'. | 295 The search path for Info files is in the variable `Info-directory-list'. |
289 The top-level Info directory is made by combining all the files named `dir' | 296 The top-level Info directory is made by combining all the files named `dir' |
290 in all the directories in that path." | 297 in all the directories in that path." |
291 (interactive (if current-prefix-arg | 298 (interactive (if current-prefix-arg |
292 (list (read-file-name "Info file name: " nil nil t)))) | 299 (list (read-file-name "Info file name: " nil nil t)))) |
300 (info-initialize) | |
293 (if file | 301 (if file |
294 (progn | 302 (progn |
295 (pop-to-buffer "*info*") | 303 (pop-to-buffer "*info*") |
296 ;; If argument already contains parentheses, don't add another set | 304 ;; If argument already contains parentheses, don't add another set |
297 ;; since the argument will then be parsed improperly. This also | 305 ;; since the argument will then be parsed improperly. This also |
319 (error (send-string-to-terminal | 327 (error (send-string-to-terminal |
320 (format "%s\n" (if (eq (car-safe err) 'error) | 328 (format "%s\n" (if (eq (car-safe err) 'error) |
321 (nth 1 err) err))) | 329 (nth 1 err) err))) |
322 (save-buffers-kill-emacs))) | 330 (save-buffers-kill-emacs))) |
323 (info))) | 331 (info))) |
324 | 332 |
325 ;; See if the the accessible portion of the buffer begins with a node | 333 ;; See if the the accessible portion of the buffer begins with a node |
326 ;; delimiter, and the node header line which follows matches REGEXP. | 334 ;; delimiter, and the node header line which follows matches REGEXP. |
327 ;; Typically, this test will be followed by a loop that examines the | 335 ;; Typically, this test will be followed by a loop that examines the |
328 ;; rest of the buffer with (search-forward "\n\^_"), and it's a pity | 336 ;; rest of the buffer with (search-forward "\n\^_"), and it's a pity |
329 ;; to have the overhead of this special test inside the loop. | 337 ;; to have the overhead of this special test inside the loop. |