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: [PATCH] lisp/browse-url.el: Revisiting my elinks addition Date: Fri, 14 Sep 2007 12:51:43 +0200 Message-ID: <20070914105143.GA5686@saeurebad.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0482182787==" X-Trace: sea.gmane.org 1189767119 14438 80.91.229.12 (14 Sep 2007 10:51:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 14 Sep 2007 10:51:59 +0000 (UTC) To: Emacs development discussions Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 14 12:51: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 1IW8m9-0004qi-VI for ged-emacs-devel@m.gmane.org; Fri, 14 Sep 2007 12:51:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IW8m9-0003Ng-5K for ged-emacs-devel@m.gmane.org; Fri, 14 Sep 2007 06:51:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IW8m5-0003Mz-QJ for emacs-devel@gnu.org; Fri, 14 Sep 2007 06:51:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IW8m5-0003MF-2V for emacs-devel@gnu.org; Fri, 14 Sep 2007 06:51:49 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IW8m4-0003MC-U7 for emacs-devel@gnu.org; Fri, 14 Sep 2007 06:51:48 -0400 Original-Received: from saeurebad.de ([85.214.36.134]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IW8m4-0004VO-7G for emacs-devel@gnu.org; Fri, 14 Sep 2007 06:51:48 -0400 Original-Received: by saeurebad.de (Postfix, from userid 1000) id EB53F2F0146; Fri, 14 Sep 2007 12:51:43 +0200 (CEST) Mail-Followup-To: Emacs development discussions 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:78858 Archived-At: --===============0482182787== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LyciRD1jyfeSSjG0" Content-Disposition: inline --LyciRD1jyfeSSjG0 Content-Type: multipart/mixed; boundary="VS++wcV0S1rZb1Fb" Content-Disposition: inline --VS++wcV0S1rZb1Fb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, attached is a patch that fixes some issues with the new elinks support in browse-url.el. Please see the patch, it includes a lisp/ChangeLog entry. Hannes --VS++wcV0S1rZb1Fb Content-Type: text/x-diff; charset=us-ascii Content-Disposition: inline; filename="emacs-browse-url-elinks-fixes.patch" Content-Transfer-Encoding: quoted-printable Index: lisp/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /sources/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.11743 diff -u -r1.11743 ChangeLog --- lisp/ChangeLog 14 Sep 2007 08:10:15 -0000 1.11743 +++ lisp/ChangeLog 14 Sep 2007 10:50:15 -0000 @@ -1,3 +1,11 @@ +2007-09-14 Johannes Weiner + + * net/browse-url.el (browse-url-elinks-new-window): New function. + (browse-url-elinks): Use browse-url-elinks-new-window. Accept + optional second argument `new-window'. + (browse-url-elinks-sentinel): Use browse-url-elinks-new-window. + Improved error message. + 2007-09-14 Glenn Morris =20 * startup.el (fancy-startup-text, fancy-about-text): Fix face Index: lisp/net/browse-url.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /sources/emacs/emacs/lisp/net/browse-url.el,v retrieving revision 1.62 diff -u -r1.62 browse-url.el --- lisp/net/browse-url.el 12 Sep 2007 11:48:22 -0000 1.62 +++ lisp/net/browse-url.el 14 Sep 2007 10:50:15 -0000 @@ -1512,8 +1512,16 @@ (apply #'start-process (concat "KDE " url) nil browse-url-kde-program (append browse-url-kde-args (list url)))) =20 +(defun browse-url-elinks-new-window (url) + "Ask the Elinks WWW browser to load URL in a new window." + (let ((process-environment (browse-url-process-environment))) + (apply #'start-process + (append (list (concat "elinks:" url) nil) + browse-url-elinks-wrapper + (list "elinks" url))))) + ;;;###autoload -(defun browse-url-elinks (url) +(defun browse-url-elinks (url &optional new-window) "Ask the Elinks WWW browser to load URL. Default to the URL around the point. =20 @@ -1524,33 +1532,31 @@ from `elinks-browse-url-wrapper'." (interactive (browse-url-interactive-arg "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()"))) - (set-process-sentinel elinks-ping-process - `(lambda (process change) - (browse-url-elinks-sentinel process ,url))))) + (if new-window + (browse-url-elinks-new-window url) + (let ((process-environment (browse-url-process-environment)) + (elinks-ping-process (start-process "elinks-ping" nil + "elinks" "-remote" "ping()"))) + (set-process-sentinel elinks-ping-process + `(lambda (process change) + (browse-url-elinks-sentinel process ,url)))))) =20 (defun browse-url-elinks-sentinel (process url) "Determines if Elinks is running or a new one has to be started." - (let ((exit-status (process-exit-status process)) - (process-environment (browse-url-process-environment))) - ;; Try to determine if an instance is running or if we have to - ;; create a new one. + (let ((exit-status (process-exit-status process))) (case exit-status (5 ;; No instance, start a new one. - (apply #'start-process - (append (list (concat "elinks:" url) nil) - browse-url-elinks-wrapper - (list "elinks" url)))) + (browse-url-elinks-new-window url)) (0 ;; Found an instance, open URL in new tab. - (start-process (concat "elinks:" url) nil - "elinks" "-remote" - (concat "openURL(\"" url "\",new-tab)"))) + (let ((process-environment (browse-url-process-environment))) + (start-process (concat "elinks:" url) nil + "elinks" "-remote" + (concat "openURL(\"" url "\",new-tab)")))) (otherwise - (error "Undefined exit-code of process `elinks'."))))) + (error "Unrecognized exit-code %d of process `elinks'." + exit-status))))) =20 (provide 'browse-url) =20 --VS++wcV0S1rZb1Fb-- --LyciRD1jyfeSSjG0 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) iD8DBQFG6me/dvEGNHGk3KARAs6fAKCZ67aoYbIihtcXpuZCmvBJdmVDdACfb8W1 fX40xrJuMCFPfr6IjeAHNPk= =48sj -----END PGP SIGNATURE----- --LyciRD1jyfeSSjG0-- --===============0482182787== 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 --===============0482182787==--