emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b901560: Simplify whitespace stripping in shr-expand-url


From: Lars Ingebrigtsen
Subject: master b901560: Simplify whitespace stripping in shr-expand-url
Date: Fri, 24 Dec 2021 04:23:43 -0500 (EST)

branch: master
commit b9015606d169d3a70c0c690e8107b894fe62b7cb
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Simplify whitespace stripping in shr-expand-url
    
    * lisp/net/shr.el (shr-expand-url): Simplify whitespace stripping.
---
 lisp/net/shr.el | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index bd16a77..676f609 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]