diff options
| author | Jim Blandy | 1993-03-02 07:27:17 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-03-02 07:27:17 +0000 |
| commit | 44c327f9596f64d9f3589df17347e06887f90dd1 (patch) | |
| tree | 221d78bdaf904331f17c636825558cc47a9b86f7 | |
| parent | b9a4b5011e4804cc372fe3cba4b45ebb3ccac489 (diff) | |
| download | emacs-44c327f9596f64d9f3589df17347e06887f90dd1.tar.gz emacs-44c327f9596f64d9f3589df17347e06887f90dd1.zip | |
* info.el (Info-directory-list): Doc fix; it is set according to
INFOPATH, not INFODIR.
(Info-find-node): Don't try to set the info buffer's directory
according to Info-directory; that variable doesn't exist any more.
Instead, let Info-insert-dir set the current directory.
(Info-insert-dir): Properly check for upper- and lower-case forms
of "dir", with and without ".info" extension. Set the buffer's
default-directory to the directory containing the first dir file
we find, and cache it in Info-dir-contents-directory.
(Info-dir-contents-directory): New variable, to cache the
directory we decided to use as the merged directory's
default-directory.
| -rw-r--r-- | lisp/info.el | 68 |
1 files changed, 48 insertions, 20 deletions
diff --git a/lisp/info.el b/lisp/info.el index 5c273913da6..089f2fb6bf7 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -50,8 +50,8 @@ in paths.el.") | |||
| 50 | (defvar Info-directory-list nil | 50 | (defvar Info-directory-list nil |
| 51 | "List of directories to search for Info documentation files. | 51 | "List of directories to search for Info documentation files. |
| 52 | nil means not yet initialized. In this case, Info uses the environment | 52 | nil means not yet initialized. In this case, Info uses the environment |
| 53 | variable INFODIR to initialize it, or `Info-default-directory-list' | 53 | variable INFOPATH to initialize it, or `Info-default-directory-list' |
| 54 | if there is no INFODIR variable in the environment.") | 54 | if there is no INFOPATH variable in the environment.") |
| 55 | 55 | ||
| 56 | (defvar Info-current-file nil | 56 | (defvar Info-current-file nil |
| 57 | "Info file that Info is now looking at, or nil.") | 57 | "Info file that Info is now looking at, or nil.") |
| @@ -153,7 +153,6 @@ to read a file name from the minibuffer." | |||
| 153 | Info-current-subfile nil | 153 | Info-current-subfile nil |
| 154 | buffer-file-name nil) | 154 | buffer-file-name nil) |
| 155 | (erase-buffer) | 155 | (erase-buffer) |
| 156 | (setq default-directory Info-directory) | ||
| 157 | (if (eq filename t) | 156 | (if (eq filename t) |
| 158 | (Info-insert-dir) | 157 | (Info-insert-dir) |
| 159 | (insert-file-contents filename t) | 158 | (insert-file-contents filename t) |
| @@ -232,35 +231,63 @@ to read a file name from the minibuffer." | |||
| 232 | (goto-char (nth 2 hist))))) | 231 | (goto-char (nth 2 hist))))) |
| 233 | (goto-char (point-min))) | 232 | (goto-char (point-min))) |
| 234 | 233 | ||
| 235 | ;; Record the contents of the (virtual) dir file, | 234 | ;; Cache the contents of the (virtual) dir file, once we have merged |
| 236 | ;; once we have merged it for the first time, | 235 | ;; it for the first time, so we can save time subsequently. |
| 237 | ;; so we can save time subsequently. | ||
| 238 | (defvar Info-dir-contents nil) | 236 | (defvar Info-dir-contents nil) |
| 239 | 237 | ||
| 238 | ;; Cache for the directory we decided to use for the default-directory | ||
| 239 | ;; of the merged dir text. | ||
| 240 | (defvar Info-dir-contents-directory nil) | ||
| 241 | |||
| 240 | ;; Construct the Info directory node by merging the files named `dir' | 242 | ;; Construct the Info directory node by merging the files named `dir' |
| 241 | ;; from various directories. | 243 | ;; from various directories. Set the *info* buffer's |
| 244 | ;; default-directory to the first directory we actually get any text | ||
| 245 | ;; from. | ||
| 242 | (defun Info-insert-dir () | 246 | (defun Info-insert-dir () |
| 243 | (if Info-dir-contents | 247 | (if Info-dir-contents |
| 244 | (insert Info-dir-contents) | 248 | (insert Info-dir-contents) |
| 245 | (let ((dirs Info-directory-list) | 249 | (let ((dirs Info-directory-list) |
| 246 | buffers buffer others nodes) | 250 | buffers buffer others nodes) |
| 247 | ;; Search the directory list for file FILENAME. | 251 | |
| 252 | ;; Search the directory list for the directory file. | ||
| 248 | (while dirs | 253 | (while dirs |
| 249 | (setq temp (expand-file-name "dir" (car dirs))) | ||
| 250 | ;; Try several variants of specified name. | 254 | ;; Try several variants of specified name. |
| 251 | ;; Try downcasing, appending `.info', or both. | 255 | ;; Try upcasing, appending `.info', or both. |
| 252 | (cond ((file-exists-p temp) | 256 | (let (temp |
| 253 | (setq buffers (cons (find-file-noselect temp) buffers))) | 257 | (buffer |
| 254 | ((file-exists-p (concat temp ".info")) | 258 | (cond |
| 255 | (setq buffers (cons (find-file-noselect (concat temp ".info")) | 259 | ((progn (setq temp (expand-file-name "DIR" (car dirs))) |
| 256 | buffers)))) | 260 | (file-exists-p temp)) |
| 257 | (setq dirs (cdr dirs))) | 261 | (find-file-noselect temp)) |
| 258 | ;; Distinguish the dir file that comes with Emacs | 262 | ((progn (setq temp (expand-file-name "dir" (car dirs))) |
| 259 | ;; from all the others. | 263 | (file-exists-p temp)) |
| 264 | (find-file-noselect temp)) | ||
| 265 | ((progn (setq temp (expand-file-name "DIR.INFO" (car dirs))) | ||
| 266 | (file-exists-p temp)) | ||
| 267 | (find-file-noselect temp)) | ||
| 268 | ((progn (setq temp (expand-file-name "dir.info" (car dirs))) | ||
| 269 | (file-exists-p temp)) | ||
| 270 | (find-file-noselect temp))))) | ||
| 271 | (if buffer (setq buffers (cons buffer buffers))) | ||
| 272 | (setq dirs (cdr dirs)))) | ||
| 273 | |||
| 274 | ;; Distinguish the dir file that comes with Emacs from all the | ||
| 275 | ;; others. [This sounds like baloney - who knows what order | ||
| 276 | ;; Info-directory-list is in, especially after checking the | ||
| 277 | ;; INFOPATH variable, and why should Emacs's dir be special? If | ||
| 278 | ;; you understand what this comment should have said, please | ||
| 279 | ;; change it.] | ||
| 260 | (setq buffer (car buffers) | 280 | (setq buffer (car buffers) |
| 261 | others (cdr buffers)) | 281 | others (cdr buffers)) |
| 262 | ;; Insert the entire original dir file as a start. | 282 | |
| 283 | ;; Insert the entire original dir file as a start; use its | ||
| 284 | ;; default directory as the default directory for the whole | ||
| 285 | ;; concatenation. | ||
| 263 | (insert-buffer buffer) | 286 | (insert-buffer buffer) |
| 287 | (setq Info-dir-contents-directory (save-excursion | ||
| 288 | (set-buffer buffer) | ||
| 289 | default-directory)) | ||
| 290 | |||
| 264 | ;; Look at each of the other buffers one by one. | 291 | ;; Look at each of the other buffers one by one. |
| 265 | (while others | 292 | (while others |
| 266 | (let ((other (car others))) | 293 | (let ((other (car others))) |
| @@ -322,7 +349,8 @@ to read a file name from the minibuffer." | |||
| 322 | (while buffers | 349 | (while buffers |
| 323 | (kill-buffer (car buffers)) | 350 | (kill-buffer (car buffers)) |
| 324 | (setq buffers (cdr buffers)))) | 351 | (setq buffers (cdr buffers)))) |
| 325 | (setq Info-dir-contents (buffer-string)))) | 352 | (setq Info-dir-contents (buffer-string))) |
| 353 | (setq default-directory Info-dir-contents-directory)) | ||
| 326 | 354 | ||
| 327 | (defun Info-read-subfile (nodepos) | 355 | (defun Info-read-subfile (nodepos) |
| 328 | (set-buffer (marker-buffer Info-tag-table-marker)) | 356 | (set-buffer (marker-buffer Info-tag-table-marker)) |