unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Patch for Emacs 25.2
@ 2017-01-16  9:44 Michael Albinus
       [not found] ` <jwvlgubruup.fsf-monnier+gmane.emacs.devel@gnu.org>
  2017-01-16 16:11 ` Patch for Emacs 25.2 Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Albinus @ 2017-01-16  9:44 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

Hi,

enclosed is a patch of tramp.el, which fixes a bug introduced by Emacs
25.1, commit e3a0f3daf12e208e88d712b09ef82096849b9431.

Working on this, I found a related bug in files.el, which would be
solved by the appended patch as well.

Both changes are simple, so I'm asking whether they could be applied to
Emacs 25.2. I've adapted also tramp-tests.el, and all tests pass for
both GNU/Linux and MS Windows.

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2952 bytes --]

diff --git a/lisp/files.el b/lisp/files.el
index a6fe381..0d0d6e2 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5940,8 +5940,8 @@ make-auto-save-file-name
 	    ;; Make sure auto-save file names don't contain characters
 	    ;; invalid for the underlying filesystem.
 	    (if (and (memq system-type '(ms-dos windows-nt cygwin))
-		     ;; Don't modify remote (ange-ftp) filenames
-		     (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result)))
+		     ;; Don't modify remote filenames.
+                     (not (file-remote-p result)))
 		(convert-standard-filename result)
 	      result))))
 
@@ -5978,8 +5978,8 @@ make-auto-save-file-name
 		      ((file-writable-p "/var/tmp/") "/var/tmp/")
 		      ("~/")))))
 	       (if (and (memq system-type '(ms-dos windows-nt cygwin))
-			;; Don't modify remote (ange-ftp) filenames
-			(not (string-match "^/\\w+@[-A-Za-z0-9._]+:" fname)))
+			;; Don't modify remote filenames.
+			(not (file-remote-p fname)))
 		   ;; The call to convert-standard-filename is in case
 		   ;; buffer-name includes characters not allowed by the
 		   ;; DOS/Windows filesystems.  make-temp-file writes to the
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b4242c0..f350f2a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4102,7 +4102,11 @@ tramp-handle-make-auto-save-file-name
 	      (file-exists-p tramp-auto-save-directory))
     (make-directory tramp-auto-save-directory t))
 
