Commit e0c1e774 authored by Eli Zaretskii's avatar Eli Zaretskii

(info-insert-file-contents-1): Accept an additional

argument `lfn': if it is non-nil, concatenate `filename' and
`suffix'; otherwise use the complicated MS-DOS code.  All callers
changed.
(info-insert-file-contents, Info-find-node): If the MS-DOS port
can access long file names, try the long file-name version of
`info-insert-file-contents-1', then the short file-name version.
parent d04b2e49
2001-03-01 Eli Zaretskii <eliz@is.elta.co.il>
* info.el (info-insert-file-contents-1): Accept an additional
argument `lfn': if it is non-nil, concatenate `filename' and
`suffix'; otherwise use the complicated MS-DOS code. All callers
changed.
(info-insert-file-contents, Info-find-node): If the MS-DOS port
can access long file names, try the long file-name version of
`info-insert-file-contents-1', then the short file-name version.
2001-02-28 TAKAHASHI Naoto <ntakahas@m17n.org>
* language/ethio-util.el (setup-ethiopic-environment-internal):
......
......@@ -234,10 +234,10 @@ Because the SUFFIXes are tried in order, the empty string should
be last in the list.")
;; Concatenate SUFFIX onto FILENAME. SUFFIX should start with a dot.
;; First, on ms-dos, delete some of the extension in FILENAME
;; to make room.
(defun info-insert-file-contents-1 (filename suffix)
(if (not (eq system-type 'ms-dos))
;; First, on MS-DOS with no long file names support, delete some of
;; the extension in FILENAME to make room.
(defun info-insert-file-contents-1 (filename suffix lfn)
(if lfn ; long file names are supported
(concat filename suffix)
(let* ((sans-exts (file-name-sans-extension filename))
;; How long is the extension in FILENAME (not counting the dot).
......@@ -263,8 +263,12 @@ be last in the list.")
(defun info-insert-file-contents (filename &optional visit)
"Insert the contents of an info file in the current buffer.
Do the right thing if the file has been compressed or zipped."
(let ((tail Info-suffix-list)
fullname decoder)
(let* ((tail Info-suffix-list)
(lfn (or (not (fboundp 'msdos-long-file-names))
(msdos-long-file-names)))
(check-short (and (fboundp 'msdos-long-file-names)
lfn))
fullname decoder done)
(if (file-exists-p filename)
;; FILENAME exists--see if that name contains a suffix.
;; If so, set DECODE accordingly.
......@@ -277,14 +281,23 @@ Do the right thing if the file has been compressed or zipped."
(setq fullname filename
decoder (cdr (car tail))))
;; Try adding suffixes to FILENAME and see if we can find something.
(while (and tail
(not (info-file-exists-p (info-insert-file-contents-1
filename (car (car tail))))))
(while (and tail (not done))
(setq fullname (info-insert-file-contents-1 filename
(car (car tail)) lfn))
(if (info-file-exists-p fullname)
(setq done t
;; If we found a file with a suffix, set DECODER
;; according to the suffix.
decoder (cdr (car tail)))
;; When the MS-DOS port runs on Windows, we need to check
;; the short variant of a long file name as well.
(when check-short
(setq fullname (info-insert-file-contents-1 filename
(car (car tail)) nil))
(if (info-file-exists-p fullname)
(setq done t
decoder (cdr (car tail))))))
(setq tail (cdr tail)))
;; If we found a file with a suffix, set DECODER according to the suffix
;; and set FULLNAME to the file's actual name.
(setq fullname (info-insert-file-contents-1 filename (car (car tail)))
decoder (cdr (car tail)))
(or tail
(error "Can't find %s or any compressed version of it" filename)))
;; check for conflict with jka-compr
......@@ -459,16 +472,24 @@ it says do not attempt further (recursive) error recovery."
(setq temp-downcase
(expand-file-name (downcase filename) (car dirs)))
;; Try several variants of specified name.
(let ((suffix-list Info-suffix-list))
(let ((suffix-list Info-suffix-list)
(lfn (or (not (fboundp 'msdos-long-file-names))
(msdos-long-file-names))))
(while (and suffix-list (not found))
(cond ((info-file-exists-p
(info-insert-file-contents-1
temp (car (car suffix-list))))
temp (car (car suffix-list)) lfn))
(setq found temp))
((info-file-exists-p
(info-insert-file-contents-1
temp-downcase (car (car suffix-list))))
(setq found temp-downcase)))
temp-downcase (car (car suffix-list)) lfn))
(setq found temp-downcase))
((and (fboundp 'msdos-long-file-names)
lfn
(info-file-exists-p
(info-insert-file-contents-1
temp (car (car suffix-list)) nil)))
(setq found temp)))
(setq suffix-list (cdr suffix-list))))
(setq dirs (cdr dirs)))))
(if found
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment