diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-11-15 23:17:18 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-11-15 23:17:18 +0000 |
commit | b914f9a1aada5ca49dd0ce79eab845c5ffd5c307 (patch) | |
tree | 52df620e95146fa315257a8b9eb23768b51f7d59 /lisp/info.el | |
parent | 4aa51c02a8e04b205c862d15eb8a860b8254619d (diff) | |
download | emacs-b914f9a1aada5ca49dd0ce79eab845c5ffd5c307.tar.gz |
(info-insert-file-contents-1): Various rewrites.
Compute EXT-LEFT after removing the dot from SUFFIX.
Diffstat (limited to 'lisp/info.el')
-rw-r--r-- | lisp/info.el | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/info.el b/lisp/info.el index 13447f330b3..6e8252c10a4 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -142,22 +142,23 @@ 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. +;; 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)) (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))))) + ;; How long is the extension in FILENAME (not counting the dot). + (ext-len (max 0 (- (length filename) (length sans-exts) 1))) + ext-left) ;; SUFFIX starts with a dot. If FILENAME already has one, ;; get rid of the one in SUFFIX. - (or (and (zerop ext-len) + (or (and (<= ext-len 0) (not (eq (aref filename (1- (length filename))) ?.))) (setq suffix (substring suffix 1))) + ;; How many chars of that extension should we keep? + (setq ext-left (min ext-len (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))) |