Discussion:
eshell - win32 - executable files
(too old to reply)
matt
2003-01-18 22:01:50 UTC
Permalink
This may be something that I need to do in the Windows registry, but...

How can I specify which files are executable. On a windows system there
are the normal ones like .exe, .bat, .com, etc. What I want to do is to
tell emacs that another type of file is executable, so that I can just
type the filename and have it execute like any other command.
Specifically, a perl script. I want to be able to execute say
"myscript.pl" without having to type: perl path_to_script/myscript.pl. I
have the file association set in explorer, and the path to the script is
in my path. I can execute it in cmd.exe by typing myscript.pl, but not
in eshell.

Any ideas?

TIA -- Matt
--
Remove the X's to reply directly.
John Wiegley
2003-01-19 06:02:53 UTC
Permalink
Post by matt
This may be something that I need to do in the Windows registry,
but... How can I specify which files are executable. On a windows
system there are the normal ones like .exe, .bat, .com, etc. What I
want to do is to tell emacs that another type of file is
executable, so that I can just type the filename and have it
execute like any other command. Specifically, a perl script. I want
perl path_to_script/myscript.pl. I have the file association set in
explorer, and the path to the script is in my path. I can execute
it in cmd.exe by typing myscript.pl, but not in eshell.
Any ideas?
Configure the variable `eshell-binary-suffixes'.

John
matt
2003-01-19 07:04:54 UTC
Permalink
Post by John Wiegley
Post by matt
This may be something that I need to do in the Windows registry,
but... How can I specify which files are executable. On a windows
system there are the normal ones like .exe, .bat, .com, etc. What I
want to do is to tell emacs that another type of file is
executable, so that I can just type the filename and have it
execute like any other command. Specifically, a perl script. I want
perl path_to_script/myscript.pl. I have the file association set in
explorer, and the path to the script is in my path. I can execute
it in cmd.exe by typing myscript.pl, but not in eshell.
Any ideas?
Configure the variable `eshell-binary-suffixes'.
John
Thanks John. How do I do that? What I've done is not working. I found
'eshell-binary-suffixes' in esh-ext.el, looks like this:

(defcustom eshell-binary-suffixes
(if (eshell-under-windows-p)
'(".exe" ".com" ".bat" ".cmd" "")
'(""))
"*A list of suffixes used when searching for executable files."

I added ".pl" to the list. I tried load-file, load-library, and
emacs-lisp-byte-compile-and-load. No luck. Is there somewhere else I
should be setting this?

Thanks -- Matt
--
Remove the X's to reply directly.
John Wiegley
2003-01-19 07:12:46 UTC
Permalink
(defcustom eshell-binary-suffixes (if
(eshell-under-windows-p) '(".exe" ".com" ".bat" ".cmd" "") '(""))
"*A list of suffixes used when searching for executable files."
I added ".pl" to the list. I tried load-file, load-library, and
emacs-lisp-byte-compile-and-load. No luck. Is there somewhere else
I should be setting this?
Try this, in your .emacs:

(eval-after-load "esh-ext"
'(progn (add-to-list 'eshell-binary-suffixes ".pl")))

John
matt
2003-01-19 07:30:37 UTC
Permalink
Post by John Wiegley
(defcustom eshell-binary-suffixes (if
(eshell-under-windows-p) '(".exe" ".com" ".bat" ".cmd" "") '(""))
"*A list of suffixes used when searching for executable files."
I added ".pl" to the list. I tried load-file, load-library, and
emacs-lisp-byte-compile-and-load. No luck. Is there somewhere else
I should be setting this?
(eval-after-load "esh-ext"
'(progn (add-to-list 'eshell-binary-suffixes ".pl")))
John
Still no luck. Does this work for you?

-- Matt
--
Remove the X's to reply directly.
John Wiegley
2003-01-20 20:17:48 UTC
Permalink
Post by matt
Still no luck. Does this work for you?
Hmm, once, when I used to use Windows machines, I was doing something
close to exactly this. You definitely want to configure
`eshell-binary-suffixes'. You can test it by using the "which"
command, followed by the name of your script.

Oh, wait, you must ALSO set `eshell-force-execution' to t. :)

