]> code.delx.au - gnu-emacs/blobdiff - lisp/net/tramp-cmds.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / net / tramp-cmds.el
index 5015929534dec5bfa62d8be715cfa612238790f0..856011fc0ee9844af639b2548d144bc87410e853 100644 (file)
@@ -1,6 +1,6 @@
 ;;; tramp-cmds.el --- Interactive commands for Tramp
 
 ;;; tramp-cmds.el --- Interactive commands for Tramp
 
-;; Copyright (C) 2007-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2016 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -31,6 +31,9 @@
 (require 'tramp)
 
 ;; Pacify byte-compiler.
 (require 'tramp)
 
 ;; Pacify byte-compiler.
+(declare-function mml-mode "mml")
+(declare-function mml-insert-empty-tag "mml")
+(declare-function reporter-dump-variable "reporter")
 (defvar reporter-eval-buffer)
 (defvar reporter-prompt-for-summary-p)
 
 (defvar reporter-eval-buffer)
 (defvar reporter-prompt-for-summary-p)
 
    nil
    (mapcar
     (lambda (x)
    nil
    (mapcar
     (lambda (x)
-      (with-current-buffer x
-       (when (and (stringp default-directory)
-                  (file-remote-p default-directory))
-         x)))
+      (with-current-buffer x (when (tramp-tramp-file-p default-directory) x)))
     (buffer-list))))
 
 ;;;###tramp-autoload
     (buffer-list))))
 
 ;;;###tramp-autoload
@@ -81,8 +81,7 @@ When called interactively, a Tramp connection has to be selected."
              (completing-read
               "Enter Tramp connection: " connections nil t
               (try-completion "" connections)))
              (completing-read
               "Enter Tramp connection: " connections nil t
               (try-completion "" connections)))
