From: Lars Ingebrigtsen Date: Fri, 24 Dec 2021 09:23:35 +0000 (+0100) Subject: Simplify whitespace stripping in shr-expand-url X-Git-Tag: emacs-29.0.90~3475 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b9015606d169d3a70c0c690e8107b894fe62b7cb;p=emacs.git Simplify whitespace stripping in shr-expand-url * lisp/net/shr.el (shr-expand-url): Simplify whitespace stripping. --- diff --git a/lisp/net/shr.el b/lisp/net/shr.el index bd16a779593..676f609c24b 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -857,11 +857,9 @@ size, and full-buffer size." shr-base)) (when (zerop (length url)) (setq url nil)) - ;; Strip leading/trailing whitespace - (and url (string-match "\\`\\s-+" url) - (setq url (substring url (match-end 0)))) - (and url (string-match "\\s-+\\'" url) - (setq url (substring url 0 (match-beginning 0)))) + ;; Strip leading/trailing whitespace. + (when url + (setq url (string-trim url))) (cond ((zerop (length url)) (nth 3 base)) ((or (not base)