]> code.delx.au - gnu-emacs/commitdiff
* net/tramp-compat.el (tramp-compat-user-error): New defun.
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 18 Mar 2013 13:04:13 +0000 (14:04 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 18 Mar 2013 13:04:13 +0000 (14:04 +0100)
* net/tramp-adb.el (tramp-adb-handle-shell-command):
* net/tramp-gvfs.el (top):
* net/tramp.el (tramp-find-method, tramp-dissect-file-name)
(tramp-handle-shell-command): Use it.
(tramp-dissect-file-name): Raise an error when hostname is a
method name, and neither method nor user is specified.

* net/trampver.el: Update release number.

lisp/ChangeLog
lisp/net/tramp-adb.el
lisp/net/tramp-compat.el
lisp/net/tramp-gvfs.el
lisp/net/tramp.el
lisp/net/trampver.el

index 7bd027a81d42f6b9c46e3048b3bb0e84de608f70..bd1cbbcf5bbeb82687024b18afd2201b1062b2d6 100644 (file)
@@ -1,3 +1,16 @@
+2013-03-18  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-compat.el (tramp-compat-user-error): New defun.
+
+       * net/tramp-adb.el (tramp-adb-handle-shell-command):
+       * net/tramp-gvfs.el (top):
+       * net/tramp.el (tramp-find-method, tramp-dissect-file-name)
+       (tramp-handle-shell-command): Use it.
+       (tramp-dissect-file-name): Raise an error when hostname is a
+       method name, and neither method nor user is specified.
+
+       * net/trampver.el: Update release number.
+
 2013-03-18  Leo Liu  <sdl.web@gmail.com>
 
        Make sure eldoc can be turned off properly.
index 8b4e610b728e819fc6a4bcfd364b5a9ac50c53ba..a71df54db58e3059476aecbc48e77df574cd5b17 100644 (file)
@@ -856,7 +856,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
     (when p
       (if (yes-or-no-p "A command is running.  Kill it? ")
          (ignore-errors (kill-process p))
-       (error "Shell command in progress")))
+       (tramp-compat-user-error "Shell command in progress")))
 
     (if current-buffer-p
        (progn
index d4639817b1867c2ba17a9bde031ffcf2445751e4..ed61fbcfa764c337ba4199a2ca3644d60b391ece 100644 (file)
@@ -533,6 +533,11 @@ EOL-TYPE can be one of `dos', `unix', or `mac'."
                        "`dos', `unix', or `mac'")))))
         (t (error "Can't change EOL conversion -- is MULE missing?"))))
 
+;; `user-error' has been added to Emacs 24.3.
+(defun tramp-compat-user-error (format &rest args)
+  "Signal a pilot error."
+  (apply (if (fboundp 'user-error) 'user-error 'error) format args))
+
 (add-hook 'tramp-unload-hook
          (lambda ()
            (unload-feature 'tramp-compat 'force)))
index e3850653263fd782418f6278f4b372baa6a6376e..6f066f56a2bcd36f62536cb14e9bc7b4ee2d6a8d 100644 (file)
 (unless (and (tramp-compat-funcall 'dbus-get-unique-name :session)
             (or (tramp-compat-process-running-p "gvfs-fuse-daemon")
                 (tramp-compat-process-running-p "gvfsd-fuse")))
-  (error "Package `tramp-gvfs' not supported"))
+  (tramp-compat-user-error "Package `tramp-gvfs' not supported"))
 
 (defconst tramp-gvfs-path-mounttracker "/org/gtk/vfs/mounttracker"
   "The object path of the GVFS daemon.")
index dc3dffd857bc1942f50ff02235700478475d8c94..86f7f338b274b82e46a8e5114b9ba0311dfc18b9 100644 (file)
@@ -1203,7 +1203,7 @@ their replacement."
                  result (substring result 0 -1))
          (unless (y-or-n-p (format "Method %s is obsolete, use %s? "
                                    result (substring result 0 -1)))
-           (error 'file-error "Method \"%s\" not supported" result)))
+           (tramp-compat-user-error "Method \"%s\" not supported" result)))
        (add-to-list 'tramp-warned-obsolete-methods result))
       ;; This works with the current set of `tramp-obsolete-methods'.
       ;; Must be improved, if their are more sophisticated replacements.
@@ -1249,7 +1249,7 @@ non-nil, the file name parts are not expanded to their default
 values."
   (save-match-data
     (let ((match (string-match (nth 0 tramp-file-name-structure) name)))
-      (unless match (error "Not a Tramp file name: %s" name))
+      (unless match (tramp-compat-user-error "Not a Tramp file name: %s" name))
       (let ((method    (match-string (nth 1 tramp-file-name-structure) name))
            (user      (match-string (nth 2 tramp-file-name-structure) name))
            (host      (match-string (nth 3 tramp-file-name-structure) name))
@@ -1259,7 +1259,12 @@ values."
          (when (string-match tramp-prefix-ipv6-regexp host)
            (setq host (replace-match "" nil t host)))
          (when (string-match tramp-postfix-ipv6-regexp host)
-           (setq host (replace-match "" nil t host))))
+           (setq host (replace-match "" nil t host)))
+         (when (and (equal tramp-syntax 'ftp) (null method) (null user)
+                    (member host (mapcar 'car tramp-methods))
+                    (not (tramp-completion-mode-p)))
+           (tramp-compat-user-error
+            "Host name must not match method `%s'" host)))
        (if nodefault
            (vector method user host localname hop)
          (vector
@@ -3179,7 +3184,7 @@ User is always nil."
     (when p
       (if (yes-or-no-p "A command is running.  Kill it? ")
          (ignore-errors (kill-process p))
-       (error "Shell command in progress")))
+       (tramp-compat-user-error "Shell command in progress")))
 
     (if current-buffer-p
        (progn
index 64053c202b704843adaa2cadb6efa39b336ed974..0e54cd60d98120e332ff524e5b91d3a8ddfb0459 100644 (file)
@@ -31,7 +31,7 @@
 ;; should be changed only there.
 
 ;;;###tramp-autoload
-(defconst tramp-version "2.2.7"
+(defconst tramp-version "2.2.8-pre"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -44,7 +44,7 @@
                      (= emacs-major-version 21)
                      (>= emacs-minor-version 4)))
             "ok"
-          (format "Tramp 2.2.7 is not fit for %s"
+          (format "Tramp 2.2.8-pre is not fit for %s"
                   (when (string-match "^.*$" (emacs-version))
                     (match-string 0 (emacs-version)))))))
   (unless (string-match "\\`ok\\'" x) (error "%s" x)))