summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-10-30 10:26:38 +0300
committerEli Zaretskii <eliz@gnu.org>2021-10-30 10:26:38 +0300
commit20ebd91a734c3241ca3a9ce15ba81f7357401576 (patch)
treee0ccc598d544ed3744435632ee3e7730496303ec /lisp/emacs-lisp
parent3f998a3fc823df6117cfc286a557d495bc8ee11e (diff)
downloademacs-20ebd91a734c3241ca3a9ce15ba81f7357401576.tar.gz
emacs-20ebd91a734c3241ca3a9ce15ba81f7357401576.tar.bz2
emacs-20ebd91a734c3241ca3a9ce15ba81f7357401576.zip
Improve documentation of string truncation APIs
* doc/lispref/display.texi (Size of Displayed Text): * lisp/international/mule-util.el (truncate-string-to-width): Document caveats of using 'truncate-string-to-width' when character composition is involved. * lisp/emacs-lisp/subr-x.el (string-limit): * doc/lispref/strings.texi (Creating Strings): Improve the documentation of 'string-limit'.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/subr-x.el12
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 3de666682fa..788cd0f34bf 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -264,13 +264,13 @@ result will have lines that are longer than LENGTH."
(buffer-string)))
(defun string-limit (string length &optional end coding-system)
- "Return (up to) a LENGTH substring of STRING.
-If STRING is shorter than or equal to LENGTH, the entire string
-is returned unchanged.
+ "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, return a substring consisting of
-the first LENGTH characters of STRING. If END is non-nil, return
-the last LENGTH characters instead.
+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