public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* w32-shell-execute function definition is void
@ 2006-06-05 17:29 Mark Fisher
  2009-06-16 10:07 ` Marc Girod
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Fisher @ 2006-06-05 17:29 UTC (permalink / raw)
  To: cygwin

i cannot seem to be able to use/find w32-shell-execute.
i'm using emacs v21.3.50.1, but it was the same under a
previous version (v21.2.13).

i've tried moving my .emacs and starting up clean, but it
is just always comes back with the function definition
being void if i try to excecute anything that uses this
function. Typing "M-x w32" and hitting tab comes back
empty (No match).

i tried compiling the source version of 21.3.50.2 but i
get the errors mentioned elsewhere with bootstrap-emacs
causing a segmentation fault after altering the souce
for the emacs/d_ino issue against cygwin 1.5.19-4,
but browsing the source i can see the w32-shell-execute
method is in the source, but i just don't seem to be able
to ever get it to be recognised.

I mostly use emacs-X11, but i've just tested it with the non
x11 binary distribution from installing with setup.exe and that
has the same problem.

can anyone help me understand why this fails?
is there something i'm missing about the cywin build of emacs?

thanks,
mark

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: w32-shell-execute function definition is void
  2006-06-05 17:29 w32-shell-execute function definition is void Mark Fisher
@ 2009-06-16 10:07 ` Marc Girod
  2009-06-16 11:58   ` Ken Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Marc Girod @ 2009-06-16 10:07 UTC (permalink / raw)
  To: cygwin



Mark Fisher-4 wrote:
> 
> i cannot seem to be able to use/find w32-shell-execute.
> 
Same thing on 23.0.92
The error comes e.g. as I do: M-x browse-url

I can find the function definition in the C sources: src/w32fns.c
but I remember that this object is not linked to the cygwin emacs.

So, there ought to be a replacement for these functions, and a 
test to switch to an alternative set of them?

Marc

-- 
View this message in context: http://www.nabble.com/w32-shell-execute-function-definition-is-void-tp4718394p24049941.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: w32-shell-execute function definition is void
  2009-06-16 10:07 ` Marc Girod
@ 2009-06-16 11:58   ` Ken Brown
  2009-06-16 12:24     ` Marc Girod
  2009-06-16 22:16     ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: Ken Brown @ 2009-06-16 11:58 UTC (permalink / raw)
  To: cygwin

On 6/16/2009 4:36 AM, Marc Girod wrote:
> 
> Mark Fisher-4 wrote:
>> i cannot seem to be able to use/find w32-shell-execute.
>>
> Same thing on 23.0.92
> The error comes e.g. as I do: M-x browse-url
> 
> I can find the function definition in the C sources: src/w32fns.c
> but I remember that this object is not linked to the cygwin emacs.
> 
> So, there ought to be a replacement for these functions, and a 
> test to switch to an alternative set of them?

I haven't tried to write a full-blown replacement, but the following 
works for me.  First, in my .emacs, I have:

