emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Firefox 36 and Links


From: Stefan-W. Hahn
Subject: Re: [O] Firefox 36 and Links
Date: Sun, 1 Mar 2015 09:09:01 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Mail von Scott Randby, Thu, 26 Feb 2015 at 17:23:56 -0500:

Hello,

> I know this isn't exactly a question about org, but it affects org,
> so I'm hoping someone on this list might be willing to help me.
> 
> The -remote command line option has been removed from Firefox 36:

I ran in the same problem on linux. 

> I can't get the patch to work with Emacs 24.3 or 24.2. This could be
> due to my very poor knowledge of elisp or that the patch isn't
> compatible with those versions of Emacs.

I worked around it with a little elisp:

#+BEGIN_SRC elisp
(use-package browse-url
  :if running-linux
  :init
  (progn
    (let ((str (shell-command-to-string "firefox -v")))
      (when (and (string-match "Mozilla Firefox \\([0-9]+\\)\\.[0-9]+" str)
                 (>= (string-to-number (match-string 1 str)) 36))
        (advice-add 'browse-url-firefox :around 'browse-url-firefox-version-36)
        (message "Advice added for `browse-url-firefox' to call firefox >= v36")
        ))
    )
  :config
  (progn

    (defun browse-url-firefox-version-36 (orig-fun url &optional new-window)
      "Linux version of firefox (>=v36.0) does not know the command
  \"-remote openURL(...)\". So act in linux as on windows and
  give just the requested URL as command line parameter."
      (let ((system-type 'windows-nt))
        (apply orig-fun url new-window)))
    )
  )

#+END_SRC

If you're not using "use-package" then the following minimal code will suffice:

#+BEGIN_SRC elisp

  (require 'browse-url)
  (advice-add 'browse-url-firefox :around 'browse-url-firefox-version-36)
  (defun browse-url-firefox-version-36 (orig-fun url &optional new-window)
    "Linux version of firefox (>=v36.0) does not know the command
      \"-remote openURL(...)\". So act in linux as on windows and
      give just the requested URL as command line parameter."
    (let ((system-type 'windows-nt))
      (apply orig-fun url new-window)))

#+END_SRC

With kinde regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]