From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: browse-url-firefox Date: Sat, 05 Jan 2008 19:43:37 +0200 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1199555022 30550 80.91.229.12 (5 Jan 2008 17:43:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Jan 2008 17:43:42 +0000 (UTC) To: steve@xemacs.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 05 18:44:02 2008 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 1JBD3x-0005kB-Go for ged-emacs-devel@m.gmane.org; Sat, 05 Jan 2008 18:44:01 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBD3b-00046Z-0T for ged-emacs-devel@m.gmane.org; Sat, 05 Jan 2008 12:43:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBD3X-00043e-AF for emacs-devel@gnu.org; Sat, 05 Jan 2008 12:43:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBD3V-00041t-HX for emacs-devel@gnu.org; Sat, 05 Jan 2008 12:43:34 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBD3V-00041q-De for emacs-devel@gnu.org; Sat, 05 Jan 2008 12:43:33 -0500 Original-Received: from nitzan.inter.net.il ([213.8.233.22]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JBD3V-0000V6-5n for emacs-devel@gnu.org; Sat, 05 Jan 2008 12:43:33 -0500 Original-Received: from HOME-C4E4A596F7 (IGLD-80-230-71-78.inter.net.il [80.230.71.78]) by nitzan.inter.net.il (MOS 3.7.3a-GA) with ESMTP id ITK03182 (AUTH halo1); Sat, 5 Jan 2008 19:41:00 +0200 (IST) In-reply-to: (message from Eli Zaretskii on Sat, 05 Jan 2008 18:31:22 +0200) X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) 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:86198 Archived-At: > Date: Sat, 05 Jan 2008 18:31:22 +0200 > From: Eli Zaretskii > Cc: emacs-devel@gnu.org > > (apply 'start-process > (concat "firefox " url) nil > browse-url-firefox-program > (append > browse-url-firefox-arguments > (if (or (featurep 'dos-w32) > (string-match "win32" system-configuration)) > (list url) > (list "-remote" > (concat "openURL(" > url > (if (browse-url-maybe-new-window > new-window) > (if browse-url-firefox-new-window-is-tab > ",new-tab" > ",new-window")) > ")"))))))) > > has the effect of invoking Firefox with the URL specified twice on the > command line (so Firefox opens it in two tabs). I think it's a bug, > and that the right fix is to not (concat "firefox " url), but to use a > literal "firefox" instead. Does anyone see where I'm wrong? > > Steve, do you have any objections to such a change? Also, why do we need to set up a process-sentinel in this case? Here's the relevant fragments from browse-url: (set-process-sentinel process `(lambda (process change) (browse-url-firefox-sentinel process ,url))))) (defun browse-url-firefox-sentinel (process url) "Handle a change to the process communicating with Firefox." (or (eq (process-exit-status process) 0) (let* ((process-environment (browse-url-process-environment))) ;; Firefox is not running - start it (message "Starting Firefox...") (apply 'start-process (concat "firefox " url) nil browse-url-firefox-program (append browse-url-firefox-startup-arguments (list url)))))) At least on MS-Windows, when an instance of Firefox is already running, invoking another one like "firefox http://foo.bar" has the effect of asking the first instance of Firefox to display http://foo.bar in another tab, and the second Firefox exits immediately. So the above sentinel has 2 adverse effects: (1) it opens http://foo.bar twice, because the sentinel is invoked when the second instance of Firefox exits, and (2) the sentinel is invoked if I close Firefox by via the window manager, at which time the sentinel starts Firefox again with the last URL I browsed. Is the behavior of Firefox on other platforms different? I think the right fix for this is to set-process-sentinel to nil. Any objections?