Reputation: 12138
I've added logic in Emacs to automatically call browse-url
on a DMD generated html documentation file upon completion of a special build finish hook I've written.
In order for this to be usable I now want this call to only open a new browser tab the first time it is called and the rest of the times only reload the tab already showing the the doc file.
Is this possible, preferrably in Google Chrome?
I've scanned command line arguments for both GC and FF but have found nothing.
I suspect some Javascript/HTML-5 may do the trick but I know nothing about that.
Upvotes: 0
Views: 352
Reputation:
For Firefox look into browse-url-firefox-new-window-is-tab
and / or browse-url-maybe-new-window
. You could follow the execution path from the definition of browse-url-default-browser
, all in the browse-url.el
.
But the basic idea is that you could just look at how, for example, browse-url-firefox
is implemented, write the one that does exactly what you want (launches Firefox in the way that you need), and set it to be the browse-url-browser-function
. The value of this variable must be a function which is called from browse-url
.
What is interesting (perhaps something similar is available in Google Chrome), there's MozRepl, obviously, it will run in Mozilla browsers, and there's a binding for Emacs to talk to this REPL (interactive JavaScript interpreter). Using that you can have very fine-grained control over the behaviour of the browser, including, but not limited to creating new GUI components (using XUL), manipulating browser windows and so on. Would probably depend on how much time you are willing to spend on it.
Upvotes: 1