unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Richard Molen <noSpam@spamAndPotatoes.com>
Subject: Re: get browse-url to use mozilla-firebird
Date: Fri, 13 Feb 2004 00:11:38 GMT	[thread overview]
Message-ID: <m3d68j7s91.fsf@localhost.localdomain> (raw)
In-Reply-To: m3hdxw6q43.fsf@localhost.localdomain

Richard Molen <noSpam@spamAndPotatoes.com> writes:

> How do I convince emacs 2.3.1's browse-url-at-point to use 
> the mozilla-firebird browser instead of the mozilla one?
> 
> This works great for Mozilla.
> 
>    ; Use Mozilla as default browser on Red Hat 7.3 or 8.0 Linux w/
>    ; Gnome support.  (For Emacs 21.2.1 and 21.3.1)
>      (setq browse-url-browser-function 'browse-url-gnome-moz)
> 
> After 'Google'ing I found some help on getting mozilla-firebird to act
> the same way.  This is what I have now.
> 
>    ; Use Mozilla Firebird (was Phoenix) on Fedora Core 1
>      (defun browse-url-mozilla-firebird (url arg)
>        (shell-command 
>          (format "/usr/bin/mozilla-firebird -remote 'openURL(%s, new-tab)'" 
>             url)))
>      (setq browse-url-browser-function 'browse-url-mozilla-firebird)
> 
> The browse-url-gnome-moz functions calls the GNOME program
> gnome-moz-remote rather than directly calling /usr/bin/mozilla.  This
> which seems undesirable to me (since I occasionally use KDE too).
> 

Well I've answered my own question (to my satisfaction at least).
I thought it could be done in an emacs function, but this setup
seems to work.  

Do the following to make Mozilla Firebird (now called Firefox) the
browser that emacs uses when using 'browse-url-at-point' and such.

This allows the emacs user to:
1. open the URL in a browser if no browser is open yet.
2. opoen the URL in a tab of the browser if it is already open.

Firebird allows opening a tab (new web page) in the background while
keeping the alredy opened page in view.  For better or worse, this
code does not do background loading.  

This code works in GNOME or KDE, so long as GNOME is installed.  It
should work on Red Hat and Fedora Core Linux boxes.  If you are using
the latest version of 'Firebird' then change the names to Firefox as
appropriate. A free bonus hack for default GNOME-Nautilus browser is
offered at the end too.

...as root, make a bash script...

emacs /usr/bin/firebird-remote

...paste in the following. If confused, read the URLs....

----------------- cut -------------------------
#!/bin/sh
# For starting firebird as default browser in gnome
# http://www.mozilla.org/unix/remote.html
# http://lists.freebsd.org/pipermail/freebsd-gnome/2003-November/003907.html

FIREBIRD_NAME="firebird"
#FIREBIRD_NAME="firefox"

FIREBIRD_CMD="/usr/bin/mozilla-$FIREBIRD_NAME"

if [ "$1x" = "x" ]; then
        URL="about:black"
else   
        URL=$1
fi
FIREBIRD_REMOTE="openURL(${URL},new-tab)"

${FIREBIRD_CMD} -remote "ping()"  && ${FIREBIRD_CMD} -remote ${FIREBIRD_REMOTE} && exit 0

${FIREBIRD_CMD} ${URL}

exit 0

# http://linuxgazette.net/issue97/shekhar.html -- suggests this code
/usr/lib/mozilla-firebird/MozillaFirebird  -remote "openURL($@, new-tab)" ||
exec /usr/lib/mozilla-firebird/MozillaFirebird "$@" ;
----------------- cut -------------------------

...make it executable...

chmod a+x

...in your home directory...

cd ~/.gnome

... make this file...

emacs gnome-moz-remote

...paste this in...
----------------- cut -------------------------
[Mozilla]
filename=/usr/bin/firebird-remote
NEEDS_TERM=false
NREMOTE=true
----------------- cut -------------------------

...in your initialization file...

emacs .emacs

----------------- cut -------------------------
; Use Mozilla as default browser for emacs 21.2.1, 21.3.1
; On Red Hat Linux 7.3, 8.0, 9, and Fedora Core 1 Linux
; Needs Gnome support: gnome-moz-remote to run in Gnome or KDE
; Also /usr/bin/firebird-remote & ~/.gnome/gnome-moz-remote
  (setq 
   browse-url-browser-function 'browse-url-gnome-moz
   browse-url-generic-program nil
   browse-url-netscape-display nil
   browse-url-new-window-flag nil
   browse-url-save-file nil
  )
----------------- cut -------------------------

...test with these URLs...

www.yahoo.com
www.google.com
http://www.mozilla.org/unix/remote.html

...and as a bonus, to get firebird working with GNOME 2.4 and Nautilus
2.4 on Fedora Core 1 (and presumably RedHat), I had to do the
following...

1. Open the 'Home' folder on the desktop.  This displays my home dir.

2. find an html file and right-click, select Open With..., Other
   Application..., Go There...

3. Edit file type: select Default action: Custom and enter 'firebird-remote'
   for the 'Program to run', select 'OK'.

4. Open "Start Here" on the desktop and select "Preferred Applications".
   Select "Web Browser" tab and choose "Custom Web Browser" and enter
   Command: firebird-remote %s   ...then choose close.

5. While it may not be needed, I logged out of GNOME, logged out and
   then logged back in and ran 'startx'.

...I'm hardly a GNOME expert, perhaps there is a cleaner way to do this...

That's it.
-- 
        {{},             Richard Molen
       (@ @) 
       ,.(_),.           "Furious activity is no substitute for 
  / / ooOo oOoo \  \      understanding" -- H. H. Williams
 / /_____________\  \
/  '             '

      reply	other threads:[~2004-02-13  0:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-12 19:43 get browse-url to use mozilla-firebird Richard Molen
2004-02-13  0:11 ` Richard Molen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3d68j7s91.fsf@localhost.localdomain \
    --to=nospam@spamandpotatoes.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).