emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Firefox 36 and Links
@ 2015-02-26 22:23 Scott Randby
  2015-02-26 23:12 ` Nick Dokos
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Scott Randby @ 2015-02-26 22:23 UTC (permalink / raw)
  To: emacs-orgmode

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:

 
https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#-remote_remote_command

As a result, web links in an org file no longer open in Firefox when I 
click on them. This is mentioned as a comment at the following link:

   https://bugzilla.mozilla.org/show_bug.cgi?id=1080319#c19

I found a patch here:

   http://comments.gmane.org/gmane.emacs.bugs/99694

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 see that the patch has been put into 24.5, but I'd prefer to use a 
stable version of Emacs.

I'm confused about how to proceed. Should I wait for the next stable 
release of Emacs, or is there a solution I can use now?

Scott Randby

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

* Re: Firefox 36 and Links
  2015-02-26 22:23 Firefox 36 and Links Scott Randby
@ 2015-02-26 23:12 ` Nick Dokos
  2015-02-26 23:50   ` Scott Randby
  2015-02-26 23:23 ` Nick Dokos
  2015-03-01  8:09 ` Stefan-W. Hahn
  2 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2015-02-26 23:12 UTC (permalink / raw)
  To: emacs-orgmode

Scott Randby <srandby@gmail.com> writes:

> ...
> I found a patch here:
>
>   http://comments.gmane.org/gmane.emacs.bugs/99694
>
> 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.
>

Does the patch not apply cleanly? Or it does, but the resulting function
does not work as expected? How exactly is it broken?

Nick

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

* Re: Firefox 36 and Links
  2015-02-26 22:23 Firefox 36 and Links Scott Randby
  2015-02-26 23:12 ` Nick Dokos
@ 2015-02-26 23:23 ` Nick Dokos
  2015-02-26 23:33   ` Nick Dokos
  2015-03-01  8:09 ` Stefan-W. Hahn
  2 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2015-02-26 23:23 UTC (permalink / raw)
  To: emacs-orgmode

Scott Randby <srandby@gmail.com> writes:

>   http://comments.gmane.org/gmane.emacs.bugs/99694
>
> 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.
>

Oh, it's probably that gmane replaces "@" signs with "<at>" to confuse
stupid address harvesters (which it will probably do to this message as
well :) ).

Try getting the patch from the emacs bug mailing list:

http://lists.gnu.org/archive/html/bug-gnu-emacs/2015-02/msg00751.html

Nick

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

* Re: Firefox 36 and Links
  2015-02-26 23:23 ` Nick Dokos
@ 2015-02-26 23:33   ` Nick Dokos
  2015-02-27  0:04     ` Scott Randby
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2015-02-26 23:33 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Scott Randby <srandby@gmail.com> writes:
>
>>   http://comments.gmane.org/gmane.emacs.bugs/99694
>>
>> 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.
>>
>
> Oh, it's probably that gmane replaces "@" signs with "<at>" to confuse
> stupid address harvesters (which it will probably do to this message as
> well :) ).
>
> Try getting the patch from the emacs bug mailing list:
>
> http://lists.gnu.org/archive/html/bug-gnu-emacs/2015-02/msg00751.html
>

... and if whitespace is a problem, try ignoring it:

 patch -p1 -l < browse-url.patch 

or

 git apply --ignore-whitespace browse-url.patch
 
worked for me on 24.3.

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

* Re: Firefox 36 and Links
  2015-02-26 23:12 ` Nick Dokos
@ 2015-02-26 23:50   ` Scott Randby
  0 siblings, 0 replies; 7+ messages in thread
From: Scott Randby @ 2015-02-26 23:50 UTC (permalink / raw)
  To: emacs-orgmode

Since I don't really know how to apply a patch properly, I tried the 
following.

1. I found the lines in browse-url.el that the message discusses, 
deleted the "-" lines and added the "+" lines.

2. I tried C-x C-e and I tried putting the new browse-url.el file into 
the lisp/net directory (getting rid of the old browse-url files) and 
restarting Emacs, but I get this message when I click on a link in an 
org file:

   Wrong type argument: stringp, nil



