unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: emacs-28 edb1d49: * lisp/net/shr.el (shr-expand-url): Also strip trailing
       [not found] ` <20211223180958.5B91921362@vcs0.savannah.gnu.org>
@ 2021-12-23 18:40   ` Stefan Kangas
  2021-12-23 18:53     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kangas @ 2021-12-23 18:40 UTC (permalink / raw)
  To: Andreas Schwab, emacs-devel

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))



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: emacs-28 edb1d49: * lisp/net/shr.el (shr-expand-url): Also strip trailing
  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
  2021-12-23 21:02       ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-23 18:53 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Andreas Schwab, emacs-devel

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: emacs-28 edb1d49: * lisp/net/shr.el (shr-expand-url): Also strip trailing
  2021-12-23 18:53     ` Lars Ingebrigtsen
@ 2021-12-23 21:02       ` Andreas Schwab
  2021-12-24  9:21         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2021-12-23 21:02 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Stefan Kangas, emacs-devel

On Dez 23 2021, Lars Ingebrigtsen wrote:

> What's the use case for stripping spaces?

https://www.der-postillon.com/2021/12/senfflecken-2021.html

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: emacs-28 edb1d49: * lisp/net/shr.el (shr-expand-url): Also strip trailing
  2021-12-23 21:02       ` Andreas Schwab
@ 2021-12-24  9:21         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-24  9:21 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Stefan Kangas, emacs-devel

Andreas Schwab <schwab@gnu.org> writes:

>> What's the use case for stripping spaces?
>
> https://www.der-postillon.com/2021/12/senfflecken-2021.html

Ah, it's when the URL isn't relative.  Well, I guess that's what other
browsers do in this case, so we should, too.

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-24  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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
2021-12-23 21:02       ` Andreas Schwab
2021-12-24  9:21         ` Lars Ingebrigtsen

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).