;;; System dependent settings
(cond
  ((eq system-type 'cygwin) (load "cygwin-init"))
  ((eq system-type 'windows-nt) (load "nt-init"))
  ((eq system-type 'gnu/linux) (load "linux-init")))

Now in my cygwin-init.el I define a simple-minded version of 
w32-shell-execute that suffices for my purposes:

;; Minimal replacement for w32-shell-execute under Cygwin.
(defun w32-shell-execute (operation document &optional parameters show-flag)
   (if (string-equal operation "open")
     (shell-command (concat "cygstart " (shell-quote-argument document)))))

Finally, still in cygwin-init.el, I slightly modify browse-url-of-file:

;; browse-url-of-file doesn't work right under cygwin; I'll just open
;; the file using cygstart instead of trying to convert the filename
;; to a URL.
(require 'browse-url)
(defun browse-url-of-file (&optional file)
   "Ask a WWW browser to display FILE.
Display the current buffer's file if FILE is nil or if called
interactively.  Turn the filename into a URL with function
`browse-url-file-url'.  Pass the URL to a browser using the
`browse-url' function then run `browse-url-of-file-hook'."
   (interactive)
   (or file
       (setq file (buffer-file-name))
       (error "Current buffer has no file"))
   (let ((buf (get-file-buffer file)))
     (if buf
	(save-excursion
	  (set-buffer buf)
	  (cond ((not (buffer-modified-p)))
		(browse-url-save-file (save-buffer))
		(t (message "%s modified since last save" file))))))
;;   (browse-url (browse-url-file-url file))
   (w32-shell-execute "open" file)
   (run-hooks 'browse-url-of-file-hook))

I'm sure there are better ways to do this, but the above is easy and has 
worked for me for years.  If Eli is watching this thread, maybe he can 
suggest something better that could be submitted as a patch to the emacs 
developers.

Ken

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: w32-shell-execute function definition is void
  2009-06-16 11:58   ` Ken Brown
@ 2009-06-16 12:24     ` Marc Girod
  2009-06-16 22:16     ` Eli Zaretskii
  1 sibling, 0 replies; 10+ messages in thread
From: Marc Girod @ 2009-06-16 12:24 UTC (permalink / raw)
  To: cygwin




Ken Brown-6 wrote:
> 
> I haven't tried to write a full-blown replacement, but the following 
> works for me.
> 
It is now in my .emacs as well.
Er...
(browse-url "file://c:/cygwin2/home/emagiro/public_html/index.html" nil)

I even get it twice!
Yes, I know... call that ingratitude...
Thanks!
Marc
-- 
View this message in context: http://www.nabble.com/w32-shell-execute-function-definition-is-void-tp4718394p24052453.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: w32-shell-execute function definition is void
  2009-06-16 11:58   ` Ken Brown
  2009-06-16 12:24     ` Marc Girod
@ 2009-06-16 22:16     ` Eli Zaretskii
  2009-06-17  1:54       ` Ken Brown
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2009-06-16 22:16 UTC (permalink / raw)
  To: cygwin

> Date: Tue, 16 Jun 2009 06:49:14 -0400
> From: Ken Brown <kbrown at cornell dot edu>
> 
> Finally, still in cygwin-init.el, I slightly modify browse-url-of-file:
> 
> ;; browse-url-of-file doesn't work right under cygwin; I'll just open
> ;; the file using cygstart instead of trying to convert the filename
> ;; to a URL.
> [...]
> I'm sure there are better ways to do this, but the above is easy and has 
> worked for me for years.  If Eli is watching this thread, maybe he can 
> suggest something better that could be submitted as a patch to the emacs 
> developers.

The first step is, obviously, reporting (preferably to emacs-devel or
the bug tracker) the details of why the stock browse-url-of-file does
not work on Cygwin.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: w32-shell-execute function definition is void
  2009-06-16 22:16     ` Eli Zaretskii
@ 2009-06-17  1:54       ` Ken Brown
  2009-06-17 20:17         ` Ken Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Ken Brown @ 2009-06-17  1:54 UTC (permalink / raw)
  To: cygwin

On 6/16/2009 2:20 PM, Eli Zaretskii wrote:
>> Date: Tue, 16 Jun 2009 06:49:14 -0400
>> From: Ken Brown <kbrown at cornell dot edu>
>>
>> Finally, still in cygwin-init.el, I slightly modify browse-url-of-file:
>>
>> ;; browse-url-of-file doesn't work right under cygwin; I'll just open
>> ;; the file using cygstart instead of trying to convert the filename
>> ;; to a URL.
>> [...]
>> I'm sure there are better ways to do this, but the above is easy and has 
>> worked for me for years.  If Eli is watching this thread, maybe he can 
>> suggest something better that could be submitted as a patch to the emacs 
>> developers.
> 
> The first step is, obviously, reporting (preferably to emacs-devel or
> the bug tracker) the details of why the stock browse-url-of-file does
> not work on Cygwin.

It's been several years since I looked at this and found my workaround, 
and I've forgotten the details of what went wrong.  I'll take another 
look when I get a chance and submit a patch or bug report, unless 
someone beats me to it.  (Marc?)

Ken

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: w32-shell-execute function definition is void
  2009-06-17  1:54       ` Ken Brown
@ 2009-06-17 20:17         ` Ken Brown
  2009-06-18 19:22           ` browse-url in emacs (was Re: w32-shell-execute function definition is void) Ken Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Ken Brown @ 2009-06-17 20:17 UTC (permalink / raw)
  To: cygwin

On 6/16/2009 4:34 PM, Ken Brown wrote:
> On 6/16/2009 2:20 PM, Eli Zaretskii wrote:
>>> Date: Tue, 16 Jun 2009 06:49:14 -0400
>>> From: Ken Brown <kbrown at cornell dot edu>
>>>
>>> Finally, still in cygwin-init.el, I slightly modify browse-url-of-file:
>>>
>>> ;; browse-url-of-file doesn't work right under cygwin; I'll just open
>>> ;; the file using cygstart instead of trying to convert the filename
>>> ;; to a URL.
>>> [...]
>>> I'm sure there are better ways to do this, but the above is easy and 
>>> has worked for me for years.  If Eli is watching this thread, maybe 
>>> he can suggest something better that could be submitted as a patch to 
>>> the emacs developers.
>>
>> The first step is, obviously, reporting (preferably to emacs-devel or
>> the bug tracker) the details of why the stock browse-url-of-file does
>> not work on Cygwin.
> 
> It's been several years since I looked at this and found my workaround, 
> and I've forgotten the details of what went wrong.  I'll take another 
> look when I get a chance

This turned out to be easier to sort out than I thought it would be. 
I've sent a report to emacs-devel: 
http://lists.gnu.org/archive/html/emacs-devel/2009-06/msg00320.html

Ken

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: browse-url in emacs (was Re: w32-shell-execute function definition  is void)
  2009-06-17 20:17         ` Ken Brown
@ 2009-06-18 19:22           ` Ken Brown
  2009-06-18 23:31             ` Marc Girod
  0 siblings, 1 reply; 10+ messages in thread
From: Ken Brown @ 2009-06-18 19:22 UTC (permalink / raw)
  To: cygwin

On 6/17/2009 12:15 PM, Ken Brown wrote:
> This turned out to be easier to sort out than I thought it would be. 
> I've sent a report to emacs-devel: 
> http://lists.gnu.org/archive/html/emacs-devel/2009-06/msg00320.html

I've now sent a patch upstream to fix the browse-url problem.  (I 
decided to do it without implementing w32-shell-execute.)  It may be a 
while before I know whether the patch, or some variant of it, is 
accepted.  This certainly won't happen until after the release of 23.1. 
  So I applied the patch locally and rebuilt the packages (cygwin 1.7 
only).  It works for me, but it would be good if someone else would test 
it also.

Marc, if you want to test it, delete the stuff you added to your .emacs 
and carry out the following steps:

D=http://www.math.cornell.edu/~kbrown/cygwin-1.7
wget -x -nH --cut-dirs=2 \
   ${D}/emacs/emacs-23.0.92-11.tar.bz2 \
   ${D}/emacs/emacs-X11/emacs-X11-23.0.92-11.tar.bz2 \
   ${D}/emacs/emacs-el/emacs-el-23.0.92-11.tar.bz2
/etc/preremove/emacs.sh
/etc/preremove/emacs-X11.sh
cd emacs
tar -C/ -xf emacs-23.0.92-11.tar.bz2
tar -C/ -xf emacs-X11/emacs-X11-23.0.92-11.tar.bz2
tar -C/ -xf emacs-el/emacs-el-23.0.92-11.tar.bz2
/etc/postinstall/emacs.sh
/etc/postinstall/emacs-X11.sh

If I haven't made a mistake, browse-url should now work.  If anything 
goes wrong, you can simply use setup-1.7.exe to reinstall emacs.

Ken

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: browse-url in emacs (was Re: w32-shell-execute function  definition  is void)
  2009-06-18 19:22           ` browse-url in emacs (was Re: w32-shell-execute function definition is void) Ken Brown
@ 2009-06-18 23:31             ` Marc Girod
  2009-06-19  9:39               ` browse-url in emacs Ken Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Marc Girod @ 2009-06-18 23:31 UTC (permalink / raw)
  To: cygwin




Ken Brown-6 wrote:
> 
> On 6/17/2009 12:15 PM, Ken Brown wrote:
> Marc, if you want to test it, delete the stuff you added to your .emacs 
> and carry out the following steps: ...
> 
OK, I ran this.
I did it from within emacs, which was maybe not bright.
Anyway, I got a couple of glitches in the postinstall:

/etc/postinstall/emacs.sh: line 9: /usr/bin/update-desktop-database: No such
file or directory
/etc/postinstall/emacs.sh: line 10: /usr/bin/update-mime-database: No such
file or directory

Probably nothing.

And now,

(browse-url "file:///C:/cygwin/home/marc/public_html" nil)

opened me an Explorer window, instead of the html page in Firefox...
but:

(browse-url "file:///C:/cygwin/home/marc/public_html/user/index.html" nil)

did it!

Yes, in fact, this looks just right.
Thanks, and congratulations!

Marc
-- 
View this message in context: http://www.nabble.com/w32-shell-execute-function-definition-is-void-tp4718394p24099617.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: browse-url in emacs
  2009-06-18 23:31             ` Marc Girod
@ 2009-06-19  9:39               ` Ken Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Ken Brown @ 2009-06-19  9:39 UTC (permalink / raw)
  To: cygwin

On 6/18/2009 4:58 PM, Marc Girod wrote:
> I did it from within emacs, which was maybe not bright.

It just means that you were trying to replace some in-use files.  This 
should work in cygwin 1.7, though you might have to exit and restart 
emacs to see the effect in some situations.

> Anyway, I got a couple of glitches in the postinstall:
> 
> /etc/postinstall/emacs.sh: line 9: /usr/bin/update-desktop-database: No such
> file or directory
> /etc/postinstall/emacs.sh: line 10: /usr/bin/update-mime-database: No such
> file or directory

Harmless.

> (browse-url "file:///C:/cygwin/home/marc/public_html" nil)
> 
> opened me an Explorer window, instead of the html page in Firefox...

I implemented browse-url using cygstart.  I think this means that it 
should open whatever browser you would get by doing Start -> Run and 
typing the URL.

> Thanks, and congratulations!

Thanks for testing.

Ken

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

end of thread, other threads:[~2009-06-18 23:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-05 17:29 w32-shell-execute function definition is void Mark Fisher
2009-06-16 10:07 ` Marc Girod
2009-06-16 11:58   ` Ken Brown
2009-06-16 12:24     ` Marc Girod
2009-06-16 22:16     ` Eli Zaretskii
2009-06-17  1:54       ` Ken Brown
2009-06-17 20:17         ` Ken Brown
2009-06-18 19:22           ` browse-url in emacs (was Re: w32-shell-execute function definition is void) Ken Brown
2009-06-18 23:31             ` Marc Girod
2009-06-19  9:39               ` browse-url in emacs Ken Brown

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