[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat c1baf3f368 2/4: compat-29: Drop broken string-li
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat c1baf3f368 2/4: compat-29: Drop broken string-limit |
Date: |
Sat, 7 Jan 2023 07:57:26 -0500 (EST) |
branch: externals/compat
commit c1baf3f36842e508025e06dd7cbb14969793c585
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
compat-29: Drop broken string-limit
---
compat-29.el | 44 --------------------------------------------
compat.texi | 22 ----------------------
2 files changed, 66 deletions(-)
diff --git a/compat-29.el b/compat-29.el
index e47e87be93..b000411bac 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -241,50 +241,6 @@ CONDITION."
;;;; Defined in subr-x.el
-(compat-defun string-limit (string length &optional end coding-system) ;;
<UNTESTED>
- "Return a substring of STRING that is (up to) LENGTH characters long.
-If STRING is shorter than or equal to LENGTH characters, return the
-entire string unchanged.
-
-If STRING is longer than LENGTH characters, return a substring
-consisting of the first LENGTH characters of STRING. If END is
-non-nil, return the last LENGTH characters instead.
-
-If CODING-SYSTEM is non-nil, STRING will be encoded before
-limiting, and LENGTH is interpreted as the number of bytes to
-limit the string to. The result will be a unibyte string that is
-shorter than LENGTH, but will not contain \"partial\" characters,
-even if CODING-SYSTEM encodes characters with several bytes per
-character.
-
-When shortening strings for display purposes,
-`truncate-string-to-width' is almost always a better alternative
-than this function."
- (unless (natnump length)
- (signal 'wrong-type-argument (list 'natnump length)))
- (if coding-system
- (let ((result nil)
- (result-length 0)
- (index (if end (1- (length string)) 0)))
- (while (let ((encoded (encode-coding-char
- (aref string index) coding-system)))
- (and (<= (+ (length encoded) result-length) length)
- (progn
- (push encoded result)
- (setq result-length
- (+ result-length (length encoded)))
- (setq index (if end (1- index)
- (1+ index))))
- (if end (> index -1)
- (< index (length string)))))
- ;; No body.
- )
- (apply #'concat (if end result (nreverse result))))
- (cond
- ((<= (length string) length) string)
- (end (substring string (- (length string) length)))
- (t (substring string 0 length)))))
-
(compat-defmacro with-buffer-unmodified-if-unchanged (&rest body) ;; <UNTESTED>
"Like `progn', but change buffer-modified status only if buffer text changes.
If the buffer was unmodified before execution of BODY, and
diff --git a/compat.texi b/compat.texi
index 3d19933df5..166d1d9218 100644
--- a/compat.texi
+++ b/compat.texi
@@ -2124,28 +2124,6 @@ If there's a loop in the definitions, an error will be
signalled. If
returned instead.
@end defun
-@c copied from lispref/strings.texi
-@defun string-limit string length &optional end coding-system
-If @var{string} is shorter than @var{length} characters, @var{string}
-is returned as is. Otherwise, return a substring of @var{string}
-consisting of the first @var{length} characters. If the optional
-@var{end} parameter is given, return a string of the @var{length} last
-characters instead.
-
-If @var{coding-system} is non-@code{nil}, @var{string} will be encoded
-before limiting, and the result will be a unibyte string that's
-shorter than @code{length} bytes. If @var{string} contains characters
-that are encoded into several bytes (for instance, when using
-@code{utf-8}), the resulting unibyte string is never truncated in the
-middle of a character representation.
-
-This function measures the string length in characters or bytes, and
-thus is generally inappropriate if you need to shorten strings for
-display purposes; use @code{truncate-string-to-width} or
-@code{window-text-pixel-size} or @code{string-glyph-split} instead
-(@pxref{Size of Displayed Text,Size of Displayed Text,,elisp,}).
-@end defun
-
@c copied from lispref/strings.texi
@defun string-equal-ignore-case string1 string2
@code{string-equal-ignore-case} compares strings ignoring case