diff options
| author | Stefan Monnier | 2003-04-21 17:40:19 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-04-21 17:40:19 +0000 |
| commit | 3a59b662bd36a14d60070287b2f2ec4c22c03568 (patch) | |
| tree | 1f38a17cd1ece55675e0726b513a1b349727423b | |
| parent | 9bcdf9a8fdae9bf6128fd45454ff1f0c785d5da2 (diff) | |
| download | emacs-3a59b662bd36a14d60070287b2f2ec4c22c03568.tar.gz emacs-3a59b662bd36a14d60070287b2f2ec4c22c03568.zip | |
(Info-default-dirs): New fun extracted from Info-initialize.
(info-initialize): Use it. Obey the "final :" convention for INFOPATH.
| -rw-r--r-- | lisp/info.el | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/lisp/info.el b/lisp/info.el index b93c980361e..722f1b94e40 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -336,51 +336,59 @@ Do the right thing if the file has been compressed or zipped." | |||
| 336 | (car decoder) t t nil (cdr decoder)))) | 336 | (car decoder) t t nil (cdr decoder)))) |
| 337 | (insert-file-contents fullname visit)))) | 337 | (insert-file-contents fullname visit)))) |
| 338 | 338 | ||
| 339 | (defun Info-default-dirs () | ||
| 340 | (let ((source (expand-file-name "info/" source-directory)) | ||
| 341 | (sibling (if installation-directory | ||
| 342 | (expand-file-name "info/" installation-directory) | ||
| 343 | (if invocation-directory | ||
| 344 | (let ((infodir (expand-file-name | ||
| 345 | "../info/" | ||
| 346 | invocation-directory))) | ||
| 347 | (if (file-exists-p infodir) | ||
| 348 | infodir | ||
| 349 | (setq infodir (expand-file-name | ||
| 350 | "../../../info/" | ||
| 351 | invocation-directory)) | ||
| 352 | (and (file-exists-p infodir) | ||
| 353 | infodir)))))) | ||
| 354 | alternative) | ||
| 355 | (setq alternative | ||
| 356 | (if (and sibling (file-exists-p sibling)) | ||
| 357 | ;; Uninstalled, Emacs builddir != srcdir. | ||
| 358 | sibling | ||
| 359 | ;; Uninstalled, builddir == srcdir | ||
| 360 | source)) | ||
| 361 | (if (or (member alternative Info-default-directory-list) | ||
| 362 | ;; On DOS/NT, we use movable executables always, | ||
| 363 | ;; and we must always find the Info dir at run time. | ||
| 364 | (if (memq system-type '(ms-dos windows-nt)) | ||
| 365 | nil | ||
| 366 | ;; Use invocation-directory for Info | ||
| 367 | ;; only if we used it for exec-directory also. | ||
| 368 | (not (string= exec-directory | ||
| 369 | (expand-file-name "lib-src/" | ||
| 370 | installation-directory)))) | ||
| 371 | (not (file-exists-p alternative))) | ||
| 372 | Info-default-directory-list | ||
| 373 | ;; `alternative' contains the Info files that came with this | ||
| 374 | ;; version, so we should look there first. `Info-insert-dir' | ||
| 375 | ;; currently expects to find `alternative' first on the list. | ||
| 376 | (cons alternative | ||
| 377 | (reverse (cdr (reverse Info-default-directory-list))))))) | ||
| 378 | |||
| 339 | (defun info-initialize () | 379 | (defun info-initialize () |
| 340 | "Initialize `Info-directory-list', if that hasn't been done yet." | 380 | "Initialize `Info-directory-list', if that hasn't been done yet." |
| 341 | (unless Info-directory-list | 381 | (unless Info-directory-list |
| 342 | (let ((path (getenv "INFOPATH")) | 382 | (let ((path (getenv "INFOPATH"))) |
| 343 | (source (expand-file-name "info/" source-directory)) | ||
| 344 | (sibling (if installation-directory | ||
| 345 | (expand-file-name "info/" installation-directory) | ||
| 346 | (if invocation-directory | ||
| 347 | (let ((infodir (expand-file-name | ||
| 348 | "../info/" | ||
| 349 | invocation-directory))) | ||
| 350 | (if (file-exists-p infodir) | ||
| 351 | infodir | ||
| 352 | (setq infodir (expand-file-name | ||
| 353 | "../../../info/" | ||
| 354 | invocation-directory)) | ||
| 355 | (and (file-exists-p infodir) | ||
| 356 | infodir)))))) | ||
| 357 | alternative) | ||
| 358 | (setq Info-directory-list | 383 | (setq Info-directory-list |
| 359 | (prune-directory-list | 384 | (prune-directory-list |
| 360 | (if path | 385 | (if path |
| 361 | (split-string path (regexp-quote path-separator)) | 386 | (if (string-match ":\\'" path) |
| 362 | (if (and sibling (file-exists-p sibling)) | 387 | (append (split-string (substring path 0 -1) |
| 363 | ;; Uninstalled, Emacs builddir != srcdir. | 388 | (regexp-quote path-separator)) |
| 364 | (setq alternative sibling) | 389 | (Info-default-dirs)) |
| 365 | ;; Uninstalled, builddir == srcdir | 390 | (split-string path (regexp-quote path-separator))) |
| 366 | (setq alternative source)) | 391 | (Info-default-dirs))))))) |
| 367 | (if (or (member alternative Info-default-directory-list) | ||
| 368 | ;; On DOS/NT, we use movable executables always, | ||
| 369 | ;; and we must always find the Info dir at run time. | ||
| 370 | (if (memq system-type '(ms-dos windows-nt)) | ||
| 371 | nil | ||
| 372 | ;; Use invocation-directory for Info | ||
| 373 | ;; only if we used it for exec-directory also. | ||
| 374 | (not (string= exec-directory | ||
| 375 | (expand-file-name "lib-src/" | ||
| 376 | installation-directory)))) | ||
| 377 | (not (file-exists-p alternative))) | ||
| 378 | Info-default-directory-list | ||
| 379 | ;; `alternative' contains the Info files that came with this | ||
| 380 | ;; version, so we should look there first. `Info-insert-dir' | ||
| 381 | ;; currently expects to find `alternative' first on the list. | ||
| 382 | (cons alternative | ||
| 383 | (reverse (cdr (reverse Info-default-directory-list))))))))))) | ||
| 384 | 392 | ||
| 385 | ;;;###autoload | 393 | ;;;###autoload |
| 386 | (defun info-other-window (&optional file) | 394 | (defun info-other-window (&optional file) |