[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

firefox1.5 & browse-url


firefox 1.5 がリリース [1] されたのでインストールした所
emacs-w3m から外部ブラウザーとして firefox を起動させる
(M-x w3m-view-url-with-external-browser) ことができなく

原因は、firefox 1.5 が -remote オプションをやめて
-new-tab オプションを使うようになった [2] ことと
その変更に (emacs-w3m が呼んでいる) browse-url.el が

とりあえず、下記のコードを .emacs に入れて
急場を凌いでいます [3]。

とり急ぎ、お知らせ (?) まで。

[1]  http://slashdot.jp/article.pl?sid=05/11/30/0041209

[2]  http://www.mozilla-japan.org/products/firefox/releases/1.5.html

[3]  http://at-aka.blogspot.com/2005/11/emacs-browse-url-firefox-15.html

                                    ----Input with T-Code!
     Masayuki Ataka / 安宅 正之 (ataka@xxxxxxxxxxxxxxxxxxx)

(eval-after-load "browse-url"
(defun browse-url-firefox (url &optional new-window)
  "Ask the Firefox WWW browser to load URL.
Default to the URL around or before point.  The strings in
variable `browse-url-firefox-arguments' are also passed to

When called interactively, if variable
`browse-url-new-window-flag' is non-nil, load the document in a
new Firefox window, otherwise use a random existing one.  A
non-nil interactive prefix argument reverses the effect of

If `browse-url-firefox-new-window-is-tab' is non-nil, then
whenever a document would otherwise be loaded in a new window, it
is loaded in a new tab in an existing window instead.

When called non-interactively, optional second argument
NEW-WINDOW is used instead of `browse-url-new-window-flag'.

On MS-Windows systems the optional `new-window' parameter is
ignored.  Firefox for Windows does not support the \"-remote\"
command line parameter.  Therefore, the
`browse-url-new-window-flag' and `browse-url-firefox-new-window-is-tab'
are ignored as well.  Firefox on Windows will always open the requested
URL in a new window."
  (interactive (browse-url-interactive-arg "URL: "))
  ;; URL encode any `confusing' characters in the URL.  This needs to
  ;; include at least commas; presumably also close parens.
  (while (string-match "[,)]" url)
    (setq url (replace-match
        (format "%%%x" (string-to-char (match-string 0 url))) t t url)))
  (let* ((process-environment (browse-url-process-environment))
   (apply 'start-process
   (concat "firefox " url) nil
    (if (or (featurep 'dos-w32)
     (string-match "win32" system-configuration))
        (list url)
      (list (if (browse-url-maybe-new-window
         (if browse-url-firefox-new-window-is-tab
     url ))))))
    (set-process-sentinel process
     `(lambda (process change)
        (browse-url-firefox-sentinel process ,url)))))