summaryrefslogtreecommitdiff
path: root/lisp/info.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-08-22 18:51:46 +0000
committerRichard M. Stallman <rms@gnu.org>1995-08-22 18:51:46 +0000
commit7f32f8bfd78de340619afc5f3d32301085e6c883 (patch)
tree0e3c2fba93f533adad56b22bb11848383a37938c /lisp/info.el
parent6096c71e92aa1184c87f8dfc811de4cdc737163d (diff)
downloademacs-7f32f8bfd78de340619afc5f3d32301085e6c883.tar.gz
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
and don't include .info as suffix. (info-insert-file-contents-1): New function. (info-insert-file-contents): Use info-insert-file-contents-1.
Diffstat (limited to 'lisp/info.el')
-rw-r--r--lisp/info.el51
1 files changed, 39 insertions, 12 deletions
diff --git a/lisp/info.el b/lisp/info.el
index 4b9390f5d94..b70b1f34fa5 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -125,28 +125,51 @@ Marker points nowhere if file has no tag table.")
(defvar Info-standalone nil
"Non-nil if Emacs was started solely as an Info browser.")
-(defvar Info-suffix-list '( (".info.Z" . "uncompress")
- (".info.Y" . "unyabba")
- (".info.gz" . "gunzip")
- (".info.z" . "gunzip")
- (".info" . nil)
- (".Z" . "uncompress")
- (".Y" . "unyabba")
- (".gz" . "gunzip")
- (".z" . "gunzip")
- ("" . nil))
+(defvar Info-suffix-list
+ (if (eq system-type 'ms-dos)
+ '( (".gz" . "gunzip")
+ (".z" . "gunzip")
+ ("" . nil))
+ '( (".info.Z" . "uncompress")
+ (".info.Y" . "unyabba")
+ (".info.gz" . "gunzip")
+ (".info.z" . "gunzip")
+ (".info" . nil)
+ (".Z" . "uncompress")
+ (".Y" . "unyabba")
+ (".gz" . "gunzip")
+ (".z" . "gunzip")
+ ("" . nil)))
"List of file name suffixes and associated decoding commands.
Each entry should be (SUFFIX . STRING); the file is given to
the command as standard input. If STRING is nil, no decoding is done.
Because the SUFFIXes are tried in order, the empty string should
be last in the list.")
+;; Concatenate SUFFIX onto FILENAME.
+;; 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))
+ (concat filename suffix)
+ (let* ((sans-exts (file-name-sans-extension filename))
+ ;; How long is the extension in FILENAME.
+ (ext-len (- (length filename) (length sans-exts) 1))
+ ;; How many chars of that extension should we keep?
+ (ext-left (max 0 (- 3 (length suffix)))))
+ ;; Get rid of the rest of the extension, and add SUFFIX.
+ (concat (substring filename 0 (- (length filename)
+ (- ext-len ext-left)))
+ suffix))))
+
(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)
(if (file-exists-p filename)
+ ;; FILENAME exists--see if that name contains a suffix.
+ ;; If so, set DECODE accordingly.
(progn
(while (and tail
(not (string-match
@@ -155,13 +178,17 @@ Do the right thing if the file has been compressed or zipped."
(setq tail (cdr tail)))
(setq fullname filename
decoder (cdr (car tail))))
+ ;; Try adding suffixes to FILENAME and see if we can find something.
(while (and tail
- (not (file-exists-p (concat filename (car (car tail))))))
+ (not (file-exists-p (info-insert-file-contents-1
+ filename (car (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 (concat filename (car (car tail)))
decoder (cdr (car tail)))
(or tail
- (error "Can't find %s or any compressed version of it!" filename)))
+ (error "Can't find %s or any compressed version of it" filename)))
;; check for conflict with jka-compr
(if (and (featurep 'jka-compr)
(jka-compr-installed-p)