emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tramp and conversion of \r\n into \n


From: Thomas Ross
Subject: Re: Tramp and conversion of \r\n into \n
Date: Fri, 6 Aug 2021 22:07:04 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0

> Try to add `:connection-type 'pipe` to see the difference (you may also
> have to add a call to `process-send-eof` to flush the send buffer, IIRC).
Yep, looks like you're right. `:connection-type 'pipe` fixes this on my
local machine. It does not, however, fix it over TRAMP (and let-binding
tramp-process-connection-type to 'pipe doesn't change that):

> (make-process :name "hexdump" :command '("hexdump" "-v" "-e" "/1 \"%02X\n\"") 
> :buffer "hexdump" :connection-type 'pipe :file-handler t)
> (process-send-string "hexdump" "abc\r\n"
> 61
> 62
> 63
> 0A
> 0A
It's also interesting to note that `(process-send-eof "hexdump")` is
required to get output on my local machine, but it's not required over
TRAMP.

Independent of this apparent TRAMP bug, lsp-tramp-connection will likely
need to be modified to use connection-type 'pipe. Currently it uses
start-file-process-shell-command (which calls start-file-process, which
calls start-process, which calls make-process), and uses the default
connection-type.

Thanks,
Thomas.

On 2021-08-05 10:10 a.m., Stefan Monnier wrote:
>>> (make-process :name "hexdump" :command '("hexdump" "-v" "-e" "/1 
>>> \"%02X\n\"") :buffer "hexdump")
>>> (process-send-string "hexdump" "abc\r\n")
>>
>> on my system (Linux, Emacs 27.1):
>>
>>> 61
>>> 62
>>> 63
>>> 0A
>>> 0A
> 
> What you're seeing here is the effect of the use of a tty (i.e. the
> conversion or \r to \n is done by the tty rather than by Emacs).
> 
> Try to add `:connection-type 'pipe` to see the difference (you may also
> have to add a call to `process-send-eof` to flush the send buffer, IIRC).
> 
> 
>         Stefan
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]