]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/nxml/rng-util.el (rng-collapse-space): Simplify.
authorStefan Kangas <stefan@marxist.se>
Tue, 9 Aug 2022 18:29:27 +0000 (20:29 +0200)
committerStefan Kangas <stefan@marxist.se>
Tue, 9 Aug 2022 19:58:00 +0000 (21:58 +0200)
lisp/nxml/rng-util.el

index da51e81dbe7dd1eff72ed96afe34639c31c41efd..70951f35d5d04f3c0e567394ebf64ffb64fd6284 100644 (file)
@@ -72,13 +72,8 @@ LIST is not modified."
                            t))
 
 (defun rng-collapse-space (string)
-  (setq string
-       (replace-regexp-in-string "[ \t\r\n]+" " " string t t))
-  (when (string-match "\\` " string)
-    (setq string (substring string 1)))
-  (when (string-match " \\'" string)
-    (setq string (substring string 0 -1)))
-  string)
+  (string-trim
+   (replace-regexp-in-string "[ \t\r\n]+" " " string t t)))
 
 (define-error 'rng-error nil)