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/net/browse-url.el: Bugfixes regarding Elinks support (improved resend) Date: Mon, 17 Sep 2007 14:48:43 +0200 Message-ID: <20070917124843.GA26157@saeurebad.de> References: <20070914105143.GA5686@saeurebad.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="TB36FDmn/VVEgNH/" X-Trace: sea.gmane.org 1190033372 3325 80.91.229.12 (17 Sep 2007 12:49:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 Sep 2007 12:49:32 +0000 (UTC) To: Emacs development discussions Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 17 14:49:29 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 1IXG2a-0003GA-V9 for ged-emacs-devel@m.gmane.org; Mon, 17 Sep 2007 14:49:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXG2Z-0003sS-PL for ged-emacs-devel@m.gmane.org; Mon, 17 Sep 2007 08:49:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IXG1z-0003g4-8U for emacs-devel@gnu.org; Mon, 17 Sep 2007 08:48:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IXG1x-0003fU-Ig for emacs-devel@gnu.org; Mon, 17 Sep 2007 08:48:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXG1x-0003fQ-A9 for emacs-devel@gnu.org; Mon, 17 Sep 2007 08:48:49 -0400 Original-Received: from saeurebad.de ([85.214.36.134]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IXG1w-0003so-NP for emacs-devel@gnu.org; Mon, 17 Sep 2007 08:48:49 -0400 Original-Received: by saeurebad.de (Postfix, from userid 1000) id A74D82F0146; Mon, 17 Sep 2007 14:48:43 +0200 (CEST) Mail-Followup-To: Emacs development discussions Content-Disposition: inline In-Reply-To: <20070914105143.GA5686@saeurebad.de> 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:79096 Archived-At: --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, here is an improved revision of the patch that fixes several tiny mistakes in lisp/net/browse-url.el regarding the new Elinks support. The current browse-url-elinks function is broken! Patch including ChangeLog entry attached. Hannes --TB36FDmn/VVEgNH/ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: inline; filename="emacs-browse-url-elinks-fixes-r1.patch" Index: lisp/ChangeLog =================================================================== RCS file: /sources/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.11766 diff -u -r1.11766 ChangeLog --- lisp/ChangeLog 17 Sep 2007 07:02:35 -0000 1.11766 +++ lisp/ChangeLog 17 Sep 2007 12:43:49 -0000 @@ -1,3 +1,11 @@ +2007-09-17 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'. Fix typo in doc-string. + (browse-url-elinks-sentinel): Use browse-url-elinks-new-window. + Improved error message. + 2007-09-17 Glenn Morris * textmodes/tex-mode.el (tex-compilation-parse-errors): Prefer the Index: lisp/net/browse-url.el =================================================================== 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 17 Sep 2007 12:43:50 -0000 @@ -1512,8 +1512,16 @@ (apply #'start-process (concat "KDE " url) nil browse-url-kde-program (append browse-url-kde-args (list url)))) +(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. @@ -1521,36 +1529,34 @@ none yet running, a newly started instance. The Elinks command will be prepended by the program+arguments -from `elinks-browse-url-wrapper'." +from `browse-url-elinks-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)))))) (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))))) (provide 'browse-url) --TB36FDmn/VVEgNH/ 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 --TB36FDmn/VVEgNH/--