On 02/26/2015 06:12 PM, Nick Dokos wrote:
> Scott Randby <srandby@gmail.com> writes:
>
>> ...
>> I found a patch here:
>>
>>    http://comments.gmane.org/gmane.emacs.bugs/99694
>>
>> 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.
>>
>
> Does the patch not apply cleanly? Or it does, but the resulting function
> does not work as expected? How exactly is it broken?

Since I don't really know how to apply a patch properly, I tried the 
following.

1. I found the lines in browse-url.el that the message discusses, 
deleted the "-" lines and added the "+" lines.

2. I tried C-x C-e (which returns browse-url-firefox with no errors) and 
then I tried putting the new browse-url.el file into the lisp/net 
directory (getting rid of the old browse-url files) and restarting 
Emacs, but both ways give this message when I click on a link in an org 
file:

   Wrong type argument: stringp, nil

Honestly, I have no idea if what I tried is even reasonable.

Here is the relevant code in the new browse-url.el file after I deleted 
and added:

(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
Firefox.

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
`browse-url-new-window-flag'.

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: "))
   (setq url (browse-url-encode-url url))
   (let* ((process-environment (browse-url-process-environment))
	 (use-remote
	  (not (memq system-type '(windows-nt ms-dos))))
	 (process
	  (apply 'start-process
		 (concat "firefox " url) nil
		 browse-url-firefox-program
		 (append
		  browse-url-firefox-arguments
		  (if use-remote
		      (list
		       (if (browse-url-maybe-new-window new-window)
			   (if browse-url-firefox-new-window-is-tab
			       "--new-tab"
			     "--new-window"))
		       url)
		    (list url))))))
     ;; If we use -remote, the process exits with status code 2 if
     ;; Firefox is not already running.  The sentinel runs firefox
     ;; directly if that happens.
     (when use-remote
       (set-process-sentinel process
			    `(lambda (process change)
			       (browse-url-firefox-sentinel process ,url))))))

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

* Re: Firefox 36 and Links
  2015-02-26 23:33   ` Nick Dokos
@ 2015-02-27  0:04     ` Scott Randby
  0 siblings, 0 replies; 7+ messages in thread
From: Scott Randby @ 2015-02-27  0:04 UTC (permalink / raw)
  To: emacs-orgmode

On 02/26/2015 06:33 PM, Nick Dokos wrote:
> Nick Dokos <ndokos@gmail.com> writes:
>
>> Scott Randby <srandby@gmail.com> writes:
>>
>>>    http://comments.gmane.org/gmane.emacs.bugs/99694
>>>
>>> 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.
>>>
>>
>> Oh, it's probably that gmane replaces "@" signs with "<at>" to confuse
>> stupid address harvesters (which it will probably do to this message as
>> well :) ).
>>
>> Try getting the patch from the emacs bug mailing list:
>>
>> http://lists.gnu.org/archive/html/bug-gnu-emacs/2015-02/msg00751.html
>>
>
> ... and if whitespace is a problem, try ignoring it:
>
>   patch -p1 -l < browse-url.patch
>
> or
>
>   git apply --ignore-whitespace browse-url.patch
>
> worked for me on 24.3.
>

I'm sorry, it appears that I don't have enough knowledge to do this 
correctly. I've been meaning to learn how to work with git, but I 
haven't been able to find the time to learn it. I don't install Emacs 
from git, so I'll just wait until the next version that fixes the 
problem comes out.


>
>

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

* Re: Firefox 36 and Links
  2015-02-26 22:23 Firefox 36 and Links Scott Randby
  2015-02-26 23:12 ` Nick Dokos
  2015-02-26 23:23 ` Nick Dokos
@ 2015-03-01  8:09 ` Stefan-W. Hahn
  2 siblings, 0 replies; 7+ messages in thread
From: Stefan-W. Hahn @ 2015-03-01  8:09 UTC (permalink / raw)
  To: Scott Randby; +Cc: emacs-orgmode

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.

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

end of thread, other threads:[~2015-03-01  8:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26 22:23 Firefox 36 and Links Scott Randby
2015-02-26 23:12 ` Nick Dokos
2015-02-26 23:50   ` Scott Randby
2015-02-26 23:23 ` Nick Dokos
2015-02-26 23:33   ` Nick Dokos
2015-02-27  0:04     ` Scott Randby
2015-03-01  8:09 ` Stefan-W. Hahn

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).