all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* pari.el : Process stty in windows ?
@ 2016-03-15  9:57 Unknown
  2016-03-15 17:27 ` Eli Zaretskii
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Unknown @ 2016-03-15  9:57 UTC (permalink / raw)
  To: help-gnu-emacs

Dear all,

   [I posted this message on comp.emacs yesterday but this forum seems 
much more active]

   In pari.el under unix/linux, I use the following function:
----------------------------------------------------------------

(defun gp-get-shell (process-name process-buffer-name cmd)
     "Explicit. Aimed at command gp+parameters."
     (let ((process-environment (copy-sequence process-environment)))
       (setenv "TERM"    "emacs")
       (setenv "PAGER"   "cat")
       (setenv "LINES"   "1000")
       (setenv "COLUMNS" (number-to-string (window-width)))
       (start-process process-name process-buffer-name
                      shell-file-name
                      shell-command-switch
                      (concat "stty -echo onlret; " cmd))))
-----------------------------------------------------------------

with cmd = "/usr/bin/gp -s 10000000 -p 500000 --emacs" for instance.

Windows even with gnuwin32 complains quite a lot.
It seems that stty exists but "onlret" is unknown and the ";" does not 
seem to be recognized.

As a matter of fact I am the maintainer of pariemacs, but I have only 
unix at work/home and don't know nothing about windows. it worked well 
for a long time until recently I had a user from the windows world 
trying to get everything to work. The script editing work, only calling 
gp in an inferior shell bugs.

The error message says that "onlret;" is an invalid argument of stty 
(notice the ";").
If we remove the stty part, gp is indeed called but dies with a gentle 
"Goodbye !" (without the prompt even to be seen).


I'm hard put to correct such a thing. So if anyone has an idea, I'll 
edit it for my user. I guess such a patch would be very useful for many 
others, so I'll publish it, though I'm definitely no friend of windows --

Many thanks in advance,
Best, Olivier


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

* Re: pari.el : Process stty in windows ?
  2016-03-15  9:57 pari.el : Process stty in windows ? Unknown
@ 2016-03-15 17:27 ` Eli Zaretskii
       [not found] ` <mailman.7598.1458062858.843.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2016-03-15 17:27 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Ramare <ramare@invalid>
> Date: Tue, 15 Mar 2016 10:57:23 +0100
> 
>    In pari.el under unix/linux, I use the following function:
> ----------------------------------------------------------------
> 
> (defun gp-get-shell (process-name process-buffer-name cmd)
>      "Explicit. Aimed at command gp+parameters."
>      (let ((process-environment (copy-sequence process-environment)))
>        (setenv "TERM"    "emacs")
>        (setenv "PAGER"   "cat")
>        (setenv "LINES"   "1000")
>        (setenv "COLUMNS" (number-to-string (window-width)))
>        (start-process process-name process-buffer-name
>                       shell-file-name
>                       shell-command-switch
>                       (concat "stty -echo onlret; " cmd))))
> -----------------------------------------------------------------
> 
> with cmd = "/usr/bin/gp -s 10000000 -p 500000 --emacs" for instance.
> 
> Windows even with gnuwin32 complains quite a lot.
> It seems that stty exists but "onlret" is unknown and the ";" does not 
> seem to be recognized.
> 
> As a matter of fact I am the maintainer of pariemacs, but I have only 
> unix at work/home and don't know nothing about windows. it worked well 
> for a long time until recently I had a user from the windows world 
> trying to get everything to work. The script editing work, only calling 
> gp in an inferior shell bugs.
> 
> The error message says that "onlret;" is an invalid argument of stty 
> (notice the ";").
> If we remove the stty part, gp is indeed called but dies with a gentle 
> "Goodbye !" (without the prompt even to be seen).
> 
> 
> I'm hard put to correct such a thing. So if anyone has an idea, I'll 
> edit it for my user. I guess such a patch would be very useful for many 
> others, so I'll publish it, though I'm definitely no friend of windows --

AFAIK, "stty onlret" will never work on Windows, as long as you use
the standard system shell.  You can ignore the fact that you have some
stty.exe, it won't do what you want, because that functionality is
simply not supported.

Please explain why you need that command, maybe there's an equivalent
solution.



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

* Re: pari.el : Process stty in windows ?
       [not found] ` <mailman.7598.1458062858.843.help-gnu-emacs@gnu.org>
