From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: michael@cadilhac.name (=?iso-8859-1?Q?Micha=EBl?= Cadilhac) Newsgroups: gmane.emacs.devel Subject: Your last change to browse-url is bogus. Date: Wed, 12 Sep 2007 11:13:42 +0200 Organization: Epita/LRDE Message-ID: <87zlzs2qm1.fsf@cadilhac.name> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1538494804==" X-Trace: sea.gmane.org 1189588717 22979 80.91.229.12 (12 Sep 2007 09:18:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Sep 2007 09:18:37 +0000 (UTC) Cc: Johannes Weiner To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 12 11:18:32 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 1IVOMd-0006PF-Qx for ged-emacs-devel@m.gmane.org; Wed, 12 Sep 2007 11:18:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVOMd-0004Dt-HG for ged-emacs-devel@m.gmane.org; Wed, 12 Sep 2007 05:18:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IVOLv-0003m6-8X for emacs-devel@gnu.org; Wed, 12 Sep 2007 05:17:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IVOLq-0003jn-EE for emacs-devel@gnu.org; Wed, 12 Sep 2007 05:17:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVOLq-0003jk-A5 for emacs-devel@gnu.org; Wed, 12 Sep 2007 05:17:38 -0400 Original-Received: from smtp3-g19.free.fr ([212.27.42.29]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IVOLp-0001YM-QK for emacs-devel@gnu.org; Wed, 12 Sep 2007 05:17:38 -0400 Original-Received: from smtp3-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp3-g19.free.fr (Postfix) with ESMTP id 126B15A19B; Wed, 12 Sep 2007 11:17:34 +0200 (CEST) Original-Received: from localhost (ivr94-6-82-230-255-91.fbx.proxad.net [82.230.255.91]) by smtp3-g19.free.fr (Postfix) with ESMTP id A07B85A164; Wed, 12 Sep 2007 11:17:33 +0200 (CEST) X-Website: http://michael.cadilhac.name Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVWPh+Tai+5r5YKBAEU CQQzGAtiq7gjAAACR0lEQVQ4jW2UzW7lIAyFzVW8BzTZX5DmCZLuU2H2pMXv/ypzbK7aSh2kRCRf /HNsE0q7Sg+RQ7JFKaqtrRNAl5AIIKe6D5DBqgbmUAe5hBI1wIRFAHjeM0RKtZi7XVVEpb0BSNfA IddChChT5DildSLWOWhY5IEItMnncZgFcUAc/5jjwCMsDosRNdfKPDTFEdVBW8C+RebDb4N5Orio RhM1+11IJyx0ng2+LryFHBMPDQDYHrY6IfGuU3ouiXTQNE8LIJDKOWpNxERTFrggQwRPd7USUsTW fJ0XbR3bdj5KgBYy4SACpxDeUYEUAzLmtJ1iIrD2gczPq8Qomjhsh/RjGIgKIO8p7NITjwlx7WID nsnQe5NeuTvoBpi8LX6vLLOh5icjOHqBypgnuSp7M+RE1agbQKHQr5E2z1WObhYW4gMqeGQL7joM jCf2DxSk5ApADSYHfFF4igNfJZL1z0GKP0FN02s4XiDXr7V5P94W6I9v8MfBOQDmfwAaVYt+x8Da v4DJvX8BAdin3Knm5yMZYAO4ABDkDniZLLfi4P40gP1F0TPGZOu0CGwA1lcowxwlGy6A9705mD0V jHCxwVZT/hYdRJVUGZNlx6l7ScQBTluof6Wj6bsPYlvpwoTvXFD9gHPn2TZPF3ntI2ecxVrW5MrV XiCie5EeNa7BlWu/HNSkprDUva163PHxAv5jyGV7gVzyAghSKOTnat85UIYFICXbD2NV9rRiv0BS tKQsg6OHH4A15F1WW+UHKHHa32h6aPnAm3/pUcWp+WYnTQAAAABJRU5ErkJggg== User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux) X-Detected-Kernel: Linux 2.4-2.6 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:78650 Archived-At: --===============1538494804== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable This change: +2007-09-07 Johannes Weiner + + * net/browse-url.el (browse-url-browser-function): Add elinks. + (browse-url-elinks-wrapper): New option. + (browse-url-encode-url, browse-url-elinks) + (browse-url-elinks-sentinel): New functions. + (browse-url-file-url, browse-url-netscape, browse-url-mozilla) + (browse-url-firefox, browse-url-galeon, browse-url-epiphany): Use + new function browse-url-encode-url. + (the addition of browse-url-encode-url) creates some bugs=A0: 1. This: (while (string-match "%" encoded-url) (setq encoded-url (replace-match "%25" t t encoded-url))) is an infinite loop. 2. The URL=20 "http://www.benzedrine.cx/lookandsay?SAME%20AS%201069" for example, is translated to "http://www.benzedrine.cx/lookandsay%3fSAME%2520AS%25201069" which is utterly bogus, because the original %20 are no longer replaced by ` ' by the server and the `?' will not be parsed. I'd suggest to revert this change or, if it's for the sake of code factoring, (what was the first purpose, by the way?) use something like this: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=browse-url.patch Content-Transfer-Encoding: quoted-printable =2D-- browse-url.el 12 Sep 2007 10:49:04 +0200 1.61 +++ browse-url.el 12 Sep 2007 11:09:27 +0200=09 @@ -619,12 +619,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; URL encoding =20 =2D(defun browse-url-encode-url (url) =2D "Encode all `confusing' characters in URL." =2D (let ((encoded-url (copy-sequence url))) =2D (while (string-match "%" encoded-url) =2D (setq encoded-url (replace-match "%25" t t encoded-url))) =2D (while (string-match "[*\"()',=3D;? ]" encoded-url) +(defun browse-url-encode-url (url chars &optional encode-percent) + "Encode all `confusing' characters denoted by the regexp CHARS in URL. +If ENCODE-PERCENT is non-nil, consider `%' as a confusing char." + (let ((s 0) + (encoded-url (copy-sequence url))) + (when encode-percent + (while (setq s (string-match "%" encoded-url s)) + (setq encoded-url (replace-match "%25" t t encoded-url) + s (1+ s)))) + (while (string-match chars encoded-url) (setq encoded-url (replace-match (format "%%%x" (string-to-char (match-string 0 encoded-url))) @@ -703,7 +707,7 @@ (or file-name-coding-system default-file-name-coding-system)))) (if coding (setq file (encode-coding-string file coding)))) =2D (setq file (browse-url-encode-url file)) + (setq file (browse-url-encode-url file "[*\"()',=3D;? ]" 'encode-percent= )) (dolist (map browse-url-filename-alist) (when (and map (string-match (car map) file)) (setq file (replace-match (cdr map) t nil file)))) @@ -909,7 +913,7 @@ When called non-interactively, optional second argument NEW-WINDOW is used instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "URL: ")) =2D (setq url (browse-url-encode-url url)) + (setq url (browse-url-encode-url url "[,)$]")) (let* ((process-environment (browse-url-process-environment)) (process (apply 'start-process @@ -979,7 +983,7 @@ When called non-interactively, optional second argument NEW-WINDOW is used instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "URL: ")) =2D (setq url (browse-url-encode-url url)) + (setq url (browse-url-encode-url url "[,)$]")) (let* ((process-environment (browse-url-process-environment)) (process (apply 'start-process @@ -1037,7 +1041,7 @@ are ignored as well. Firefox on Windows will always open the requested URL in a new window." (interactive (browse-url-interactive-arg "URL: ")) =2D (setq url (browse-url-encode-url url)) + (setq url (browse-url-encode-url url "[,)$]")) (let* ((process-environment (browse-url-process-environment)) (process (apply 'start-process @@ -1089,7 +1093,7 @@ When called non-interactively, optional second argument NEW-WINDOW is used instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "URL: ")) =2D (setq url (browse-url-encode-url url)) + (setq url (browse-url-encode-url url "[,)$]")) (let* ((process-environment (browse-url-process-environment)) (process (apply 'start-process (concat "galeon " url) @@ -1134,7 +1138,7 @@ When called non-interactively, optional second argument NEW-WINDOW is used instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "URL: ")) =2D (setq url (browse-url-encode-url url)) + (setq url (browse-url-encode-url url "[,)$]")) (let* ((process-environment (browse-url-process-environment)) (process (apply 'start-process (concat "epiphany " url) @@ -1520,7 +1524,7 @@ The Elinks command will be prepended by the program+arguments from `elinks-browse-url-wrapper'." (interactive (browse-url-interactive-arg "URL: ")) =2D (setq url (browse-url-encode-url url)) + (setq url (browse-url-encode-url url "[,)$]")) (let ((process-environment (browse-url-process-environment)) (elinks-ping-process (start-process "elinks-ping" nil "elinks" "-remote" "ping()"))) --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable =2D-=20 | Micha=EBl `Micha' Cadilhac | And please suggest to him that = | | http://michael.cadilhac.name | he not refer to Microsoft Windows = | | JID/MSN: | as "win". = | `---- michael.cadilhac@gmail.com | -- RMS - = --' --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.2 (GNU/Linux) iD8DBQFG563KUJhDmOfFA3URAigOAKCmw8vIiozi3N8qb4nP4TGiFHhkOACcCr8J JIJpxLtliGhcXuhVvfLPiXg= =xkIE -----END PGP SIGNATURE----- --==-=-=-- --===============1538494804== 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 --===============1538494804==--