emacs-diffs
[Top][All Lists]
Advanced

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

master ca1ddef: Tramp: fix location of files on W32


From: Michael Albinus
Subject: master ca1ddef: Tramp: fix location of files on W32
Date: Sat, 10 Apr 2021 08:47:06 -0400 (EDT)

branch: master
commit ca1ddef2627e2d71539467c9042f78d9d560ea9d
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Tramp: fix location of files on W32
    
    * lisp/net/tramp.el:
    * lisp/net/tramp-sh.el: Use (eq system-type 'windows-nt) where appropriate.
    (tramp-completion-function-alist-ssh): Fix location of files on W32.
---
 lisp/net/tramp-sh.el | 34 ++++++++++++++++++++++++++--------
 lisp/net/tramp.el    |  8 ++++----
 2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 8db9dd9..0e6a2bb 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -401,16 +401,34 @@ The string is used in `tramp-methods'.")
 
 ;;;###tramp-autoload
 (defconst tramp-completion-function-alist-ssh
-  '((tramp-parse-rhosts      "/etc/hosts.equiv")
+  `((tramp-parse-rhosts      "/etc/hosts.equiv")
     (tramp-parse-rhosts      "/etc/shosts.equiv")
-    (tramp-parse-shosts      "/etc/ssh_known_hosts")
-    (tramp-parse-sconfig     "/etc/ssh_config")
+    ;; On W32 systems, the ssh directory is located somewhere else.
+    (tramp-parse-shosts      ,(expand-file-name
+                              "ssh/ssh_known_hosts"
+                              (or (and (eq system-type 'windows-nt)
+                                       (getenv "ProgramData"))
+                                  "/etc/")))
+    (tramp-parse-sconfig     ,(expand-file-name
+                              "ssh/ssh_config"
+                              (or (and (eq system-type 'windows-nt)
+                                       (getenv "ProgramData"))
+                                  "/etc/")))
     (tramp-parse-shostkeys   "/etc/ssh2/hostkeys")
     (tramp-parse-sknownhosts "/etc/ssh2/knownhosts")
     (tramp-parse-rhosts      "~/.rhosts")
     (tramp-parse-rhosts      "~/.shosts")
-    (tramp-parse-shosts      "~/.ssh/known_hosts")
-    (tramp-parse-sconfig     "~/.ssh/config")
+    ;; On W32 systems, the .ssh directory is located somewhere else.
+    (tramp-parse-shosts      ,(expand-file-name
+                              ".ssh/known_hosts"
+                              (or (and (eq system-type 'windows-nt)
+                                       (getenv "USERPROFILE"))
+                                  "~/")))
+    (tramp-parse-sconfig     ,(expand-file-name
+                              ".ssh/config"
+                              (or (and (eq system-type 'windows-nt)
+                                       (getenv "USERPROFILE"))
+                                  "~/")))
     (tramp-parse-shostkeys   "~/.ssh2/hostkeys")
     (tramp-parse-sknownhosts "~/.ssh2/knownhosts"))
   "Default list of (FUNCTION FILE) pairs to be examined for ssh methods.")
@@ -433,7 +451,7 @@ The string is used in `tramp-methods'.")
 ;;;###tramp-autoload
 (defconst tramp-completion-function-alist-putty
   `((tramp-parse-putty
-     ,(if (memq system-type '(windows-nt))
+     ,(if (eq system-type 'windows-nt)
          "HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\Sessions"
        "~/.putty/sessions")))
  "Default list of (FUNCTION REGISTRY) pairs to be examined for putty 
sessions.")
@@ -5764,7 +5782,7 @@ function cell is returned to be applied on a buffer."
           ;; slashes as directory separators.
           (cond
            ((and (string-match-p "local" prop)
-                 (memq system-type '(windows-nt)))
+                 (eq system-type 'windows-nt))
               "(%s | \"%s\")")
            ((string-match-p "local" prop) "(%s | %s)")
            (t "(%s | %s >%%s)"))
@@ -5775,7 +5793,7 @@ function cell is returned to be applied on a buffer."
           ;; the pipe symbol be quoted if they use forward
           ;; slashes as directory separators.
           (if (and (string-match-p "local" prop)
-                   (memq system-type '(windows-nt)))
+                   (eq system-type 'windows-nt))
               "(%s <%%s | \"%s\")"
             "(%s <%%s | %s)")
           compress coding))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 578fa14..8da94ec 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -488,7 +488,7 @@ interpreted as a regular expression which always matches."
 ;; either lower case or upper case letters.  See
 ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38079#20>.
 (defcustom tramp-restricted-shell-hosts-alist
-  (when (memq system-type '(windows-nt))
+  (when (eq system-type 'windows-nt)
     (list (format "\\`\\(%s\\|%s\\)\\'"
                  (regexp-quote (downcase tramp-system-name))
                  (regexp-quote (upcase tramp-system-name)))))
@@ -558,7 +558,7 @@ usually suffice.")
 the remote shell.")
 
 (defcustom tramp-local-end-of-line
-  (if (memq system-type '(windows-nt)) "\r\n" "\n")
+  (if (eq system-type 'windows-nt) "\r\n" "\n")
   "String used for end of line in local processes."
   :version "24.1"
   :type 'string)
@@ -3138,7 +3138,7 @@ User may be nil."
 (defun tramp-parse-putty (registry-or-dirname)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
-  (if (memq system-type '(windows-nt))
+  (if (eq system-type 'windows-nt)
       (with-tramp-connection-property nil "parse-putty"
        (with-temp-buffer
          (when (zerop (tramp-call-process
@@ -4990,7 +4990,7 @@ VEC is used for tracing."
     (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8"))
          locale)
       (with-temp-buffer
-       (unless (or (memq system-type '(windows-nt))
+       (unless (or (eq system-type 'windows-nt)
                     (not (zerop (tramp-call-process
                                  nil "locale" nil t nil "-a"))))
          (while candidates



reply via email to

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