When editing a html file (in an Emacs buffer in HTML mode), I often review the file in my default browser (Firefox) by C-c C-v (ie, running browse-url-of-buffer). But every time I run C-c C-v, Firefox opens the file in a new tab so that after making several revisions, there are several tabs for the same file. But what I want is that Firefox reloads the file in the same tab, which is exactly what Safari does. Is there a way to make Firefox behave the way I want? The Emacs customization group `browse-url' does not seem to have an item for this. Neither can I find any suitable item in Firefox preferences (under General/Tabs). (I run Emacs 24.4 in Mac Yosemite, Firefox is 40.0.3.)
1 Answer
As far as I know the only solution is to adjust the settings in Firefox:
Enter about:config
in your address bar, confirm and search for browser.link.open_newwindow.override.external
and set it to 1
.
After that it should work like you want.
-
The suggestion works fine. Setting 'browser.link.open_newwindow.override.external' to '1' makes the browser use the current tab to load the page sent from Emacs. This solves the problem of Firefox opening a new tab each time I load the file from Emacs. The only concern is that the content in the current tab is replaced by the content sent from Emacs, so I have to be careful if I don't want losing whatever there is in the current tab. In this respect, Safari works exactly the way I want: load the page in a new tab if it hasn't been loaded, and reuse the tab if the page has already been loaded.– KS LeungSep 6, 2015 at 1:59
new-tab
option (if that is what is being used), perhaps there is something like a same-tab option: lists.gnu.org/archive/html/bug-gnu-emacs/2012-03/msg00849.html Unfortunately, I don't use any of that stuff so I have no current set-up to test with -- but I would definitely look for a same-tab option as part of the command. My other idea, without knowing the slightest thing of what I am talking about, would be to eliminate thenew-tab
option to see if the default ends up being the same-tab without necessarily specifying the same-tab.BaseHTTPRequestHandler
is a nobrainer to write.