From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: rpd Newsgroups: gmane.emacs.help Subject: Re: html browser preview help Date: Thu, 3 Sep 2009 13:42:09 -0700 (PDT) Message-ID: <25283740.post@talk.nabble.com> References: <25273542.post@talk.nabble.com> <4A9FC945.8070703@mousecar.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1252010576 8676 80.91.229.12 (3 Sep 2009 20:42:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Sep 2009 20:42:56 +0000 (UTC) To: Help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 03 22:42:49 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MjJ8p-0002Qo-3j for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Sep 2009 22:42:47 +0200 Original-Received: from localhost ([127.0.0.1]:39009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjJ8o-00057c-Hp for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Sep 2009 16:42:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjJ8M-00055n-2t for help-gnu-emacs@gnu.org; Thu, 03 Sep 2009 16:42:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjJ8H-0004y6-2R for Help-gnu-emacs@gnu.org; Thu, 03 Sep 2009 16:42:17 -0400 Original-Received: from [199.232.76.173] (port=57372 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjJ8G-0004xi-SF for Help-gnu-emacs@gnu.org; Thu, 03 Sep 2009 16:42:12 -0400 Original-Received: from kuber.nabble.com ([216.139.236.158]:56280) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MjJ8G-0005aK-A9 for Help-gnu-emacs@gnu.org; Thu, 03 Sep 2009 16:42:12 -0400 Original-Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1MjJ8D-0000EO-OJ for Help-gnu-emacs@gnu.org; Thu, 03 Sep 2009 13:42:09 -0700 In-Reply-To: <4A9FC945.8070703@mousecar.com> X-Nabble-From: richard@dickinson350.freeserve.co.uk X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:67823 Archived-At: Hi ken-93 Thanks again for your helpful reply. I have tried to follow your advice & code but I still need some help. (BTW O/S=Vista & browser=InternetExplorer8) To open internet explorer from the shell> start iexplore.exe >From this I edited your .emacs defun code to: (defun browse-file-url-ie-new-tab (url &optional new-window) "Open the current file, the file associated with the current buffer, in a new IE tab." (interactive "i") (unless (string= "" (shell-command-to-string (concat "start iexplore.exe" buffer-file-name ", new-tab)'"))) (message "Opening in IE new tab: " buffer-file-name))) (setq browse-url-browser-function 'browse-file-url-ie-new-tab) When I try this I get a browser to open at my homepage. (I have tried to edit this in other ways but again with no success). The code I have which opens my IE browser normally is: (setq browse-url-browser-function 'browse-url-generic browse-url-generic-program "C:\\Program Files\\Internet Explorer\\iexplore.exe") (setq gnus-button-url 'browse-url-generic browse-url-generic-program "C:\\Program Files\\Internet Explorer\\iexplore.exe" browse-url-browser-function gnus-button-url) Any idea how I should proceed/what I can try to fix this please? Many thanks & best wishes ken-93 wrote: > > > I've been doing this for a long time in html-helper-mode so, yes, it can > be done. I created my own function though... actually two of them: one > to open the current (html) buffer in a new tab (for displaying the html > file the first time) and another function to open that same current > buffer in the same tab (for displaying the html file subsequent times). > > You don't say which browser you want to do this with and, of course, the > emacs function is going to need to know this (unless you use an > environmental variable to designate it, in which case you'll need to > determine what that is). In addition, you'll need to know which version > of that browser (whichever it is) you have. I've been using firefox for > quite a time and often, when I upgrade it, the command for loading a url > into an existing tab or into a new tab changes; of course this means I > have to alter my emacs/html-helper-mode function. > > In short, the first thing to do is to find out what the commands work > from your shell to open a new- or a current-tab (or window, if that's > what you prefer) in your browser and give it a url. Then, after you've > successfully done these from the cli, then plug these into an emacs > function. The cli input which works for me to open a file in a new tab > is: > > /usr/bin/firefox -new-tab [url] > > Other commands work also. Much depends on what your firefox defaults > are. One configuration I have is to "open new urls in a new tab"; this > (for some silly reason) prevents me from opening a url in the current > firefox tab. It didn't always do this; earlier Firefox versions had an > option to open a url in a current tab. The lesson from this is that > what cli command you use is going to depend upon, not just which browser > you use, but also which *version* of that browser as well as what > preferences you've set for that browser/version. > > You also didn't say which OS you're using and that can of course play a > role in which command you'll plug into your emacs function. > > Anyway, once you figure out what command(s) do(es) what you want, plug > it into: > > ;;Works for opening a file in a new firefox tab > (defun browse-file-url-firefox-new-tab (url &optional new-window) > "Open the current file, the file associated with the current buffer, > in a new Firefox tab." > (interactive "i") > (unless > (string= "" > (shell-command-to-string > (concat "firefox -a firefox -remote 'openURL(file://" buffer-file-name > ", new-tab)'"))) > (message "Opening in Firefox new tab: " buffer-file-name))) > (setq browse-url-browser-function 'browse-file-url-firefox-new-tab) > > Just change the "(concat ..." line to reflect the cli command which > works for you. > > Since firefox (nonsensically) did away with a command-line option for > opening a url in a current tab, I now have to change focus to firefox > and reload the tab to show any editing I've done (in emacs) since > previously displaying it in firefox. > > (If anyone here has the ear of a firefox developer, tell them to gives > us back the "-current-tab" option.) > > hth, > ken > > > -- > War is a failure of the imagination. > --William Blake > > > > On 09/03/2009 06:47 AM rpd wrote: >> Hi >> Just encountered this problem previewing html editing in emacs. >> When I edit html (I have html-helper-mode file loaded) I want to preview >> it >> in my browser but cannot yet do so. If I use the 'html' menu item (load >> this >> buffer in browser) or C-c C-z v I just get browser opening at my homepage >> & >> not showing the html edit preview I want. >> >> Does anyone know why this is & can help me get my html emacs edit to >> preview >> in my browser? >> >> Again I am most grateful for helpful replies (Emacs is good isn't it?! -I >> just wish I could do what I want with it-but I will do it! LOL), many >> thanks > > > > -- View this message in context: http://www.nabble.com/html-browser-preview-help-tp25273542p25283740.html Sent from the Emacs - Help mailing list archive at Nabble.com.