John
Sören Vogel
2003-01-19 09:14:18 UTC
Permalink
Hi Matt,

might be done outside emacs, too:

my computer -- advanced -- environment variables -- PATHEXT

S=F6ren.
matt
2003-01-19 09:23:45 UTC
Permalink
Post by Sören Vogel
Hi Matt,
my computer -- advanced -- environment variables -- PATHEXT
Sören.
As I mentioned in the original post, the file *is* in my path. I just
need to let eshell know that .pl files are executable.

-- Matt
--
Remove the X's to reply directly.
Sören Vogel
2003-01-19 10:12:27 UTC
Permalink
Post by Sören Vogel
my computer -- advanced -- environment variables -- PATHEXT
PATHEXT does not mean PATH but what extensions executable files
might have to be recognized by the shell. If eshell refers to
environmental variables, too, it might work.

S=F6ren.
matt
2003-01-19 10:34:20 UTC
Permalink
Post by Sören Vogel
Post by Sören Vogel
my computer -- advanced -- environment variables -- PATHEXT
PATHEXT does not mean PATH but what extensions executable files
might have to be recognized by the shell. If eshell refers to
environmental variables, too, it might work.
Sören.
You're right. Sorry, I didn't read your post close enough.
Unfortunately, eshell doesn't seem to use that variable.

-- Matt
--
Remove the X's to reply directly.
Ehud Karni
2003-01-20 11:59:52 UTC
Permalink
Post by matt
This may be something that I need to do in the Windows registry, but...
How can I specify which files are executable. On a windows system there
are the normal ones like .exe, .bat, .com, etc. What I want to do is to
tell emacs that another type of file is executable, so that I can just
type the filename and have it execute like any other command.
I've seen this thread, and I think it went in the wrong direction.

Try to modify the 'executable-binary-suffixes' list like this:
(add-to-list 'executable-binary-suffixes ".new-ext")
does it help ?

Ehud.


- --
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
mailto:***@unix.mvs.co.il Better Safe Than Sorry
Matt
2003-01-20 20:23:20 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by matt
This may be something that I need to do in the Windows registry, but...
How can I specify which files are executable. On a windows system there
are the normal ones like .exe, .bat, .com, etc. What I want to do is to
tell emacs that another type of file is executable, so that I can just
type the filename and have it execute like any other command.
I've seen this thread, and I think it went in the wrong direction.
(add-to-list 'executable-binary-suffixes ".new-ext")
does it help ?
I think you mean eshell-binary-suffixes. If I add that to my .emacs I
get an error on startup:

Symbol's value as variable is void: eshell-binary-suffixes

but evaluating it after eshell is loaded works. Unfortunately, that does
not fix the problem. At least not by itsself. After looking over
esh-ext.el again, I found another variable - eshell-force-execution -
which needs to be not-nil. Changing the value to t works. Here's what it
says in the file:

(defcustom eshell-force-execution nil
"*If non-nil, try to execute binary files regardless of permissions.
This can be useful on systems like Windows, where the operating system
doesn't happen to honor the permission bits in certain cases; or in
cases where you want to associate an interpreter with a particular
kind of script file, but the language won't let you but a '#!'
interpreter line in the file, and you don't want to make it executable
since nothing else but Eshell will be able to understand
`eshell-interpreter-alist'."
:type 'boolean
:group 'eshell-ext)

I made all of the changes directly to esh-ext.el, byte-compiled, and
restarted emacs. After that, I had to make sure that there was the
"shabang" line in the .pl file(#!c:/perl/bin/perl.exe -w). I usually
don't add this in windows, because explorer takes care of the file
association, and it's not needed. Also, the -w is there(apart from being
good perl programming practice) because of the DOS carriage return
character. eshell - like a unix shell - will complain that it cannot
find perl.exe^M . The alternative is to run dos2unix on the file.

Thank for all the help.

-- Matt
--
Remove the X's to reply directly.
Continue reading on narkive:
Loading...