emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-28 edb1d49: * lisp/net/shr.el (shr-expand-url): Also strip tra


From: Lars Ingebrigtsen
Subject: Re: emacs-28 edb1d49: * lisp/net/shr.el (shr-expand-url): Also strip trailing
Date: Thu, 23 Dec 2021 19:53:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Stefan Kangas <stefankangas@gmail.com> writes:

> schwab@gnu.org (Andreas Schwab) writes:
>
>> -  ;; Strip leading whitespace
>> +  ;; 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))))
>
> This could be simplified to:
>
>     (setq url (string-trim url))

And I'm not sure about the logic -- even stripping the leading spaces
seems dubious.  The function is supposed to perform expansion of URL
(which may be a fragment) to BASE, and it's not supposed to do any DWIM
stuff.

What's the use case for stripping spaces?  (Which are valid enough
characters in URLs in some (pre-encoding) cases.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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