From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Johannes Weiner Newsgroups: gmane.emacs.devel Subject: Re: Your last change to browse-url is bogus. Date: Wed, 12 Sep 2007 13:25:36 +0200 Message-ID: <20070912112536.GA9712@saeurebad.de> References: <87zlzs2qm1.fsf@cadilhac.name> <20070912102039.GD12104@saeurebad.de> <87ejh42mo4.fsf@cadilhac.name> <20070912104902.GA3696@saeurebad.de> <87abrs2l8a.fsf@cadilhac.name> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1393334878==" X-Trace: sea.gmane.org 1189596358 16760 80.91.229.12 (12 Sep 2007 11:25:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Sep 2007 11:25:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?iso-8859-1?Q?Micha=EBl?= Cadilhac Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 12 13:25:56 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 1IVQLq-0007Fn-Dc for ged-emacs-devel@m.gmane.org; Wed, 12 Sep 2007 13:25:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVQLq-0004Uf-AD for ged-emacs-devel@m.gmane.org; Wed, 12 Sep 2007 07:25:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IVQLm-0004RA-1u for emacs-devel@gnu.org; Wed, 12 Sep 2007 07:25:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IVQLk-0004QE-Km for emacs-devel@gnu.org; Wed, 12 Sep 2007 07:25:40 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVQLk-0004QB-GL for emacs-devel@gnu.org; Wed, 12 Sep 2007 07:25:40 -0400 Original-Received: from saeurebad.de ([85.214.36.134]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IVQLj-0003Pg-UV for emacs-devel@gnu.org; Wed, 12 Sep 2007 07:25:40 -0400 Original-Received: by saeurebad.de (Postfix, from userid 1000) id 7DB3C2F0156; Wed, 12 Sep 2007 13:25:36 +0200 (CEST) Mail-Followup-To: =?iso-8859-1?Q?Micha=EBl?= Cadilhac , emacs-devel@gnu.org In-Reply-To: <87abrs2l8a.fsf@cadilhac.name> User-Agent: Mutt/1.5.16 (2007-06-11) X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) 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:78662 Archived-At: --===============1393334878== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Micha, On Wed, Sep 12, 2007 at 01:09:57PM +0200, Micha=EBl Cadilhac wrote: > > Ah, okay. So what about an (&optional filename) for this function? > > And if it's true, the character set to be translated is "[*\"()',=3D;? = ]" and > > percent is also encoded. If ommited (nil), just "[,)$]" will be transl= ated. > > > > How does that sound? >=20 > Yeah, it seems like a good idea=A0: I already added encode-percent, which > had this role but didn't integrate the regexps. Yep. > Great, so we're now here=A0: > --- browse-url.el 12 Sep 2007 10:49:04 +0200 1.61 > +++ browse-url.el 12 Sep 2007 13:04:52 +0200=09 > @@ -619,16 +619,19 @@ > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; URL encoding > =20 > -(defun browse-url-encode-url (url) > - "Encode all `confusing' characters in URL." > - (let ((encoded-url (copy-sequence url))) > - (while (string-match "%" encoded-url) > - (setq encoded-url (replace-match "%25" t t encoded-url))) > - (while (string-match "[*\"()',=3D;? ]" encoded-url) > +(defun browse-url-encode-url (url &optional filename-p) > + "Encode all `confusing' characters in URL. > +If FILENAME-P is nil, the confusing characters are [,)$]. > +Otherwise, the confusing characters are [*\"()',=3D;?% ]." > + (let ((conf-char (if filename-p "[*\"()',=3D;?% ]" "[,)$]")) > + (encoded-url (copy-sequence url)) > + (s 0)) > + (while (setq s (string-match conf-char encoded-url s)) > (setq encoded-url > (replace-match (format "%%%x" > (string-to-char (match-string 0 encoded-url))) > - t t encoded-url))) > + t t encoded-url) > + s (1+ s))) > encoded-url)) > =20 > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > @@ -703,7 +706,7 @@ > (or file-name-coding-system > default-file-name-coding-system)))) > (if coding (setq file (encode-coding-string file coding)))) > - (setq file (browse-url-encode-url file)) > + (setq file (browse-url-encode-url file 'url-is-filename)) > (dolist (map browse-url-filename-alist) > (when (and map (string-match (car map) file)) > (setq file (replace-match (cdr map) t nil file)))) Ack. Thank you! Hannes --fdj2RfSjLxBAspz7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFG58ywdvEGNHGk3KARAsgwAJ443QiWFyyZMkGmhjRQaZKCR7i+SQCff4GF Mek7t22ut6EjVbT2yEAVKGg= =YcIo -----END PGP SIGNATURE----- --fdj2RfSjLxBAspz7-- --===============1393334878== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============1393334878==--