-  (let ((system-type 'not-windows)
+  (let ((system-type
+	 (if (and (stringp tramp-auto-save-directory)
+		  (file-remote-p tramp-auto-save-directory))
+	     'not-windows
+	   system-type))
 	(auto-save-file-name-transforms
 	 (if (and (null tramp-auto-save-directory)
 		  (boundp 'auto-save-file-name-transforms))
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el
index 83a780d..2c59591 100644
--- a/test/automated/tramp-tests.el
+++ b/test/automated/tramp-tests.el
@@ -1775,13 +1775,17 @@ tramp-test--shell-command-to-string-asynchronously
 	      (should
 	       (string-equal
 		(make-auto-save-file-name)
-		;; This is taken from original `make-auto-save-file-name'.
-		(expand-file-name
-		 (format
-		  "#%s#"
-		  (subst-char-in-string
-		   ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1)))
-		 temporary-file-directory)))))
+                ;; This is taken from original `make-auto-save-file-name'.
+                ;; We call `convert-standard-filename', because on
+                ;; MS Windows the (local) colons must be replaced by
+                ;; exclamation marks.
+                (convert-standard-filename
+                 (expand-file-name
+                  (format
+                   "#%s#"
+                   (subst-char-in-string
+                    ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1)))
+                  temporary-file-directory))))))
 
 	  ;; No mapping.
 	  (let (tramp-auto-save-directory auto-save-file-name-transforms)

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

* Tramp as ELPA package (was: Patch for Emacs 25.2)
       [not found] ` <jwvlgubruup.fsf-monnier+gmane.emacs.devel@gnu.org>
@ 2017-01-16 14:01   ` Michael Albinus
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2017-01-16 14:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[Adding emacs-devel@gnu.org]

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> Hi Michael,

Hi Stefan,

> What do you think about making a GNU ELPA package for Tramp out of
> Emacs's code.
>
> I.e. adding something like
>
>     ("tramp" :core ("lisp/net/tramp.el" "lisp/net/tramp-sh.el" ...))
>
> to elpa.git's externals-list.
>
> The idea would be to use this as a replacement for your
> separately-distributed Tramp package.  I guess, at first you'd still
> distribute your package as well, but having it automatically available
> as a GNU ELPA package should make this need disappear fairly quickly,
> I think (at least as long as the code in emacs.git is the same as the
> one you distribute separately).

I thought already about, but there wasn't enough energy to do it
yet. Maybe I shall play with what you have proposed. Be warned, I will
ask you when I'm blocked :-)

First question: I dislike, that I have to manage *.info files as git
objects in ELPA. Doesn't exist there a mean to produce them from the
sources automatically, when a package is released?

Second question: Tramp produces a web page from its tramp.texi, see
<https://www.gnu.org/software/tramp/>. It's often used as reference. How
could one produce it for an ELPA package?

>         Stefan

Best regards, Michael.



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

* Re: Patch for Emacs 25.2
  2017-01-16  9:44 Patch for Emacs 25.2 Michael Albinus
       [not found] ` <jwvlgubruup.fsf-monnier+gmane.emacs.devel@gnu.org>
@ 2017-01-16 16:11 ` Eli Zaretskii
  2017-01-16 21:49   ` Michael Albinus
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-01-16 16:11 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

> From: Michael Albinus <michael.albinus@gmx.de>
> Date: Mon, 16 Jan 2017 10:44:45 +0100
> 
> enclosed is a patch of tramp.el, which fixes a bug introduced by Emacs
> 25.1, commit e3a0f3daf12e208e88d712b09ef82096849b9431.
> 
> Working on this, I found a related bug in files.el, which would be
> solved by the appended patch as well.
> 
> Both changes are simple, so I'm asking whether they could be applied to
> Emacs 25.2. I've adapted also tramp-tests.el, and all tests pass for
> both GNU/Linux and MS Windows.

Do I understand correctly that fixing the bug introduced by e3a0f3d
requires only the change in tramp.el?  If so, the change for tramp.el
is OK for the emacs-25 branch.

Regarding the other bug and its fix in files.el, can you tell more
about the bug?  A change in files.el affects a very broad class of use
cases, so I'd like to know more before I make up my mind about it.

Thanks.



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

* Re: Patch for Emacs 25.2
  2017-01-16 16:11 ` Patch for Emacs 25.2 Eli Zaretskii
@ 2017-01-16 21:49   ` Michael Albinus
  2017-01-17 15:58     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2017-01-16 21:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

Hi Eli,

> Do I understand correctly that fixing the bug introduced by e3a0f3d
> requires only the change in tramp.el?

That's correct.

> Regarding the other bug and its fix in files.el, can you tell more
> about the bug?  A change in files.el affects a very broad class of use
> cases, so I'd like to know more before I make up my mind about it.

In `make-auto-save-file-name', there is twice a test for ang-ftp file names:

--8<---------------cut here---------------start------------->8---
(not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result)))
--8<---------------cut here---------------end--------------->8---

The regexp matches ange-ftp file names like "/user@host:". It does not
match general Tramp syntax, like "/method:user@host:" or "/host:". As
result, on MS Windows there is an error like

--8<---------------cut here---------------start------------->8---
(let ((buffer-file-name "/method:user@host:/path/to/file")
      tramp-auto-save-directory auto-save-file-name-transforms)
  (make-auto-save-file-name))

=> "\\method!user@host!\\path\\to\\#file#"
--8<---------------cut here---------------end--------------->8---

The patch replaces this regexp by 

--8<---------------cut here---------------start------------->8---
(not (file-remote-p result)))
--8<---------------cut here---------------end--------------->8---

Then it works as expected:

--8<---------------cut here---------------start------------->8---
(let ((buffer-file-name "/method:user@host:/path/to/file")
      tramp-auto-save-directory auto-save-file-name-transforms)
  (make-auto-save-file-name))

=> "/method:user@host:/path/to/#file#"
--8<---------------cut here---------------end--------------->8---

The patch is harmless enough that I propose it for Emacs 25.2.

> Thanks.

Best regards, Michael.



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

* Re: Patch for Emacs 25.2
  2017-01-16 21:49   ` Michael Albinus
@ 2017-01-17 15:58     ` Eli Zaretskii
  2017-01-17 16:16       ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-01-17 15:58 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: emacs-devel@gnu.org
> Date: Mon, 16 Jan 2017 22:49:38 +0100
> 
> In `make-auto-save-file-name', there is twice a test for ang-ftp file names:
> 
> --8<---------------cut here---------------start------------->8---
> (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result)))
> --8<---------------cut here---------------end--------------->8---
> 
> The regexp matches ange-ftp file names like "/user@host:". It does not
> match general Tramp syntax, like "/method:user@host:" or "/host:". As
> result, on MS Windows there is an error like
> 
> --8<---------------cut here---------------start------------->8---
> (let ((buffer-file-name "/method:user@host:/path/to/file")
>       tramp-auto-save-directory auto-save-file-name-transforms)
>   (make-auto-save-file-name))
> 
> => "\\method!user@host!\\path\\to\\#file#"
> --8<---------------cut here---------------end--------------->8---
> 
> The patch replaces this regexp by 
> 
> --8<---------------cut here---------------start------------->8---
> (not (file-remote-p result)))
> --8<---------------cut here---------------end--------------->8---
> 
> Then it works as expected:
> 
> --8<---------------cut here---------------start------------->8---
> (let ((buffer-file-name "/method:user@host:/path/to/file")
>       tramp-auto-save-directory auto-save-file-name-transforms)
>   (make-auto-save-file-name))
> 
> => "/method:user@host:/path/to/#file#"
> --8<---------------cut here---------------end--------------->8---
> 
> The patch is harmless enough that I propose it for Emacs 25.2.

I see your point, but as the current code exists for quite some time
(more than 11 years), I think we can live with it for one more Emacs
release.

So let's leave this out for Emacs 25.2.

Thanks.



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

* Re: Patch for Emacs 25.2
  2017-01-17 15:58     ` Eli Zaretskii
@ 2017-01-17 16:16       ` Michael Albinus
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2017-01-17 16:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> I see your point, but as the current code exists for quite some time
> (more than 11 years), I think we can live with it for one more Emacs
> release.
>
> So let's leave this out for Emacs 25.2.

OK. I'll commit the tramp.el patch for emacs-25, and the tramp.el,
files.el and tramp-tests.el patches for master. tramp.el differs
seriously between emacs-25 and master; I doubt it could be merged w/o
problems.

> Thanks.

Best regards, Michael.



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

end of thread, other threads:[~2017-01-17 16:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-16  9:44 Patch for Emacs 25.2 Michael Albinus
     [not found] ` <jwvlgubruup.fsf-monnier+gmane.emacs.devel@gnu.org>
2017-01-16 14:01   ` Tramp as ELPA package (was: Patch for Emacs 25.2) Michael Albinus
2017-01-16 16:11 ` Patch for Emacs 25.2 Eli Zaretskii
2017-01-16 21:49   ` Michael Albinus
2017-01-17 15:58     ` Eli Zaretskii
2017-01-17 16:16       ` Michael Albinus

Code repositories for project(s) associated with this public inbox

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

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 read-only IMAP folder(s) and NNTP newsgroup(s).