emacs-devel
[Top][All Lists]
Advanced

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

Re: Your last change to browse-url is bogus.


From: YAMAMOTO Mitsuharu
Subject: Re: Your last change to browse-url is bogus.
Date: Wed, 12 Sep 2007 23:18:00 +0900 (JST)

>>>>> On Wed, 12 Sep 2007 15:13:06 +0200, address@hidden (Michaël Cadilhac) 
>>>>> said:

>> %-escaping in browse-url-file-url (filename -> url) and those in
>> other places such as browse-url-netscape (url -> url) are
>> inherently different operations.

> Not quite.  I may have a too low-level point of view, but they are
> the same operations, they are just not used for the same purpose.

"Inherently different" might have been an exaggeration.  Do you agree
that they are semantically different operations?

>> I think consolidating these two operations into one function only
>> because they look similar is over-refactoring and shouldn't be done
>> in order to avoid re-escaping or re-unescaping by mistake.

> Well, I'm not so sure.  Their purpose is to escape characters in a
> way we don't want to duplicate too much.  The «problem» you're
> pointing out is the reason why I made the escaping function take the
> set of characters to escape in a first place.

IMO, differentiating them just by an argument makes the semantical
difference more or less implicit.  What is worse, the function name
`browse-url-encode-url' looks as if it takes a URL as an argument.  I
think operations on filename and URL should be deliberately separated
(except for purely basic string operations) so as to avoid mixture of
them and resulting re-escaping/unescaping.

> What would you do?

Maybe I would revert browse-url-file-url to the one that doesn't use
browse-url-encode-url in order to clarify that 1) encoding with
file-name-coding-system, 2) %-escaping, and 3) adding scheme are
unseparable operations in conversion from a filename to a URL.  Also I
would use more explicit and specific name in place of
browse-url-encode-url (e.g., browse-url-escape-confusing-characters).

An alternative way would be, as you suggested, to give characters to
be escaped as an argument to browse-url-encode-url, but rename the
function so it looks like a low-level string operation.

                                     YAMAMOTO Mitsuharu
                                address@hidden




reply via email to

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