summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-07-05 13:07:56 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-07-05 18:27:42 +0200
commit8681bf1e851dd4abda066ddab5199768f310db8a (patch)
treef3a3d9a4d9c6579a1f70e248891283ad7a595ce6 /lisp/emacs-lisp
parent59276ff81d1ab391f4e3cd91f3070a12c51a3507 (diff)
downloademacs-8681bf1e851dd4abda066ddab5199768f310db8a.tar.gz
emacs-8681bf1e851dd4abda066ddab5199768f310db8a.tar.bz2
emacs-8681bf1e851dd4abda066ddab5199768f310db8a.zip
Mention byte order marks in string-limit doc string
* lisp/emacs-lisp/subr-x.el (string-limit): Mention byte order marks (bug#48324).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/subr-x.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 56e8c2aa862..39697a8e725 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -169,7 +169,12 @@ 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 (or glyphs), even if CODING-SYSTEM encodes characters
-with several bytes per character.
+with several bytes per character. If the coding system specifies
+things like byte order marks (aka \"BOM\") or language tags, they
+will normally be part of the calculation. This is the case, for
+instance, with `utf-16'. If this isn't desired, use a coding
+system that doesn't specify a BOM, like `utf-16le' or
+`utf-16be'.
When shortening strings for display purposes,
`truncate-string-to-width' is almost always a better alternative