From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: Andreas Schwab <schwab@gnu.org>, emacs-devel@gnu.org
Subject: Re: emacs-28 edb1d49: * lisp/net/shr.el (shr-expand-url): Also strip trailing
Date: Thu, 23 Dec 2021 19:53:00 +0100 [thread overview]
Message-ID: <87pmpn40hf.fsf@gnus.org> (raw)
In-Reply-To: <CADwFkm=Hqu4A9ZnH6vJLPhjWOgYNgvQfK9EVT-0PM2pmj1=tCQ@mail.gmail.com> (Stefan Kangas's message of "Thu, 23 Dec 2021 10:40:48 -0800")
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
next prev parent reply other threads:[~2021-12-23 18:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211223180957.11470.44284@vcs0.savannah.gnu.org>
[not found] ` <20211223180958.5B91921362@vcs0.savannah.gnu.org>
2021-12-23 18:40 ` emacs-28 edb1d49: * lisp/net/shr.el (shr-expand-url): Also strip trailing Stefan Kangas
2021-12-23 18:53 ` Lars Ingebrigtsen [this message]
2021-12-23 21:02 ` Andreas Schwab
2021-12-24 9:21 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pmpn40hf.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=emacs-devel@gnu.org \
--cc=schwab@gnu.org \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).