From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: Your last change to browse-url is bogus. Date: Wed, 12 Sep 2007 23:18:00 +0900 (JST) Message-ID: <20070912.231800.210864712.mituharu@math.s.chiba-u.ac.jp> References: <87ejh42mo4.fsf@cadilhac.name> <20070912.215405.160495149.mituharu@math.s.chiba-u.ac.jp> <87sl5k10yl.fsf@cadilhac.name> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1189606756 22510 80.91.229.12 (12 Sep 2007 14:19:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Sep 2007 14:19:16 +0000 (UTC) Cc: hannes@saeurebad.de, emacs-devel@gnu.org To: michael@cadilhac.name Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 12 16:19:10 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IVT39-00026z-OR for ged-emacs-devel@m.gmane.org; Wed, 12 Sep 2007 16:18:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVT39-0005F3-DG for ged-emacs-devel@m.gmane.org; Wed, 12 Sep 2007 10:18:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IVT35-0005Bo-6B for emacs-devel@gnu.org; Wed, 12 Sep 2007 10:18:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IVT33-0005A0-U1 for emacs-devel@gnu.org; Wed, 12 Sep 2007 10:18:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVT33-00059s-Q9 for emacs-devel@gnu.org; Wed, 12 Sep 2007 10:18:33 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IVT33-0001Bz-5h for emacs-devel@gnu.org; Wed, 12 Sep 2007 10:18:33 -0400 Original-Received: from localhost (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id F3E2A2C45; Wed, 12 Sep 2007 23:18:26 +0900 (JST) In-Reply-To: <87sl5k10yl.fsf@cadilhac.name> X-Mailer: Mew version 3.3 on Emacs 22.1 / Mule 5.0 (SAKAKI) X-Detected-Kernel: NetBSD 3.0 (DF) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:78678 Archived-At: >>>>> On Wed, 12 Sep 2007 15:13:06 +0200, michael@cadilhac.name (Micha=EB= 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 =ABproblem=BB 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 mituharu@math.s.chiba-u.ac.jp