* Zsh 4.0.4 and Emacs 21.1 in Windows XP
@ 2001-11-21 19:59 Gary Oberbrunner
2001-11-22 11:26 ` Borsenkow Andrej
2001-11-22 11:35 ` Peter Stephenson
0 siblings, 2 replies; 11+ messages in thread
From: Gary Oberbrunner @ 2001-11-21 19:59 UTC (permalink / raw)
To: zsh-workers
I'm trying to use Zsh 4.0.4 on Windows XP with Emacs 21.1 in shell-mode.
I compiled both of them from sources.
Everything works OK except zsh thinks all my input has an extra CR (^M)
at the end of each line. So in order to do a 'ls' I have to do 'ls;'
and then it does the ls properly and then gives me an error 'zsh:
command not found: ^M'. If I just type ls<CR> I get 'zsh: command not
found: ls^M'. I've turned off all my .z* scripts and it didn't make any
difference. All that's set in my .emacs is
(setq shell-file-name "c:/bin/zsh.exe")
(setq explicit-shell-file-name shell-file-name)
Has anyone tried this? Is it supposed to work?
(By the way, zsh works fine in a regular command window.)
Thanks,
-- Gary Oberbrunner (garyo@genarts.com)
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Zsh 4.0.4 and Emacs 21.1 in Windows XP
2001-11-21 19:59 Zsh 4.0.4 and Emacs 21.1 in Windows XP Gary Oberbrunner
@ 2001-11-22 11:26 ` Borsenkow Andrej
2001-11-23 2:38 ` Gary Oberbrunner
` (2 more replies)
2001-11-22 11:35 ` Peter Stephenson
1 sibling, 3 replies; 11+ messages in thread
From: Borsenkow Andrej @ 2001-11-22 11:26 UTC (permalink / raw)
To: 'Gary Oberbrunner', zsh-workers
>
> I'm trying to use Zsh 4.0.4 on Windows XP with Emacs 21.1 in
shell-mode.
> I compiled both of them from sources.
>
Have you compiled Emacs under Cygwin? (I assume, you have Cygwin
environment as zsh definitely does not work under native Win32). I
vaguely remember there were problems (Xemacs is supposed to work
though).
> Everything works OK except zsh thinks all my input has an extra CR
(^M)
> at the end of each line. So in order to do a 'ls' I have to do 'ls;'
> and then it does the ls properly and then gives me an error 'zsh:
> command not found: ^M'. If I just type ls<CR> I get 'zsh: command not
> found: ls^M'. I've turned off all my .z* scripts and it didn't make
any
> difference. All that's set in my .emacs is
> (setq shell-file-name "c:/bin/zsh.exe")
> (setq explicit-shell-file-name shell-file-name)
>
Probably, you are using native emacs and Cygwin zsh. In this case emacs
writes pipe to zsh in text mode (CR-LF under DOS) and zsh reads it in
binary mode (default for pipes under Cygwin). Please, look on
www.cygwin.com for description of CYGWIN variable, specifically
nobinmode. But I have no idea what effects may it have - it makes Cygwin
read/write pipes in text (in DOS sense) mode which is O.K. for pure text
but may break binary data.
In general it is bad idea to mix native and Cygwin applications.
> Has anyone tried this? Is it supposed to work?
>
Please specify more details.
> (By the way, zsh works fine in a regular command window.)
>
I hope :-)
-andrej
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Zsh 4.0.4 and Emacs 21.1 in Windows XP
2001-11-21 19:59 Zsh 4.0.4 and Emacs 21.1 in Windows XP Gary Oberbrunner
2001-11-22 11:26 ` Borsenkow Andrej
@ 2001-11-22 11:35 ` Peter Stephenson
1 sibling, 0 replies; 11+ messages in thread
From: Peter Stephenson @ 2001-11-22 11:35 UTC (permalink / raw)
To: Gary Oberbrunner, Zsh hackers list
Gary Oberbrunner wrote:
> I'm trying to use Zsh 4.0.4 on Windows XP with Emacs 21.1 in shell-mode.
> I compiled both of them from sources.
>
> Everything works OK except zsh thinks all my input has an extra CR (^M)
> at the end of each line.
If you mean you are seeing extra ^M's appearing, I don't think this is
specific to Windows, actually. Here's the entry from the FAQ --- see if
this helps with your problem.
3.10: Why does zsh not work in an Emacs shell mode any more?
(This information comes from Bart Schaefer and other zsh-workers.)
Emacs 19.29 or thereabouts stopped using a terminal type of "emacs"
in shell buffers, and instead sets it to "dumb". Zsh only kicks in
its special I'm-inside-emacs initialization when the terminal type
is "emacs".
Probably the most reliable way of dealing with this is to look for
the environment variable `$EMACS', which is set to `t' in
Emacs' shell mode. Putting
[[ $EMACS = t ]] && unsetopt zle
in your .zshrc should be sufficient.
Another method is to put
#!/bin/sh
TERM=emacs exec zsh
into a file ~/bin/eshell, then `chmod +x ~/bin/eshell', and
tell emacs to use that as the shell by adding
(setenv "ESHELL" (expand-file-name "~/bin/eshell"))
to ~/.emacs.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Zsh 4.0.4 and Emacs 21.1 in Windows XP
2001-11-22 11:26 ` Borsenkow Andrej
@ 2001-11-23 2:38 ` Gary Oberbrunner
2001-11-23 6:05 ` Borsenkow Andrej
2001-11-23 21:21 ` Gary Oberbrunner
2002-02-08 15:20 ` Gary Oberbrunner
2 siblings, 1 reply; 11+ messages in thread
From: Gary Oberbrunner @ 2001-11-23 2:38 UTC (permalink / raw)
To: Borsenkow Andrej; +Cc: zsh-workers
Borsenkow Andrej wrote:
>Probably, you are using native emacs and Cygwin zsh. In this case emacs
>writes pipe to zsh in text mode (CR-LF under DOS) and zsh reads it in
>binary mode (default for pipes under Cygwin). Please, look on
>www.cygwin.com for description of CYGWIN variable, specifically
>nobinmode. But I have no idea what effects may it have - it makes Cygwin
>read/write pipes in text (in DOS sense) mode which is O.K. for pure text
>but may break binary data.
>
>In general it is bad idea to mix native and Cygwin applications.
>
Yes, I think you nailed it here; my Emacs is compiled natively for
Win32, and I guess zsh must be compiled with cygwin (I don't remember).
And what you describe above sounds like it could be the cause -- I've
traced it quite thoroughly in emacs and it's definitely NOT sending a
CR, only LF. So it must be zsh/cygwin that's adding the CR. Maybe I
can add an option to zsh to strip off trailing CRs -- can anyone point
me to where to start looking? input.c maybe?
Thanks,
-- Gary Oberbrunner (garyo@genarts.com)
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Zsh 4.0.4 and Emacs 21.1 in Windows XP
2001-11-23 2:38 ` Gary Oberbrunner
@ 2001-11-23 6:05 ` Borsenkow Andrej
2001-11-23 15:48 ` Gary Oberbrunner
0 siblings, 1 reply; 11+ messages in thread
From: Borsenkow Andrej @ 2001-11-23 6:05 UTC (permalink / raw)
To: 'Gary Oberbrunner'; +Cc: zsh-workers
>
> >Probably, you are using native emacs and Cygwin zsh. In this case
emacs
> >writes pipe to zsh in text mode (CR-LF under DOS) and zsh reads it in
> >binary mode (default for pipes under Cygwin). Please, look on
> >www.cygwin.com for description of CYGWIN variable, specifically
> >nobinmode. But I have no idea what effects may it have - it makes
Cygwin
> >read/write pipes in text (in DOS sense) mode which is O.K. for pure
text
> >but may break binary data.
> >
> >In general it is bad idea to mix native and Cygwin applications.
> >
> Yes, I think you nailed it here; my Emacs is compiled natively for
> Win32, and I guess zsh must be compiled with cygwin (I don't
remember).
> And what you describe above sounds like it could be the cause -- I've
> traced it quite thoroughly in emacs and it's definitely NOT sending a
> CR, only LF. So it must be zsh/cygwin that's adding the CR.
No. It is *DOS* (i.e. emacs) routines that add CR. Do not forget that
line separator in DOS is CR-LF. So, emacs is (most probably) simply
writes a line in text mode that results in CR-LF being actually sent
over the wire (this CR-LF<->LF translation in DOS is really weird, but
you need it to get some sort of compatibility with standard libc).
Cygwin does *not* adds anything, it reads it "as is".
Maybe I
> can add an option to zsh to strip off trailing CRs -- can anyone point
> me to where to start looking? input.c maybe?
>
Erm ... have you even tried to look at Cygwin page I told you about?
CYGWIN=nobinmode
And export it before starting shell in emacs. How exactly you do it in
emacs I do not know.
-andrej
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Zsh 4.0.4 and Emacs 21.1 in Windows XP
2001-11-23 6:05 ` Borsenkow Andrej
@ 2001-11-23 15:48 ` Gary Oberbrunner
2001-11-23 22:09 ` Gary Oberbrunner
0 siblings, 1 reply; 11+ messages in thread
From: Gary Oberbrunner @ 2001-11-23 15:48 UTC (permalink / raw)
To: Borsenkow Andrej; +Cc: 'Gary Oberbrunner', zsh-workers
Borsenkow Andrej wrote:
>Erm ... have you even tried to look at Cygwin page I told you about?
>
>CYGWIN=nobinmode
>And export it before starting shell in emacs. How exactly you do it in
>emacs I do not know.
>
Sorry, I didn't have a lot of time when I wrote back to you -- my fault.
You were exactly right; zsh works fine for me now. In my .emacs I just put
(setenv "CYGWIN" "nobinmode")
and now when I start the shell it works great. I'll submit this as an
addition to Peter Stephenson's zsh FAQ.
Thanks for your help.
-- Gary Oberbrunner
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Zsh 4.0.4 and Emacs 21.1 in Windows XP
2001-11-22 11:26 ` Borsenkow Andrej
2001-11-23 2:38 ` Gary Oberbrunner
@ 2001-11-23 21:21 ` Gary Oberbrunner
2001-11-26 7:32 ` Borsenkow Andrej
2002-02-08 15:20 ` Gary Oberbrunner
2 siblings, 1 reply; 11+ messages in thread
From: Gary Oberbrunner @ 2001-11-23 21:21 UTC (permalink / raw)
To: Borsenkow Andrej; +Cc: zsh-workers, pws
I'm sorry to say that my previous fix, setting CYGWIN to "nobinmode"
before invoking zsh, doesn't actually work. My initial test was not a
proper test at all. It doesn't seem that setting or not setting CYGWIN
makes any difference. Also, I have the same problem with 'bash' as zsh,
so I guess it's not a zsh problem at all.
I never had this problem before; maybe it's something new in emacs 21.1,
or maybe I'm not building/installing cygwin properly. Oh well, thanks
for the help.
-- Gary Oberbrunner
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Zsh 4.0.4 and Emacs 21.1 in Windows XP
2001-11-23 15:48 ` Gary Oberbrunner
@ 2001-11-23 22:09 ` Gary Oberbrunner
0 siblings, 0 replies; 11+ messages in thread
From: Gary Oberbrunner @ 2001-11-23 22:09 UTC (permalink / raw)
To: zsh-workers; +Cc: Borsenkow Andrej
I don't know if anyone cares, but I just created this patch, which
*does* work for me. Nothing else I tried seemed to do it. It adds a
new option, emacscygwinhack, which deletes any CR at the end of a line
(it works analogously to sunkeyboardhack).
Feel free to come up with a better name for it if you find it at all
useful. Andrej: I tried everything I could with CYGWIN, and had no luck
at all. Maybe it's just me though.
-- Gary Oberbrunner
--- input.c.~1~ Tue Jan 16 08:44:20 2001
+++ input.c Fri Nov 23 14:18:57 2001
@@ -294,6 +294,16 @@
ptr[-1] = '\0';
}
}
+ if (*ingetcline && ingetcline[strlen(ingetcline) - 1] == '\n' &&
+ ingetcline[strlen(ingetcline) - 2] == '\r' &&
+ interact && isset(EMACSCYGWINHACK) && isset(SHINSTDIN) &&
+ SHTTY != -1) {
+ /* Junk an unmatched CR at the end of the line. */
+ int ct;
+ char *ptr = &ingetcline[strlen(ingetcline)-2];
+ *ptr++ = '\n';
+ *ptr = '\0';
+ }
isfirstch = 1;
/* Put this into the input channel. */
inputsetline(ingetcline, INP_FREE);
--- options.c.~1~ Mon Jun 25 13:31:20 2001
+++ options.c Fri Nov 23 14:23:15 2001
@@ -106,6 +106,7 @@
{NULL, "cshjunkiequotes", OPT_EMULATE|OPT_CSH, CSHJUNKIEQUOTES},
{NULL, "cshnullcmd", OPT_EMULATE|OPT_CSH, CSHNULLCMD},
{NULL, "cshnullglob", OPT_EMULATE|OPT_CSH, CSHNULLGLOB},
+{NULL, "emacscygwinhack", 0, EMACSCYGWINHACK},
{NULL, "equals", OPT_EMULATE|OPT_ZSH, EQUALS},
{NULL, "errexit", OPT_EMULATE, ERREXIT},
{NULL, "exec", OPT_ALL, EXECOPT},
--- zsh.h.~1~ Mon Jun 25 13:31:20 2001
+++ zsh.h Fri Nov 23 14:22:46 2001
@@ -1441,6 +1441,7 @@
XTRACE,
USEZLE,
DVORAK,
+ EMACSCYGWINHACK,
OPT_SIZE
};
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Zsh 4.0.4 and Emacs 21.1 in Windows XP
2001-11-23 21:21 ` Gary Oberbrunner
@ 2001-11-26 7:32 ` Borsenkow Andrej
2001-11-26 15:31 ` Gary Oberbrunner
0 siblings, 1 reply; 11+ messages in thread
From: Borsenkow Andrej @ 2001-11-26 7:32 UTC (permalink / raw)
To: 'Gary Oberbrunner'; +Cc: zsh-workers
>
> I'm sorry to say that my previous fix, setting CYGWIN to "nobinmode"
> before invoking zsh, doesn't actually work. My initial test was not a
> proper test at all. It doesn't seem that setting or not setting
CYGWIN
> makes any difference. Also, I have the same problem with 'bash' as
zsh,
> so I guess it's not a zsh problem at all.
>
> I never had this problem before; maybe it's something new in emacs
21.1,
> or maybe I'm not building/installing cygwin properly. Oh well, thanks
> for the help.
>
I cannot reproduce it. I downloaded precompiled binary for emacs-21 off
GNU archives, I have more or less current CVS version of zsh (it dhould
not matter wrt the above problem) and I have current Cygwin
installation. All I did was set ESHELL to d:\cygwin\bin\zsh.exe and
start it in Emacs with M-x shell (that pretty much everything I can do
in emacs; even that took 15 minutes to find out :-)
I have no problems running any command at all; like
MW1G17C% print $options[zle]
off
MW1G17C% print $CYGWIN
MW1G17C% pwd
/cygdrive/c
MW1G17C% cd
MW1G17C% pwd
/cygdrive/c
MW1G17C% echo $HOME
/cygdrive/c
Sorry, but you probably are better off asking this on Cygwin list,
especially as the problem is not limited to zsh.
BTW my emacs sets TERM to emacs which slightly contradicts with FAQ:
d:\cygwin\bin\zsh.exeMW1G17C% echo $TERM
emacs
also HOME is weird (I have different one; may be emacs overwrites it)
and none of rc files are run. Check if you have some unusual setting in
your rc files; try with zsh -f; try with the current Cygwin version.
Finally, why do not you use precompiled binaries for emacs?
-andrej
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Zsh 4.0.4 and Emacs 21.1 in Windows XP
2001-11-26 7:32 ` Borsenkow Andrej
@ 2001-11-26 15:31 ` Gary Oberbrunner
0 siblings, 0 replies; 11+ messages in thread
From: Gary Oberbrunner @ 2001-11-26 15:31 UTC (permalink / raw)
To: Borsenkow Andrej; +Cc: zsh-workers
Borsenkow Andrej wrote:
>I cannot reproduce it. I downloaded precompiled binary for emacs-21 off
>GNU archives, I have more or less current CVS version of zsh (it dhould
>not matter wrt the above problem) and I have current Cygwin
>installation. All I did was set ESHELL to d:\cygwin\bin\zsh.exe and
>start it in Emacs with M-x shell (that pretty much everything I can do
>in emacs; even that took 15 minutes to find out :-)
>
Hmm. Maybe something else in my config is bad. (I don't use precomp
emacs binaries because I'm working on it and usually have it built for
debug etc. -- but when I noticed this I went back to a stock 21.1 build.
I could try the prebuilt emacs bins, but I've never noticed any
difference before.
>Sorry, but you probably are better off asking this on Cygwin list,
>especially as the problem is not limited to zsh.
>
Yeah, you're probably right. Thanks for trying to reproduce it.
-- Gary
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Zsh 4.0.4 and Emacs 21.1 in Windows XP
2001-11-22 11:26 ` Borsenkow Andrej
2001-11-23 2:38 ` Gary Oberbrunner
2001-11-23 21:21 ` Gary Oberbrunner
@ 2002-02-08 15:20 ` Gary Oberbrunner
2 siblings, 0 replies; 11+ messages in thread
From: Gary Oberbrunner @ 2002-02-08 15:20 UTC (permalink / raw)
Cc: zsh-workers
In November, the following exchange occurred:
I wrote:
>>I'm trying to use Zsh 4.0.4 on Windows XP with Emacs 21.1 in
>>shell-mode.
>>Everything works OK except zsh thinks all my input has an extra CR
>>at the end of each line. So in order to do a 'ls' I have to do 'ls;'
>>and then it does the ls properly and then gives me an error 'zsh:
>>command not found: ^M'. If I just type ls<CR> I get 'zsh: command not
>>found: ls^M'. I've turned off all my .z* scripts and it didn't make
Andrej Borsenkow replied:
> Have you compiled Emacs under Cygwin? (I assume, you have Cygwin
> environment as zsh definitely does not work under native Win32). I
> vaguely remember there were problems (Xemacs is supposed to work
> though).
Then after that I submitted a patch which would strip CRs off the end of
input lines, so it would work for me. Well, I finally got enough time
to track it down. It had nothing to do with cygwin bin mode, and
nothing really to do with zsh. (I could make it happen with other
shells too.) And my bogus patch is unnecessary.
It turns out it was caused by the expression (standard-display-european)
in my .emacs file; once I removed that and just used
(set-explicit-shell-file-name "/path/to/zsh.exe") I was fine. I am SO
HAPPY now -- my beloved zsh, in emacs, on Windows and Irix and Linux,
all working beautifully!
I know this is a little off topic, but I just wanted to get it into the
archives in case anyone else had this problem.
-- Gary Oberbrunner
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2002-02-08 15:20 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-21 19:59 Zsh 4.0.4 and Emacs 21.1 in Windows XP Gary Oberbrunner
2001-11-22 11:26 ` Borsenkow Andrej
2001-11-23 2:38 ` Gary Oberbrunner
2001-11-23 6:05 ` Borsenkow Andrej
2001-11-23 15:48 ` Gary Oberbrunner
2001-11-23 22:09 ` Gary Oberbrunner
2001-11-23 21:21 ` Gary Oberbrunner
2001-11-26 7:32 ` Borsenkow Andrej
2001-11-26 15:31 ` Gary Oberbrunner
2002-02-08 15:20 ` Gary Oberbrunner
2001-11-22 11:35 ` Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).