]> code.delx.au - gnu-emacs/commitdiff
Fix problems found while writing a test suite.
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 5 Nov 2013 14:18:41 +0000 (15:18 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 5 Nov 2013 14:18:41 +0000 (15:18 +0100)
* net/tramp-compat.el (tramp-compat-load): New defun.
* net/tramp.el (tramp-handle-load): Use it.

* net/tramp-sh.el (tramp-sh-handle-add-name-to-file): Handle the case
"(numberp ok-if-already-exists)" correctly.

lisp/ChangeLog
lisp/net/tramp-compat.el
lisp/net/tramp-sh.el
lisp/net/tramp.el

index fe43c7ad0aadf4bb97b5cafae3c7ab00fdbd182e..10dbbf92b84a047f2d086e8f98e20203dd1b0b61 100644 (file)
@@ -1,3 +1,13 @@
+2013-11-05  Michael Albinus  <michael.albinus@gmx.de>
+
+       Fix problems found while writing a test suite.
+
+       * net/tramp-compat.el (tramp-compat-load): New defun.
+       * net/tramp.el (tramp-handle-load): Use it.
+
+       * net/tramp-sh.el (tramp-sh-handle-add-name-to-file): Handle the case
+       "(numberp ok-if-already-exists)" correctly.
+
 2013-11-05  Xue Fuqiao  <xfq.free@gmail.com>
 
        * international/characters.el (glyphless-char-display-control):
index c5f1882931e35c6626d0ed03169ee2acc5418575..8322b7c085bb34ab2093e76210fe9da0aea5a41b 100644 (file)
@@ -416,6 +416,13 @@ Not actually used.  Use `(format \"%o\" i)' instead?"
                directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
      (delete-directory directory))))
 
+;; MUST-SUFFIX doesn't exist on XEmacs.
+(defun tramp-compat-load (file &optional noerror nomessage nosuffix must-suffix)
+  "Like `load' for Tramp files (compat function)."
+  (if must-suffix
+      (tramp-compat-funcall 'load file noerror nomessage nosuffix must-suffix)
+    (load file noerror nomessage nosuffix)))
+
 ;; `number-sequence' does not exist in XEmacs.  Implementation is
 ;; taken from Emacs 23.
 (defun tramp-compat-number-sequence (from &optional to inc)
index 360a22d0c374f8300ff9b4c4a3fa6153578854d8..f8b99dd918eae73a33ca6e5a7710bf0661240401 100644 (file)
@@ -1784,21 +1784,21 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
   (with-parsed-tramp-file-name filename v1
     (with-parsed-tramp-file-name newname v2
       (let ((ln (when v1 (tramp-get-remote-ln v1))))
-       (when (and (not ok-if-already-exists)
+       (when (and (numberp ok-if-already-exists)
                   (file-exists-p newname)
-                  (not (numberp ok-if-already-exists))
-                  (y-or-n-p
+                  (yes-or-no-p
                    (format
                     "File %s already exists; make it a new name anyway? "
                     newname)))
          (tramp-error
-          v2 'file-error
-          "add-name-to-file: file %s already exists" newname))
+          v2 'file-error "add-name-to-file: file %s already exists" newname))
+       (when ok-if-already-exists (setq ln (concat ln " -f")))
        (tramp-flush-file-property v2 (file-name-directory v2-localname))
        (tramp-flush-file-property v2 v2-localname)
        (tramp-barf-unless-okay
         v1
-        (format "%s %s %s" ln (tramp-shell-quote-argument v1-localname)
+        (format "%s %s %s" ln
+                (tramp-shell-quote-argument v1-localname)
                 (tramp-shell-quote-argument v2-localname))
         "error with add-name-to-file, see buffer `%s' for details"
         (buffer-name))))))
index 43bec3bde3bafaf85c772d393f1f9e1f037a1437..630208a8fbe96a080119a4b3b4d23fc5a415a512 100644 (file)
@@ -3150,9 +3150,8 @@ User is always nil."
       (let ((tramp-message-show-message (not nomessage)))
        (with-tramp-progress-reporter v 0 (format "Loading %s" file)
          (let ((local-copy (file-local-copy file)))
-           ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
            (unwind-protect
-               (load local-copy noerror t t)
+               (tramp-compat-load local-copy noerror t nosuffix must-suffix)
              (delete-file local-copy)))))
       t)))