@ 2016-03-16  7:17   ` Unknown
  2016-03-16 15:43     ` Eli Zaretskii
       [not found]     ` <mailman.7646.1458143060.843.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Unknown @ 2016-03-16  7:17 UTC (permalink / raw)
  To: help-gnu-emacs


> Please explain why you need that command, maybe there's an equivalent
> solution.

I should have been clearer. onlret is not my main problem, but the fact 
that I don't know how to glue two commands.

The user types something in emacs, pari.el sends it to gp and does not 
want it to be echoed back. This is the reason of


(start-process process-name process-buffer-name
                       shell-file-name
                       shell-command-switch
                       (concat "stty -echo ; " cmd))

But we get the answer "stty: invalid argument ";"".

The simpler

(start-process process-name process-buffer-name
   shell-file-name
   shell-command-switch
   cmd)

does not work either, emacs seems or pari.el seems to hang (I haven't 
investigated this part enough).


With the even simpler

(shell-command "gp --emacs")

emacs starts and exits the process immediately, cleanly as if an "exit" 
command had been entered. The only glitch though is that no prompt appears.

Many thanks for some advice,
Best, O.


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

* Re: pari.el : Process stty in windows ?
  2016-03-16  7:17   ` Unknown
@ 2016-03-16 15:43     ` Eli Zaretskii
       [not found]     ` <mailman.7646.1458143060.843.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2016-03-16 15:43 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Ramare <ramare@invalid>
> Date: Wed, 16 Mar 2016 08:17:05 +0100
> 
> > Please explain why you need that command, maybe there's an equivalent
> > solution.
> 
> I should have been clearer. onlret is not my main problem, but the fact 
> that I don't know how to glue two commands.

Ah, that...  This has a simple solution.

> The user types something in emacs, pari.el sends it to gp and does not 
> want it to be echoed back. This is the reason of
> 
> 
> (start-process process-name process-buffer-name
>                        shell-file-name
>                        shell-command-switch
>                        (concat "stty -echo ; " cmd))
> 
> But we get the answer "stty: invalid argument ";"".

You need to quote the whole command, like so:

  (concat "\"stty -echo ; " cmd "\"")

(Btw, if you want to invoke a shell command, why do you use
start-process?  Why not use shell-command instead (if the command ends
with a "&", it will be run asynchronously)?

> With the even simpler
> 
> (shell-command "gp --emacs")
> 
> emacs starts and exits the process immediately, cleanly as if an "exit" 
> command had been entered. The only glitch though is that no prompt appears.

I don't know what is "gp" and how does it invoke Emacs.



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

* Re: pari.el : Process stty in windows ?
       [not found]     ` <mailman.7646.1458143060.843.help-gnu-emacs@gnu.org>
@ 2016-03-17 12:30       ` Unknown
  2016-03-17 16:30         ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Unknown @ 2016-03-17 12:30 UTC (permalink / raw)
  To: help-gnu-emacs

 >> but the fact
 >> that I don't know how to glue two commands.
[...]
 >> But we get the answer "stty: invalid argument ";"".
 >
 > You need to quote the whole command, like so:
 >
 >    (concat "\"stty -echo ; " cmd "\"")

Windows still complains about the ; --

 > (Btw, if you want to invoke a shell command, why do you use
 > start-process?  Why not use shell-command instead (if the command ends
 > with a "&", it will be run asynchronously)?

The ";" is still on the way --
Or there are other means to send information to the shell and tell it we 
don't want any echo ? I don't see how I can send two commands without 
glueing them in some way --
A.O.



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

* Re: pari.el : Process stty in windows ?
  2016-03-15  9:57 pari.el : Process stty in windows ? Unknown
  2016-03-15 17:27 ` Eli Zaretskii
       [not found] ` <mailman.7598.1458062858.843.help-gnu-emacs@gnu.org>
@ 2016-03-17 13:15 ` Yuri Khan
       [not found] ` <mailman.7677.1458220547.843.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 10+ messages in thread
From: Yuri Khan @ 2016-03-17 13:15 UTC (permalink / raw)
  Cc: help-gnu-emacs@gnu.org

On Tue, Mar 15, 2016 at 3:57 PM, Ramare <ramare@invalid> wrote:

>       (start-process process-name process-buffer-name
>                      shell-file-name
>                      shell-command-switch
>                      (concat "stty -echo onlret; " cmd))))