-       (when (and name (file-remote-p name))
-         (with-parsed-tramp-file-name name nil v))))
+       (and (tramp-tramp-file-p name) (tramp-dissect-file-name name))))
     nil nil))
 
   (if (not vec)
     nil nil))
 
   (if (not vec)
@@ -92,6 +91,11 @@ When called interactively, a Tramp connection has to be selected."
     ;; Flush password cache.
     (unless keep-password (tramp-clear-passwd vec))
 
     ;; Flush password cache.
     (unless keep-password (tramp-clear-passwd vec))
 
+    ;; Cleanup `tramp-current-connection'.  Otherwise, we would be
+    ;; suppressed in the test suite.  We use `keep-password' as
+    ;; indicator; it is not worth to add a new argument.
+    (when keep-password (setq tramp-current-connection nil))
+
     ;; Flush file cache.
     (tramp-flush-directory-property vec "")
 
     ;; Flush file cache.
     (tramp-flush-directory-property vec "")
 
@@ -113,8 +117,7 @@ When called interactively, a Tramp connection has to be selected."
 (defun tramp-cleanup-this-connection ()
   "Flush all connection related objects of the current buffer's connection."
   (interactive)
 (defun tramp-cleanup-this-connection ()
   "Flush all connection related objects of the current buffer's connection."
   (interactive)
-  (and (stringp default-directory)
-       (file-remote-p default-directory)
+  (and (tramp-tramp-file-p default-directory)
        (tramp-cleanup-connection
        (tramp-dissect-file-name default-directory 'noexpand))))
 
        (tramp-cleanup-connection
        (tramp-dissect-file-name default-directory 'noexpand))))
 
@@ -128,7 +131,7 @@ This includes password cache, file cache, connection cache, buffers."
   (setq tramp-locked nil)
 
   ;; Flush password cache.
   (setq tramp-locked nil)
 
   ;; Flush password cache.
-  (tramp-compat-funcall 'password-reset)
+  (password-reset)
 
   ;; Flush file and connection cache.
   (clrhash tramp-cache-data)
 
   ;; Flush file and connection cache.
   (clrhash tramp-cache-data)
@@ -142,7 +145,7 @@ This includes password cache, file cache, connection cache, buffers."
   "Kill all remote buffers."
   (interactive)
 
   "Kill all remote buffers."
   (interactive)
 
-  ;; Remove all Tramp related buffers.
+  ;; Remove all Tramp related connections.
   (tramp-cleanup-all-connections)
 
   ;; Remove all buffers with a remote default-directory.
   (tramp-cleanup-all-connections)
 
   ;; Remove all buffers with a remote default-directory.
@@ -157,8 +160,8 @@ This includes password cache, file cache, connection cache, buffers."
   (interactive "P")
   (if arg (insert tramp-version) (message tramp-version)))
 
   (interactive "P")
   (if arg (insert tramp-version) (message tramp-version)))
 
-;; Make the `reporter` functionality available for making bug reports about
-;; the package. A most useful piece of code.
+;; Make the "reporter" functionality available for making bug reports about
+;; the package.  A most useful piece of code.
 
 (autoload 'reporter-submit-bug-report "reporter")
 
 
 (autoload 'reporter-submit-bug-report "reporter")
 
@@ -166,7 +169,6 @@ This includes password cache, file cache, connection cache, buffers."
 (defun tramp-bug ()
   "Submit a bug report to the Tramp developers."
   (interactive)
 (defun tramp-bug ()
   "Submit a bug report to the Tramp developers."
   (interactive)
-  (require 'reporter)
   (catch 'dont-send
     (let ((reporter-prompt-for-summary-p t))
       (reporter-submit-bug-report
   (catch 'dont-send
     (let ((reporter-prompt-for-summary-p t))
       (reporter-submit-bug-report
@@ -185,7 +187,6 @@ This includes password cache, file cache, connection cache, buffers."
             backup-by-copying-when-mismatch
             backup-by-copying-when-privileged-mismatch
             backup-directory-alist
             backup-by-copying-when-mismatch
             backup-by-copying-when-privileged-mismatch
             backup-directory-alist
-            bkup-backup-directory-info
             password-cache
             password-cache-expiry
             remote-file-name-inhibit-cache
             password-cache
             password-cache-expiry
             remote-file-name-inhibit-cache
@@ -194,8 +195,7 @@ This includes password cache, file cache, connection cache, buffers."
 
        'tramp-load-report-modules      ; pre-hook
        'tramp-append-tramp-buffers     ; post-hook
 
        'tramp-load-report-modules      ; pre-hook
        'tramp-append-tramp-buffers     ; post-hook
-       (funcall
-       (if (functionp 'propertize) 'propertize 'progn)
+       (propertize
        "\n" 'display "\
 Enter your bug report in this message, including as much detail
 as you possibly can about the problem, what you did to cause it
        "\n" 'display "\
 Enter your bug report in this message, including as much detail
 as you possibly can about the problem, what you did to cause it
@@ -209,7 +209,7 @@ Before reproducing the bug, you might apply
 
   M-x tramp-cleanup-all-connections
 
 
   M-x tramp-cleanup-all-connections
 
-This allows to investigate from a clean environment.  Another
+This allows us to investigate from a clean environment.  Another
 useful thing to do is to put
 
   (setq tramp-verbose 9)
 useful thing to do is to put
 
   (setq tramp-verbose 9)
@@ -236,11 +236,14 @@ buffer in your bug report.
                 (string-match
                  (concat "[^" (symbol-value 'mm-7bit-chars) "]") val))
        (with-current-buffer reporter-eval-buffer
                 (string-match
                  (concat "[^" (symbol-value 'mm-7bit-chars) "]") val))
        (with-current-buffer reporter-eval-buffer
-         (set varsym (format "(base64-decode-string \"%s\")"
-                             (base64-encode-string val))))))
+         (set
+          varsym
+          (format
+           "(decode-coding-string (base64-decode-string \"%s\") 'raw-text)"
+           (base64-encode-string (encode-coding-string val 'raw-text)))))))
 
     ;; Dump variable.
 
     ;; Dump variable.
-    (tramp-compat-funcall 'reporter-dump-variable varsym mailbuf)
+    (reporter-dump-variable varsym mailbuf)
 
     (unless (hash-table-p val)
       ;; Remove string quotation.
 
     (unless (hash-table-p val)
       ;; Remove string quotation.
@@ -261,15 +264,8 @@ buffer in your bug report.
 
 (defun tramp-load-report-modules ()
   "Load needed modules for reporting."
 
 (defun tramp-load-report-modules ()
   "Load needed modules for reporting."
-  ;; We load message.el and mml.el from Gnus.
-  (if (featurep 'xemacs)
-      (progn
-       (load "message" 'noerror)
-       (load "mml" 'noerror))
-    (require 'message nil 'noerror)
-    (require 'mml nil 'noerror))
-  (tramp-compat-funcall 'message-mode)
-  (tramp-compat-funcall 'mml-mode t))
+  (message-mode)
+  (mml-mode t))
 
 (defun tramp-append-tramp-buffers ()
   "Append Tramp buffers and buffer local variables into the bug report."
 
 (defun tramp-append-tramp-buffers ()
   "Append Tramp buffers and buffer local variables into the bug report."
@@ -300,7 +296,7 @@ buffer in your bug report.
               ;; Non-tramp variables of interest.
               '(default-directory))
              'string<))
               ;; Non-tramp variables of interest.
               '(default-directory))
              'string<))
-           (tramp-compat-funcall 'reporter-dump-variable varsym elbuf))
+           (reporter-dump-variable varsym elbuf))
        (lisp-indent-line)
        (insert ")\n"))
       (insert-buffer-substring elbuf)))
        (lisp-indent-line)
        (insert ")\n"))
       (insert-buffer-substring elbuf)))
@@ -310,7 +306,7 @@ buffer in your bug report.
   (ignore-errors
     (mapc
      (lambda (x) (when (string-match "tramp" x) (insert x "\n")))
   (ignore-errors
     (mapc
      (lambda (x) (when (string-match "tramp" x) (insert x "\n")))
-     (split-string (tramp-compat-funcall 'list-load-path-shadows t) "\n")))
+     (split-string (list-load-path-shadows t) "\n")))
 
   ;; Append buffers only when we are in message mode.
   (when (and
 
   ;; Append buffers only when we are in message mode.
   (when (and
@@ -319,7 +315,7 @@ buffer in your bug report.
         (symbol-value 'mml-mode))
 
     (let ((tramp-buf-regexp "\\*\\(debug \\)?tramp/")
         (symbol-value 'mml-mode))
 
     (let ((tramp-buf-regexp "\\*\\(debug \\)?tramp/")
-         (buffer-list (tramp-compat-funcall 'tramp-list-tramp-buffers))
+         (buffer-list (tramp-list-tramp-buffers))
          (curbuf (current-buffer)))
 
       ;; There is at least one Tramp buffer.
          (curbuf (current-buffer)))
 
       ;; There is at least one Tramp buffer.
@@ -366,8 +362,8 @@ This is a special notion of the `gnus/message' package.  If you
 use another mail agent (by copying the contents of this buffer)
 please ensure that the buffers are attached to your email.\n\n"))
              (dolist (buffer buffer-list)
 use another mail agent (by copying the contents of this buffer)
 please ensure that the buffers are attached to your email.\n\n"))
              (dolist (buffer buffer-list)
-               (tramp-compat-funcall
-                'mml-insert-empty-tag 'part 'type "text/plain"
+               (mml-insert-empty-tag
+                'part 'type "text/plain"
                 'encoding "base64" 'disposition "attachment" 'buffer buffer
                 'description buffer))
              (set-buffer-modified-p nil))
                 'encoding "base64" 'disposition "attachment" 'buffer buffer
                 'description buffer))
              (set-buffer-modified-p nil))