* html browser preview help
@ 2009-09-03 10:47 rpd
2009-09-03 13:48 ` ken
0 siblings, 1 reply; 18+ messages in thread
From: rpd @ 2009-09-03 10:47 UTC (permalink / raw)
To: Help-gnu-emacs
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-tp25273542p25273542.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
2009-09-03 10:47 html browser preview help rpd
@ 2009-09-03 13:48 ` ken
2009-09-03 20:42 ` rpd
0 siblings, 1 reply; 18+ messages in thread
From: ken @ 2009-09-03 13:48 UTC (permalink / raw)
To: rpd, GNU Emacs List
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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
2009-09-03 13:48 ` ken
@ 2009-09-03 20:42 ` rpd
2009-09-03 21:14 ` ken
0 siblings, 1 reply; 18+ messages in thread
From: rpd @ 2009-09-03 20:42 UTC (permalink / raw)
To: Help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
2009-09-03 20:42 ` rpd
@ 2009-09-03 21:14 ` ken
2009-09-03 22:32 ` rpd
0 siblings, 1 reply; 18+ messages in thread
From: ken @ 2009-09-03 21:14 UTC (permalink / raw)
To: rpd, GNU Emacs List
Hey, it looks like you're almost there.
Go to the command prompt ("Start | Run | cmd"... something like that)
and try to get explorer to open a local html file. From what you're
telling me something like:
> start iexplore.exe filename.html
should work. I don't know... don't use explorer much. There might be
an option to tell it to pop a new window and/or not to.
Seems to me that since your function is getting through to explorer but
it doesn't know it's supposed to open a particular file, you need to
change something in that "(concat ..." line. For one thing, since
explorer doesn't use tabs (or does it?), take out the "-new-tab" stuff;
that's a firefox option. You also have that string in the final "(setq
..." line.
Once you figure out how to get explorer to pop a window and load the
file you designate-- *from the command line*-- then you'll be closer to
getting a working emacs function.
hth,
ken
On 09/03/2009 04:42 PM rpd wrote:
> 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
>>
>>
>>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
2009-09-03 21:14 ` ken
@ 2009-09-03 22:32 ` rpd
2009-09-04 23:10 ` rpd
0 siblings, 1 reply; 18+ messages in thread
From: rpd @ 2009-09-03 22:32 UTC (permalink / raw)
To: Help-gnu-emacs
Hi ken-93
Thanks for your prompt response & encouragement to me to get this html
preview emacs function working.
As I am using Vista O/S at command shell/prompt simply running start
filename.html opens internet explorer (MS/Vista browser & btw it does have
tabs) with the local directory file opening.
Somehow I need to get Emacs lisp to understand this!
Thanks & regards
ken-93 wrote:
>
>
> Hey, it looks like you're almost there.
>
> Go to the command prompt ("Start | Run | cmd"... something like that)
> and try to get explorer to open a local html file. From what you're
> telling me something like:
>
>> start iexplore.exe filename.html
>
> should work. I don't know... don't use explorer much. There might be
> an option to tell it to pop a new window and/or not to.
>
> Seems to me that since your function is getting through to explorer but
> it doesn't know it's supposed to open a particular file, you need to
> change something in that "(concat ..." line. For one thing, since
> explorer doesn't use tabs (or does it?), take out the "-new-tab" stuff;
> that's a firefox option. You also have that string in the final "(setq
> ..." line.
>
> Once you figure out how to get explorer to pop a window and load the
> file you designate-- *from the command line*-- then you'll be closer to
> getting a working emacs function.
>
>
> hth,
> ken
>
>
> On 09/03/2009 04:42 PM rpd wrote:
>> 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-tp25273542p25285280.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
2009-09-03 22:32 ` rpd
@ 2009-09-04 23:10 ` rpd
2009-09-05 17:11 ` Tyler Smith
0 siblings, 1 reply; 18+ messages in thread
From: rpd @ 2009-09-04 23:10 UTC (permalink / raw)
To: Help-gnu-emacs
Hi
I still need some help to get to preview html files in my Internet Explorer
browser.
ken-93 helped me with some code (which opens Firefox browser) which I have
tried to adapt to do
this for Internet Explorer but it isn't working. I am using html-helper-mode
Here is my last current code try:
; Windows Internet explorer browser to go to the file in the current buffer
(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 "w32-shell-execute open iexplore
'openURL(file://" 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)
After I do ' M-x browse-file-url-ie-new-tab ' I get 'Opening in IE:' & then
'M-x-browse-url-'
in minibuffer.
I don't know why this preview function doesn't work for me by default for
html files in html-helper mode.
When I use the menu option (or from minibuffer) to 'Load this Buffer in
Browser' I get an InternetExplorer browser window to open but showing my
homepage, not the html file content.
I am most grateful if someone can help me to either get the above code to
open a local directory html file to open in Internet Explorer browser or to
suggest any other way I can preview html files to help me edit them.
I lok forward to some helpul reply, thanks
rpd wrote:
>
> Hi ken-93
>
> Thanks for your prompt response & encouragement to me to get this html
> preview emacs function working.
>
> As I am using Vista O/S at command shell/prompt simply running start
> filename.html opens internet explorer (MS/Vista browser & btw it does have
> tabs) with the local directory file opening.
> Somehow I need to get Emacs lisp to understand this!
>
> Thanks & regards
>
> ken-93 wrote:
>>
>>
>> Hey, it looks like you're almost there.
>>
>> Go to the command prompt ("Start | Run | cmd"... something like that)
>> and try to get explorer to open a local html file. From what you're
>> telling me something like:
>>
>>> start iexplore.exe filename.html
>>
>> should work. I don't know... don't use explorer much. There might be
>> an option to tell it to pop a new window and/or not to.
>>
>> Seems to me that since your function is getting through to explorer but
>> it doesn't know it's supposed to open a particular file, you need to
>> change something in that "(concat ..." line. For one thing, since
>> explorer doesn't use tabs (or does it?), take out the "-new-tab" stuff;
>> that's a firefox option. You also have that string in the final "(setq
>> ..." line.
>>
>> Once you figure out how to get explorer to pop a window and load the
>> file you designate-- *from the command line*-- then you'll be closer to
>> getting a working emacs function.
>>
>>
>> hth,
>> ken
>>
>>
>> On 09/03/2009 04:42 PM rpd wrote:
>>> 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-tp25273542p25303306.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
2009-09-04 23:10 ` rpd
@ 2009-09-05 17:11 ` Tyler Smith
2009-09-05 21:27 ` rpd
0 siblings, 1 reply; 18+ messages in thread
From: Tyler Smith @ 2009-09-05 17:11 UTC (permalink / raw)
To: rpd, Emacs Help
rpd wrote:
> I still need some help to get to preview html files in my Internet Explorer
> browser.
>
> ken-93 helped me with some code (which opens Firefox browser) which I have
> tried to adapt to do
> this for Internet Explorer but it isn't working. I am using html-helper-mode
>
>
Have you tried browse-url-of-buffer? It's normally bound to C-c C-v, and
on Vista it sends the file you are editing to your default browser, no
further configurations or code necessary.
Cheers,
Tyler
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
2009-09-05 17:11 ` Tyler Smith
@ 2009-09-05 21:27 ` rpd
2009-09-05 21:44 ` Drew Adams
0 siblings, 1 reply; 18+ messages in thread
From: rpd @ 2009-09-05 21:27 UTC (permalink / raw)
To: Help-gnu-emacs
Hi Tyler
Thanks for your reply-but your advice doesn't work properly for me (it does
open a browser window but this opens at my homepage & does not preview the
html file/buffer I have open for editing).
This is driving my crazy trying to fix (as I have spent a lot of time today
with this- I even installed w3m & can now view html buffer files with that
BUT that is only a text browser!! I want to see preview in a full browser!).
I have adjusted the code ken-93 gave with his latest advice & when I use it
it opens a blank page Internet Explorer (I guess I need to add the code
that points to the current file buffer but I do not know how to do that).
Anyway here is this latest defun code:
; Windows explorer to go to the file in the current buffer
(defun browse-file-url-ie (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 about:blank 'openURL(file://"
buffer-file-name
")'")))
(message " Opening in IE new tab: " buffer-file-name)))
(setq browse-url-browser-function 'browse-file-url-ie)
Please can someone give me more help to fix this? I look forward to helpful
replies, thanks
Tyler Smith-3 wrote:
>
> rpd wrote:
>> I still need some help to get to preview html files in my Internet
>> Explorer
>> browser.
>>
>> ken-93 helped me with some code (which opens Firefox browser) which I
>> have
>> tried to adapt to do
>> this for Internet Explorer but it isn't working. I am using
>> html-helper-mode
>>
>>
>
> Have you tried browse-url-of-buffer? It's normally bound to C-c C-v, and
> on Vista it sends the file you are editing to your default browser, no
> further configurations or code necessary.
>
> Cheers,
>
> Tyler
>
>
>
>
>
--
View this message in context: http://www.nabble.com/html-browser-preview-help-tp25273542p25312500.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: html browser preview help
2009-09-05 21:27 ` rpd
@ 2009-09-05 21:44 ` Drew Adams
2009-09-06 0:13 ` rpd
0 siblings, 1 reply; 18+ messages in thread
From: Drew Adams @ 2009-09-05 21:44 UTC (permalink / raw)
To: 'rpd', Help-gnu-emacs
Sorry, I haven't followed this thread.
If all you're looking for is a way to open your regular Web browser on an HTML
file, from within Emacs, and if you are on Windows, see w32-browser.el.
http://www.emacswiki.org/emacs/w32-browser.el
E.g. in Dired, mouse-2 on a file foo.html will open it in your normal Web
browser (not in Emacs). That assumes that your Windows file associations
associate your Web browser with the Open action for file type HTML.
If you are visiting an HTML file in Emacs, and you want to open it in your
browser, then use (w32-browser (buffer-file-name)) or `M-x w32-browser'. (You
will of course need to save the buffer first, since your browser uses the disk
file.)
If this is not related to what you're asking for, sorry for the noise -
hopefully someone else can help.
> Thanks for your reply-but your advice doesn't work properly
> for me (it does open a browser window but this opens at my
> homepage & does not preview the html file/buffer I have open for editing).
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: html browser preview help
2009-09-05 21:44 ` Drew Adams
@ 2009-09-06 0:13 ` rpd
2009-09-06 1:19 ` Tyler Smith
2009-09-06 1:39 ` Drew Adams
0 siblings, 2 replies; 18+ messages in thread
From: rpd @ 2009-09-06 0:13 UTC (permalink / raw)
To: Help-gnu-emacs
Hi Drew
Thanks for your reply.
I have tried so many ways to get to preview .html in Internet Explorer
browser including w32-browser.el and unfortunately nothing has yet worked
This is the code I have for w32-browser.el:
;;;;==W32 BROWSER.el===============================================
;;;
;;http://www.emacswiki.org/emacs/w32-browser.el
(load "C:\\Users\\Dad\\Emacs\\emacsaddons\\w32-browser.el")
(setq w32-browser (buffer-file-name))
;===
The mouse2 part doesn't work either. Vista works normally such as if I click
a local directory .html file it opens in Internet Explorer but I cannot get
this function to work in Emacs! (the closest I get is opening w3
browser-text browser only).
Have you any idea what the problem with this is? Thanks
Drew Adams wrote:
>
> Sorry, I haven't followed this thread.
>
> If all you're looking for is a way to open your regular Web browser on an
> HTML
> file, from within Emacs, and if you are on Windows, see w32-browser.el.
> http://www.emacswiki.org/emacs/w32-browser.el
>
> E.g. in Dired, mouse-2 on a file foo.html will open it in your normal Web
> browser (not in Emacs). That assumes that your Windows file associations
> associate your Web browser with the Open action for file type HTML.
>
> If you are visiting an HTML file in Emacs, and you want to open it in your
> browser, then use (w32-browser (buffer-file-name)) or `M-x w32-browser'.
> (You
> will of course need to save the buffer first, since your browser uses the
> disk
> file.)
>
> If this is not related to what you're asking for, sorry for the noise -
> hopefully someone else can help.
>
>> Thanks for your reply-but your advice doesn't work properly
>> for me (it does open a browser window but this opens at my
>> homepage & does not preview the html file/buffer I have open for
>> editing).
>
>
>
>
>
--
View this message in context: http://www.nabble.com/html-browser-preview-help-tp25273542p25313460.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
2009-09-06 0:13 ` rpd
@ 2009-09-06 1:19 ` Tyler Smith
2009-09-06 9:15 ` rpd
2009-09-06 1:39 ` Drew Adams
1 sibling, 1 reply; 18+ messages in thread
From: Tyler Smith @ 2009-09-06 1:19 UTC (permalink / raw)
To: rpd, Emacs Help
rpd wrote:
> Hi Drew
>
> Thanks for your reply.
> I have tried so many ways to get to preview .html in Internet Explorer
> browser including w32-browser.el and unfortunately nothing has yet worked
>
>
What file are you trying to view? Is it saved locally on your hard drive
when you try browse-url-of-buffer?
What happens if you open emacs without loading your customizations? Try
this:
From the start menu, open the 'run' command, and enter this:
"C:\Program Files\GNU Emacs 22.3\bin\runemacs.exe" -Q
The actual path, the part in quotes, will probably be different for you,
but it will be the same as the target for the emacs icon on your
desktop. Once this program is running, open an html file on your hard
drive, and then try C-c C-v. Does it still open up a different page in
your browser?
HTH,
Tyler
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: html browser preview help
2009-09-06 0:13 ` rpd
2009-09-06 1:19 ` Tyler Smith
@ 2009-09-06 1:39 ` Drew Adams
2009-09-06 9:22 ` rpd
[not found] ` <mailman.6097.1252228975.2239.help-gnu-emacs@gnu.org>
1 sibling, 2 replies; 18+ messages in thread
From: Drew Adams @ 2009-09-06 1:39 UTC (permalink / raw)
To: 'rpd', Help-gnu-emacs
> Thanks for your reply.
> I have tried so many ways to get to preview .html in Internet Explorer
> browser including w32-browser.el and unfortunately nothing
> has yet worked
>
> Vista works normally such as if I click
> a local directory .html file it opens in Internet Explorer
> but I cannot get
> this function to work in Emacs! (the closest I get is opening w3
> browser-text browser only).
>
> Have you any idea what the problem with this is? Thanks
As I said, I haven't followed this thread. I'm also no expert on this stuff.
Are you trying to open your browser on a Web page (URL) somewhere on the Web, or
are you trying to preview a local (or remote, if you know the machine etc.) HTML
file in your Web browser? I thought it was the latter.
If the former, then you probably need to use a URL and a command such as
`browse-url'. But someone else will be able to help you more with that.
If the latter, then w32-browser.el should do what you need.
All it does is call function `w32-shell-execute' on the file name (or punt to
`find-file' in case of error). That function is an Emacs built-in. Try it: `M-:
(w32-shell-execute nil "c:/my/file.htm")', assuming your file is at
"c:/my/file.htm" and you have your Windows file associations set up so that
*.htm files open with your Web browser. That should work.
I don't use Vista, and I've about exhausted my knowledge of this area. ;-) Hope
someone else can help you out.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
2009-09-06 1:19 ` Tyler Smith
@ 2009-09-06 9:15 ` rpd
0 siblings, 0 replies; 18+ messages in thread
From: rpd @ 2009-09-06 9:15 UTC (permalink / raw)
To: Help-gnu-emacs
Hi Tyler
Your last instruction works! (.html file opens/previews in Internet Explorer
browser properly)
Now what do I have to do to my .emacs file to be able to open Emacs normally
without starting with this -Q (& with the C-C C-V command -+ from html menu
'buffer in browser' working)?
Is it an issue with html-helper.el?
Many thanks for this & I am grateful for your further advice with this,
regards
Tyler Smith-3 wrote:
>
> rpd wrote:
>> Hi Drew
>>
>> Thanks for your reply.
>> I have tried so many ways to get to preview .html in Internet Explorer
>> browser including w32-browser.el and unfortunately nothing has yet worked
>>
>>
> What file are you trying to view? Is it saved locally on your hard drive
> when you try browse-url-of-buffer?
> What happens if you open emacs without loading your customizations? Try
> this:
>
> From the start menu, open the 'run' command, and enter this:
> "C:\Program Files\GNU Emacs 22.3\bin\runemacs.exe" -Q
>
> The actual path, the part in quotes, will probably be different for you,
> but it will be the same as the target for the emacs icon on your
> desktop. Once this program is running, open an html file on your hard
> drive, and then try C-c C-v. Does it still open up a different page in
> your browser?
>
> HTH,
>
> Tyler
>
>
>
>
>
>
--
View this message in context: http://www.nabble.com/html-browser-preview-help-tp25273542p25315893.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: html browser preview help
2009-09-06 1:39 ` Drew Adams
@ 2009-09-06 9:22 ` rpd
2009-09-06 11:49 ` html browser preview help-SORTED (at last!) rpd
2009-09-06 14:17 ` html browser preview help Drew Adams
[not found] ` <mailman.6097.1252228975.2239.help-gnu-emacs@gnu.org>
1 sibling, 2 replies; 18+ messages in thread
From: rpd @ 2009-09-06 9:22 UTC (permalink / raw)
To: Help-gnu-emacs
Hi Drew
Thanks for your reply.
(I am trying to preview a local .html file in my Internet Explorer browser)
I do not understand this > 'M-: < command you give?
When I try this (& combinations of) in the minibuffer I get 'no-match'
Is that really the command? (I did an internet search for it & couldn't find
it).
Anyway I have not been able to try this yet as I cannot enter the command:
`M-: (w32-shell-execute nil "c:/my/file.htm")'
Can you please explain/clarify this for me?
Many thanks, regards
Drew Adams wrote:
>
>> Thanks for your reply.
>> I have tried so many ways to get to preview .html in Internet Explorer
>> browser including w32-browser.el and unfortunately nothing
>> has yet worked
>>
>> Vista works normally such as if I click
>> a local directory .html file it opens in Internet Explorer
>> but I cannot get
>> this function to work in Emacs! (the closest I get is opening w3
>> browser-text browser only).
>>
>> Have you any idea what the problem with this is? Thanks
>
> As I said, I haven't followed this thread. I'm also no expert on this
> stuff.
>
> Are you trying to open your browser on a Web page (URL) somewhere on the
> Web, or
> are you trying to preview a local (or remote, if you know the machine
> etc.) HTML
> file in your Web browser? I thought it was the latter.
>
> If the former, then you probably need to use a URL and a command such as
> `browse-url'. But someone else will be able to help you more with that.
>
> If the latter, then w32-browser.el should do what you need.
>
> All it does is call function `w32-shell-execute' on the file name (or punt
> to
> `find-file' in case of error). That function is an Emacs built-in. Try it:
> `M-:
> (w32-shell-execute nil "c:/my/file.htm")', assuming your file is at
> "c:/my/file.htm" and you have your Windows file associations set up so
> that
> *.htm files open with your Web browser. That should work.
>
> I don't use Vista, and I've about exhausted my knowledge of this area. ;-)
> Hope
> someone else can help you out.
>
>
>
>
>
--
View this message in context: http://www.nabble.com/html-browser-preview-help-tp25273542p25315933.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
[not found] ` <mailman.6097.1252228975.2239.help-gnu-emacs@gnu.org>
@ 2009-09-06 9:50 ` Xah Lee
2009-09-06 9:56 ` Xah Lee
1 sibling, 0 replies; 18+ messages in thread
From: Xah Lee @ 2009-09-06 9:50 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 6, 2:22 am, rpd <rich...@dickinson350.freeserve.co.uk> wrote:
> Hi Drew
>
> Thanks for your reply.
> (I am trying to preview a local .html file in my Internet Explorer browser)
>
> I do not understand this > 'M-: < command you give?
> When I try this (& combinations of) in the minibuffer I get 'no-match'
>
> Is that really the command? (I did an internet search for it & couldn't find
> it).
>
> Anyway I have not been able to try this yet as I cannot enter the command:
>
> `M-: (w32-shell-execute nil "c:/my/file.htm")'
>
> Can you please explain/clarify this for me?
> Many thanks, regards
The “M-:” is emacs notation for the keyboard shortcut “Alt+:”.
So, it means, press Alt, press “:”, then type “(w32-shell-execute nil
"c:/my/file.htm")'”
This is a frequent confusion point for emacs. See:
• Emacs's M-‹key› Notation vs Alt+‹key› Notation
http://xahlee.org/emacs/modernization_meta_key.html
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: html browser preview help
[not found] ` <mailman.6097.1252228975.2239.help-gnu-emacs@gnu.org>
2009-09-06 9:50 ` Xah Lee
@ 2009-09-06 9:56 ` Xah Lee
1 sibling, 0 replies; 18+ messages in thread
From: Xah Lee @ 2009-09-06 9:56 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 6, 2:22 am, rpd <rich...@dickinson350.freeserve.co.uk> wrote:
> Thanks for your reply.
> (I am trying to preview a local .html file in my Internet Explorer browser)
don't know why you have so much problems with this.
This elisp code will just work, in Windows or Mac or linux.
(browse-url "http://example.com/")
(browse-url "~/Documents/file.html")
if you need, you can trivially get the file path by buffer-file-
name ... and others to get full path. And if IE is not your default
browser and you don't want to set it to default yet still want to use
IE, you can start a shell command as others suggested and start it
with “start ”.
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: html browser preview help-SORTED (at last!)
2009-09-06 9:22 ` rpd
@ 2009-09-06 11:49 ` rpd
2009-09-06 14:17 ` html browser preview help Drew Adams
1 sibling, 0 replies; 18+ messages in thread
From: rpd @ 2009-09-06 11:49 UTC (permalink / raw)
To: Help-gnu-emacs
Hi all
Thanks for all your help- I have finally fixed this!
Now (at last) I can preview local .html files in my Internet Explorer
browser (from the menu & C-c C-v comand).
I commented out of my.emacs most of the entries I had tried previously
(including the defun entry that I was developing with ken-93).
I then used M-x cutomize-group [ret] browse-url to check browse url
group states & after some more editing of my .emacs I now have the Browse
Url Browser Function set at >browse-url-default-windows-browser<
(default I suppose) & finally it works!!
Wow- that took some time to fix!-
(this shows the problems with adding other code to .emacs to fix a
problem-some of it works & some doesn't & you have to be a good
detective/editor to find out which is which & know what all this elisp code
means!- Well I'm learning...slowly!).
Many thanks to all who helped-now I better start doing some html editing &
not spending my time fixing emacs...except I still need to tune up chess.el
module-does this emacs fiddling ever stop? I must see the doctor about it
M-x doctor -LOL!) regards
rpd wrote:
>
> Hi Drew
>
> Thanks for your reply.
> (I am trying to preview a local .html file in my Internet Explorer
> browser)
>
> I do not understand this > 'M-: < command you give?
> When I try this (& combinations of) in the minibuffer I get 'no-match'
>
> Is that really the command? (I did an internet search for it & couldn't
> find it).
>
> Anyway I have not been able to try this yet as I cannot enter the command:
>
> `M-: (w32-shell-execute nil "c:/my/file.htm")'
>
> Can you please explain/clarify this for me?
> Many thanks, regards
>
>
> Drew Adams wrote:
>>
>>> Thanks for your reply.
>>> I have tried so many ways to get to preview .html in Internet Explorer
>>> browser including w32-browser.el and unfortunately nothing
>>> has yet worked
>>>
>>> Vista works normally such as if I click
>>> a local directory .html file it opens in Internet Explorer
>>> but I cannot get
>>> this function to work in Emacs! (the closest I get is opening w3
>>> browser-text browser only).
>>>
>>> Have you any idea what the problem with this is? Thanks
>>
>> As I said, I haven't followed this thread. I'm also no expert on this
>> stuff.
>>
>> Are you trying to open your browser on a Web page (URL) somewhere on the
>> Web, or
>> are you trying to preview a local (or remote, if you know the machine
>> etc.) HTML
>> file in your Web browser? I thought it was the latter.
>>
>> If the former, then you probably need to use a URL and a command such as
>> `browse-url'. But someone else will be able to help you more with that.
>>
>> If the latter, then w32-browser.el should do what you need.
>>
>> All it does is call function `w32-shell-execute' on the file name (or
>> punt to
>> `find-file' in case of error). That function is an Emacs built-in. Try
>> it: `M-:
>> (w32-shell-execute nil "c:/my/file.htm")', assuming your file is at
>> "c:/my/file.htm" and you have your Windows file associations set up so
>> that
>> *.htm files open with your Web browser. That should work.
>>
>> I don't use Vista, and I've about exhausted my knowledge of this area.
>> ;-) Hope
>> someone else can help you out.
>>
>>
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/html-browser-preview-help-tp25273542p25316992.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: html browser preview help
2009-09-06 9:22 ` rpd
2009-09-06 11:49 ` html browser preview help-SORTED (at last!) rpd
@ 2009-09-06 14:17 ` Drew Adams
1 sibling, 0 replies; 18+ messages in thread
From: Drew Adams @ 2009-09-06 14:17 UTC (permalink / raw)
To: 'rpd', Help-gnu-emacs
> Thanks for your reply.
> (I am trying to preview a local .html file in my Internet
> Explorer browser)
> I do not understand this > 'M-: < command you give?
> When I try this (& combinations of) in the minibuffer I get 'no-match'
>
> Is that really the command? (I did an internet search for it
> & couldn't find it).Anyway I have not been able to try this yet as
> I cannot enter the command:
> `M-: (w32-shell-execute nil "c:/my/file.htm")'
>
> Can you please explain/clarify this for me?
The key sequence `M-:' is bound to command `eval-expression'. You use it by
pressing and holding the Meta key (probably ALT on your keyboard) and while
holding it hitting the `:' key. Alternatively, you can hit the `ESC' (Escape)
and then hit the `:' key (don't hold `ESC' down like ALT).
All that command does is prompt you for a Lisp expression (sexp) to evaluate. In
this case, you would type (w32-shell-execute nil
"c:/whatever/hmtl/file/you/want.htm") at the prompt, then hit RET (Enter key).
Another way to evaluate such a Lisp sexp is to type it into buffer *scratch*,
then hit RET after it.
Another way to evaluate it is to type it into an Emacs-Lisp buffer (open a new
file called something.el, using `C-x C-f something.el'), then put the cursor
just after the closing parenthesis, and hit `C-x C-e' (Control-x followed by
Control-e).
But it sounds like you already solved your problem. HTH anyway.
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2009-09-06 14:17 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-03 10:47 html browser preview help rpd
2009-09-03 13:48 ` ken
2009-09-03 20:42 ` rpd
2009-09-03 21:14 ` ken
2009-09-03 22:32 ` rpd
2009-09-04 23:10 ` rpd
2009-09-05 17:11 ` Tyler Smith
2009-09-05 21:27 ` rpd
2009-09-05 21:44 ` Drew Adams
2009-09-06 0:13 ` rpd
2009-09-06 1:19 ` Tyler Smith
2009-09-06 9:15 ` rpd
2009-09-06 1:39 ` Drew Adams
2009-09-06 9:22 ` rpd
2009-09-06 11:49 ` html browser preview help-SORTED (at last!) rpd
2009-09-06 14:17 ` html browser preview help Drew Adams
[not found] ` <mailman.6097.1252228975.2239.help-gnu-emacs@gnu.org>
2009-09-06 9:50 ` Xah Lee
2009-09-06 9:56 ` Xah Lee
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).