From: Michael Albinus Date: Tue, 5 Nov 2013 14:18:41 +0000 (+0100) Subject: Fix problems found while writing a test suite. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~957 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=158262615caff45976d334f79ff066d565682f1a;p=emacs.git 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fe43c7ad0aa..10dbbf92b84 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2013-11-05 Michael Albinus + + 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 * international/characters.el (glyphless-char-display-control): diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index c5f1882931e..8322b7c085b 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -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) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 360a22d0c37..f8b99dd918e 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -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)))))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 43bec3bde3b..630208a8fbe 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -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)))