> Windows even with gnuwin32 complains quite a lot.
> It seems that stty exists but "onlret" is unknown and the ";" does not seem to be recognized.

So what’s your shell-file-name on Windows? Could it be cmd.exe instead of bash?

If so, you’ll have to use the “&” character instead of “;” to separate commands.

You could probably get away with using “&&” on both platforms if you
know stty always returns a success exit code.



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

* Re: pari.el : Process stty in windows ?
  2016-03-17 12:30       ` Unknown
@ 2016-03-17 16:30         ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2016-03-17 16:30 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Ramare <ramare@invalid>
> Date: Thu, 17 Mar 2016 13:30:55 +0100
> 
>  >> but the fact
>  >> that I don't know how to glue two commands.
> [...]
>  >> But we get the answer "stty: invalid argument ";"".
>  >
>  > You need to quote the whole command, like so:
>  >
>  >    (concat "\"stty -echo ; " cmd "\"")
> 
> Windows still complains about the ; --

Try "&" instead of ";".

> Or there are other means to send information to the shell and tell it we 
> don't want any echo ?

Which echo would you like to suppress?



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

* Re: pari.el : Process stty in windows ?
       [not found] ` <mailman.7677.1458220547.843.help-gnu-emacs@gnu.org>
@ 2016-03-17 17:49   ` Unknown
  2016-03-17 17:57     ` Yuri Khan
       [not found]     ` <mailman.7695.1458237493.843.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Unknown @ 2016-03-17 17:49 UTC (permalink / raw)
  To: help-gnu-emacs

[...]

> So what’s your shell-file-name on Windows? Could it be cmd.exe instead of bash?

Yes it is cmdproxy.exe and I can't find manual for it. Do you have any 
that  explains the syntax?
A.O.



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

* Re: pari.el : Process stty in windows ?
  2016-03-17 17:49   ` Unknown
@ 2016-03-17 17:57     ` Yuri Khan
       [not found]     ` <mailman.7695.1458237493.843.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 10+ messages in thread
From: Yuri Khan @ 2016-03-17 17:57 UTC (permalink / raw)
  Cc: help-gnu-emacs@gnu.org

On Thu, Mar 17, 2016 at 11:49 PM, Ramare <ramare@invalid> wrote:

>> So what’s your shell-file-name on Windows? Could it be cmd.exe instead of
>> bash?
>
> Yes it is cmdproxy.exe and I can't find manual for it. Do you have any that
> explains the syntax?

Perhaps it might be okay to assume that cmdproxy.exe is a proxy for
cmd.exe, and use the documentation for cmd.exe instead?

https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true



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

* Re: pari.el : Process stty in windows ?
       [not found]     ` <mailman.7695.1458237493.843.help-gnu-emacs@gnu.org>
@ 2016-03-17 19:17       ` Unknown
  0 siblings, 0 replies; 10+ messages in thread
From: Unknown @ 2016-03-17 19:17 UTC (permalink / raw)
  To: help-gnu-emacs

[...]
> Perhaps it might be okay to assume that cmdproxy.exe is a proxy for
> cmd.exe, and use the documentation for cmd.exe instead?
>
> https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true

Ok many thanks I'll do some trials and come back in one or two days --
A.O.



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

end of thread, other threads:[~2016-03-17 19:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-15  9:57 pari.el : Process stty in windows ? Unknown
2016-03-15 17:27 ` Eli Zaretskii
     [not found] ` <mailman.7598.1458062858.843.help-gnu-emacs@gnu.org>
2016-03-16  7:17   ` Unknown
2016-03-16 15:43     ` Eli Zaretskii
     [not found]     ` <mailman.7646.1458143060.843.help-gnu-emacs@gnu.org>
2016-03-17 12:30       ` Unknown
2016-03-17 16:30         ` Eli Zaretskii
2016-03-17 13:15 ` Yuri Khan
     [not found] ` <mailman.7677.1458220547.843.help-gnu-emacs@gnu.org>
2016-03-17 17:49   ` Unknown
2016-03-17 17:57     ` Yuri Khan
     [not found]     ` <mailman.7695.1458237493.843.help-gnu-emacs@gnu.org>
2016-03-17 19:17       ` Unknown

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.