unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Open Firefox from Emacs on MacOSX
@ 2007-05-15 19:28 Stefan Nobis
  2007-05-15 21:11 ` Joost Kremers
  2007-05-15 21:17 ` Harald Hanche-Olsen
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Nobis @ 2007-05-15 19:28 UTC (permalink / raw)
  To: help-gnu-emacs

Hi.

I'm new to MacOSX and just tried to setup (Carbon) Emacs (22.0.97) to open a
new Firefox (2.0) tab for e.g. browse-url-at-point:

  (setq browse-url-browser-function 'browse-url-firefox)
  (setq browse-url-firefox-program "/Applications/Firefox.app/Contents/MacOS/firefox")

This doesn't work. I read that Firefox on Windows doesn't support the
-remote option and it seems, this is the case on MacOSX, too. Is this
assumption right and has anyone an idea how to workaround this
inconvenience?

-- 
Stefan.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Open Firefox from Emacs on MacOSX
  2007-05-15 19:28 Open Firefox from Emacs on MacOSX Stefan Nobis
@ 2007-05-15 21:11 ` Joost Kremers
  2007-05-15 22:42   ` Peter Dyballa
  2007-05-15 21:17 ` Harald Hanche-Olsen
  1 sibling, 1 reply; 7+ messages in thread
From: Joost Kremers @ 2007-05-15 21:11 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Nobis wrote:
> This doesn't work. I read that Firefox on Windows doesn't support the
> -remote option and it seems, this is the case on MacOSX, too. Is this
> assumption right and has anyone an idea how to workaround this
> inconvenience?

not a solution, but perhaps a hint that may help in finding one: on my
linux box, firefox (version 2.0.0.2) doesn't require the -remote option
anymore. i can type 'firefox <some_url>' in a terminal window, and the
running instance of firefox will open <some_url> in a new tab. i'd find it
weird if that didn't work on OS X.


-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Open Firefox from Emacs on MacOSX
  2007-05-15 19:28 Open Firefox from Emacs on MacOSX Stefan Nobis
  2007-05-15 21:11 ` Joost Kremers
@ 2007-05-15 21:17 ` Harald Hanche-Olsen
  2007-05-15 22:39   ` Nikolaj Schumacher
                     ` (2 more replies)
  1 sibling, 3 replies; 7+ messages in thread
From: Harald Hanche-Olsen @ 2007-05-15 21:17 UTC (permalink / raw)
  To: help-gnu-emacs

+ Stefan Nobis <snobis@gmx.de>:

| I'm new to MacOSX and just tried to setup (Carbon) Emacs (22.0.97) to open a
| new Firefox (2.0) tab for e.g. browse-url-at-point:
|
|   (setq browse-url-browser-function 'browse-url-firefox)
|   (setq browse-url-firefox-program "/Applications/Firefox.app/Contents/MacOS/firefox")
|
| This doesn't work. I read that Firefox on Windows doesn't support the
| -remote option and it seems, this is the case on MacOSX, too. Is this
| assumption right and has anyone an idea how to workaround this
| inconvenience?

I run emacs 23, so I am not sure this is in emacs 22, but I think it's
likely, in which case something like this works for me:

(defun browse-url-firefox-on-mac (url &rest ignored)
  (do-applescript
   (format "tell application \"Firefox\" to Get URL \"%s\"" url)))
(setq browse-url-browser-function 'browse-url-firefox-on-mac)

Not sure what to do with any extra arguments.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Open Firefox from Emacs on MacOSX
  2007-05-15 21:17 ` Harald Hanche-Olsen
@ 2007-05-15 22:39   ` Nikolaj Schumacher
       [not found]   ` <mailman.719.1179269285.32220.help-gnu-emacs@gnu.org>
  2007-05-16 11:50   ` Stefan Nobis
  2 siblings, 0 replies; 7+ messages in thread
From: Nikolaj Schumacher @ 2007-05-15 22:39 UTC (permalink / raw)
  To: help-gnu-emacs

Harald Hanche-Olsen <hanche@math.ntnu.no> writes:

> + Stefan Nobis <snobis@gmx.de>:
>
> | I'm new to MacOSX and just tried to setup (Carbon) Emacs (22.0.97) to open a
> | new Firefox (2.0) tab for e.g. browse-url-at-point:
> |
> |   (setq browse-url-browser-function 'browse-url-firefox)
> |   (setq browse-url-firefox-program "/Applications/Firefox.app/Contents/MacOS/firefox")
> |
> I run emacs 23, so I am not sure this is in emacs 22, but I think it's
> likely, in which case something like this works for me:
>
> (defun browse-url-firefox-on-mac (url &rest ignored)
>   (do-applescript
>    (format "tell application \"Firefox\" to Get URL \"%s\"" url)))
> (setq browse-url-browser-function 'browse-url-firefox-on-mac)
>
> Not sure what to do with any extra arguments.

I'm using the latest Emacs 22 from CVS, and `browse-url-at-point' works
out of the box.  It uses `browse-url-default-macosx-browser'.  If you
need to specify Firefox, you just need add an argument to the "open"
command.

(defun browse-url-firefox-macosx (url &optional new-window)
  (interactive (browse-url-interactive-arg "URL: "))
  (start-process (concat "open -a Firefox" url) nil "open" url))

(setq browse-url-browser-function 'browse-url-firefox-macosx)


regards,
Nikolaj Schumacher

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Open Firefox from Emacs on MacOSX
  2007-05-15 21:11 ` Joost Kremers
@ 2007-05-15 22:42   ` Peter Dyballa
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2007-05-15 22:42 UTC (permalink / raw)
  To: Emacs Help [help-gnu-emacs]


Am 15.05.2007 um 23:11 schrieb Joost Kremers:

> Stefan Nobis wrote:
>> This doesn't work. I read that Firefox on Windows doesn't support the
>> -remote option and it seems, this is the case on MacOSX, too. Is this
>> assumption right and has anyone an idea how to workaround this
>> inconvenience?
>
> not a solution, but perhaps a hint that may help in finding one: on my
> linux box, firefox (version 2.0.0.2) doesn't require the -remote  
> option
> anymore. i can type 'firefox <some_url>' in a terminal window, and the
> running instance of firefox will open <some_url> in a new tab. i'd  
> find it
> weird if that didn't work on OS X.
>

The trick on Mac OS X seems to be to use the *real* files inside the  
application bundle.

When Firefox is /Applications/Firefox.app in the HFS+ file system,  
then it has s Bourne shell script that accepts arguments like in:

	/Applications/Firefox.app/Contents/MacOS/firefox http://some.where


Usually one would try

	open -a /Applications/Firefox.app [-remote] http://some.where

but this seems to fail because Apple's Launch Services take  
particularly the URL very serious and pass it to the *default*  
application for this kind of object, maybe Safari, or whatever has  
been set as default browser for the object type "URL."

--
Mit friedvollen Grüßen

   Pete

"Eternity is a terrible thought. I mean, where's it going to end?"
                                             - Tom Stoppard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Open Firefox from Emacs on MacOSX
       [not found]   ` <mailman.719.1179269285.32220.help-gnu-emacs@gnu.org>
@ 2007-05-15 23:23     ` Harald Hanche-Olsen
  0 siblings, 0 replies; 7+ messages in thread
From: Harald Hanche-Olsen @ 2007-05-15 23:23 UTC (permalink / raw)
  To: help-gnu-emacs

+ Nikolaj Schumacher <n_schumacher@web.de>:

| I'm using the latest Emacs 22 from CVS, and `browse-url-at-point' works
| out of the box.  It uses `browse-url-default-macosx-browser'.

Oh, I see.  I had noticed that the value browse-url-browser-function
was set to browse-url-default-macosx-browser, but was puzzled because
the latter symbol was neither bound nor fbound - and then I managed to
crash my emacs as I tried it anyway, and jumped to the wrong
conclusion. (It seems that browse-url.el is autoloaded at some point,
which explains the lack of bindings when I looked.)

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Open Firefox from Emacs on MacOSX
  2007-05-15 21:17 ` Harald Hanche-Olsen
  2007-05-15 22:39   ` Nikolaj Schumacher
       [not found]   ` <mailman.719.1179269285.32220.help-gnu-emacs@gnu.org>
@ 2007-05-16 11:50   ` Stefan Nobis
  2 siblings, 0 replies; 7+ messages in thread
From: Stefan Nobis @ 2007-05-16 11:50 UTC (permalink / raw)
  To: help-gnu-emacs

Harald Hanche-Olsen <hanche@math.ntnu.no> writes:

> (defun browse-url-firefox-on-mac (url &rest ignored)
>   (do-applescript
>    (format "tell application \"Firefox\" to Get URL \"%s\"" url)))
> (setq browse-url-browser-function 'browse-url-firefox-on-mac)

Thank you very much, this works also in (Carbon) Emacs 22.0.97. Nice
extra: It ignores the system default browser.

-- 
Stefan.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-16 11:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-15 19:28 Open Firefox from Emacs on MacOSX Stefan Nobis
2007-05-15 21:11 ` Joost Kremers
2007-05-15 22:42   ` Peter Dyballa
2007-05-15 21:17 ` Harald Hanche-Olsen
2007-05-15 22:39   ` Nikolaj Schumacher
     [not found]   ` <mailman.719.1179269285.32220.help-gnu-emacs@gnu.org>
2007-05-15 23:23     ` Harald Hanche-Olsen
2007-05-16 11:50   ` Stefan Nobis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).