[Top][All Lists]

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

Re: tramp (; Copy-paste of folder from Windows machine to Lin

From: Michael Albinus
Subject: Re: tramp (; Copy-paste of folder from Windows machine to Linux server does not work
Date: Mon, 15 Jul 2019 11:03:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Guillaume Demeyère <address@hidden> writes:

> Hi Michael,

Hi Guillaume,

> 11:49:31.806104 tramp-find-inline-compress (2) # Couldn’t find an
> inline transfer compress command
> However, I think that is because I did not answer your question
> accurately enough. The command:
>  (shell-command-to-string "echo xyzzy | bzip2 | bzip2 -d")
> returns
> "xyzzy
> ", with *one space* after the last y, and one newline.
> Thsi space causes the following line to fail:
>  (string-match
>        (concat "^" (regexp-quote magic) "$") (buffer-string)))
> This space that we get in the output comes, I think, from the space
> between "xyzzy" and the first pipe. If you remove it ( echo
> xyzzy|bzip2...), it disappears from the output. The newline does not
> disappear, though.
> I did my tests with the following  command:
> (with-temp-buffer
>   (tramp-call-local-coding-command "echo xyzzy | compress | compress -
> d" nil t)
>   (string-match
>    (concat "^xyzzy\s*$") (buffer-string)))
> and I checked that the command was successful only if I added \s or
> \s* before the $.
> So I tried, in your patch, to replace "$" by "\s*$".... and it still
> does not work. I also tried "\s*\n$", to no avail. It only works if I
> completely remove the $.

Grrr, MS Windows :-( Under GNU/Linux it works.

So I have modified the expression to "^xyzzy", which is sufficient for
our purposes. I've pushed the change to the repositories (slightly
modified), will appear with the next Tramp release in GNU ELPA, in a
couple of weeks.

For Emacs 26.3 I keep the change to suppress compression on MS
Windows. There exist already a pretest, and I don't want to damage
anything. There's always the option to use Tramp from GNU ELPA.

> I tried writing the buffer-string to *Message* in the patch, and it
> seems the buffer-string has a "^M" (control-M ?) between the space and
> the newline. I'm not sure where it  comes from (I don't have it in the
> test outside the patch), nor how to match it in a regexp (except by
> completely removing the $... ?).  Perhaps you could enlighten me about
> that.

MS Windows uses CR/LF as end-of-line indicator. "^M" is the CR char.

> One more thing : I made the test with a newly installed Windows from
> one of my colleagues, and the command "compress" works without the
> need to install anything. So I did not need to install bzip2. And so
> it makes sense to propose compression out of the box in Windows

Good to know.

> Regards,
> Guillaume

Best regards, Michael.

reply via email to

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