aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-08-22 18:51:46 +0000
committerRichard M. Stallman1995-08-22 18:51:46 +0000
commitbd0c916883f8e26b9564253e5e072f803761154a (patch)
tree6809996261488e9bb80f5afce5ad6c88f2d45e9d
parent6b9d0764ce214e41b2794a07600c5f06bc1c57f5 (diff)
downloademacs-bd0c916883f8e26b9564253e5e072f803761154a.tar.gz
emacs-bd0c916883f8e26b9564253e5e072f803761154a.zip
(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.
-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.")
125(defvar Info-standalone nil 125(defvar Info-standalone nil
126 "Non-nil if Emacs was started solely as an Info browser.") 126 "Non-nil if Emacs was started solely as an Info browser.")
127 127
128(defvar Info-suffix-list '( (".info.Z" . "uncompress") 128(defvar Info-suffix-list
129 (".info.Y" . "unyabba") 129 (if (eq system-type 'ms-dos)
130 (".info.gz" . "gunzip") 130 '( (".gz" . "gunzip")
131 (".info.z" . "gunzip") 131 (".z" . "gunzip")
132 (".info" . nil) 132 ("" . nil))
133 (".Z" . "uncompress") 133 '( (".info.Z" . "uncompress")
134 (".Y" . "unyabba") 134 (".info.Y" . "unyabba")
135 (".gz" . "gunzip") 135 (".info.gz" . "gunzip")
136 (".z" . "gunzip") 136 (".info.z" . "gunzip")
137 ("" . nil)) 137 (".info" . nil)
138 (".Z" . "uncompress")
139 (".Y" . "unyabba")
140 (".gz" . "gunzip")
141 (".z" . "gunzip")
142 ("" . nil)))
138 "List of file name suffixes and associated decoding commands. 143 "List of file name suffixes and associated decoding commands.
139Each entry should be (SUFFIX . STRING); the file is given to 144Each entry should be (SUFFIX . STRING); the file is given to
140the command as standard input. If STRING is nil, no decoding is done. 145the command as standard input. If STRING is nil, no decoding is done.
141Because the SUFFIXes are tried in order, the empty string should 146Because the SUFFIXes are tried in order, the empty string should
142be last in the list.") 147be last in the list.")
143 148
149;; Concatenate SUFFIX onto FILENAME.
150;; First, on ms-dos, delete some of the extension in FILENAME
151;; to make room.
152(defun info-insert-file-contents-1 (filename suffix)
153 (if (not (eq system-type 'ms-dos))
154 (concat filename suffix)
155 (let* ((sans-exts (file-name-sans-extension filename))
156 ;; How long is the extension in FILENAME.
157 (ext-len (- (length filename) (length sans-exts) 1))
158 ;; How many chars of that extension should we keep?
159 (ext-left (max 0 (- 3 (length suffix)))))
160 ;; Get rid of the rest of the extension, and add SUFFIX.
161 (concat (substring filename 0 (- (length filename)
162 (- ext-len ext-left)))
163 suffix))))
164
144(defun info-insert-file-contents (filename &optional visit) 165(defun info-insert-file-contents (filename &optional visit)
145 "Insert the contents of an info file in the current buffer. 166 "Insert the contents of an info file in the current buffer.
146Do the right thing if the file has been compressed or zipped." 167Do the right thing if the file has been compressed or zipped."
147 (let ((tail Info-suffix-list) 168 (let ((tail Info-suffix-list)
148 fullname decoder) 169 fullname decoder)
149 (if (file-exists-p filename) 170 (if (file-exists-p filename)
171 ;; FILENAME exists--see if that name contains a suffix.
172 ;; If so, set DECODE accordingly.
150 (progn 173 (progn
151 (while (and tail 174 (while (and tail
152 (not (string-match 175 (not (string-match
@@ -155,13 +178,17 @@ Do the right thing if the file has been compressed or zipped."
155 (setq tail (cdr tail))) 178 (setq tail (cdr tail)))
156 (setq fullname filename 179 (setq fullname filename
157 decoder (cdr (car tail)))) 180 decoder (cdr (car tail))))
181 ;; Try adding suffixes to FILENAME and see if we can find something.
158 (while (and tail 182 (while (and tail
159 (not (file-exists-p (concat filename (car (car tail)))))) 183 (not (file-exists-p (info-insert-file-contents-1
184 filename (car (car tail))))))
160 (setq tail (cdr tail))) 185 (setq tail (cdr tail)))
186 ;; If we found a file with a suffix, set DECODER according to the suffix
187 ;; and set FULLNAME to the file's actual name.
161 (setq fullname (concat filename (car (car tail))) 188 (setq fullname (concat filename (car (car tail)))
162 decoder (cdr (car tail))) 189 decoder (cdr (car tail)))
163 (or tail 190 (or tail
164 (error "Can't find %s or any compressed version of it!" filename))) 191 (error "Can't find %s or any compressed version of it" filename)))
165 ;; check for conflict with jka-compr 192 ;; check for conflict with jka-compr
166 (if (and (featurep 'jka-compr) 193 (if (and (featurep 'jka-compr)
167 (jka-compr-installed-p) 194 (jka-compr-installed-p)