[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36664: 27.0.50; definition of string-trim causes warning
From: |
Lars Ingebrigtsen |
Subject: |
bug#36664: 27.0.50; definition of string-trim causes warning |
Date: |
Mon, 15 Jul 2019 17:16:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
> Have that in python-mode.el --as older Emacsen might miss the function--:
>
> ;; subr-x.el might not exist yet
> (unless (functionp 'string-trim)
> (defsubst string-trim (string &optional trim-left trim-right)
> "Trim STRING of leading and trailing strings matching TRIM-LEFT
> and TRIM-RIGHT.
>
> TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
> (string-trim-left (string-trim-right string trim-right) trim-left))
I put the following in /tmp/a.el and said `M-x byte-compile-file', and I
got no warning...
(unless (functionp 'string-trim)
(defsubst string-trim (string &optional trim-left trim-right)
"Trim STRING of leading and trailing strings matching TRIM-LEFT
and TRIM-RIGHT.
TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
(string-trim-left (string-trim-right string trim-right) trim-left)))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no