Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
c8e9dd54
Commit
c8e9dd54
authored
Nov 15, 1995
by
Richard M. Stallman
Browse files
(info-insert-file-contents-1): Various rewrites.
Compute EXT-LEFT after removing the dot from SUFFIX.
parent
91375f8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
lisp/info.el
lisp/info.el
+7
-6
No files found.
lisp/info.el
View file @
c8e9dd54
...
...
@@ -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
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment