diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-12-24 10:23:35 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-12-24 10:23:35 +0100 |
commit | b9015606d169d3a70c0c690e8107b894fe62b7cb (patch) | |
tree | b7bceb40ede3263cf942923d3c576f41034a29a5 /lisp/net/shr.el | |
parent | 552b74ba9ec0fa0486b86bea561e499ca13e92ca (diff) | |
download | emacs-b9015606d169d3a70c0c690e8107b894fe62b7cb.tar.gz emacs-b9015606d169d3a70c0c690e8107b894fe62b7cb.tar.bz2 emacs-b9015606d169d3a70c0c690e8107b894fe62b7cb.zip |
Simplify whitespace stripping in shr-expand-url
* lisp/net/shr.el (shr-expand-url): Simplify whitespace stripping.
Diffstat (limited to 'lisp/net/shr.el')
-rw-r--r-- | lisp/net/shr.el | 8 |
1 files changed, 3 insertions, 5 deletions
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) |