Commit 95beaef3 authored by Michael Albinus's avatar Michael Albinus
Browse files

* net/tramp-compat.el (tramp-compat-user-error): Move it ...

* net/tramp.el (tramp-user-error): ... here.
(tramp-find-method, tramp-check-proper-host)
(tramp-dissect-file-name, tramp-debug-message)
(tramp-handle-shell-command):
* net/tramp-adb.el (tramp-adb-handle-shell-command):
* net/tramp-gvfs.el (tramp-gvfs-file-name-handler): Adapt callees.

* net/tramp-cache.el (tramp-cache-print): Don't print text properties.
parent 8b098236
2013-09-02 Michael Albinus <michael.albinus@gmx.de>
* net/tramp-compat.el (tramp-compat-user-error): Move it ...
* net/tramp.el (tramp-user-error): ... here.
(tramp-find-method, tramp-check-proper-host)
(tramp-dissect-file-name, tramp-debug-message)
(tramp-handle-shell-command):
* net/tramp-adb.el (tramp-adb-handle-shell-command):
* net/tramp-gvfs.el (tramp-gvfs-file-name-handler): Adapt callees.
* net/tramp-cache.el (tramp-cache-print): Don't print text properties.
2013-09-02 Martin Rudalics <rudalics@gmx.at> 2013-09-02 Martin Rudalics <rudalics@gmx.at>
* avoid.el (mouse-avoidance-point-position) * avoid.el (mouse-avoidance-point-position)
......
...@@ -874,7 +874,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." ...@@ -874,7 +874,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(when p (when p
(if (yes-or-no-p "A command is running. Kill it? ") (if (yes-or-no-p "A command is running. Kill it? ")
(ignore-errors (kill-process p)) (ignore-errors (kill-process p))
(tramp-compat-user-error "Shell command in progress"))) (tramp-user-error p "Shell command in progress")))
(if current-buffer-p (if current-buffer-p
(progn (progn
......
...@@ -285,6 +285,11 @@ KEY identifies the connection, it is either a process or a vector." ...@@ -285,6 +285,11 @@ KEY identifies the connection, it is either a process or a vector."
(let (result) (let (result)
(maphash (maphash
(lambda (key value) (lambda (key value)
;; Remove text properties from KEY.
(when (vectorp key)
(dotimes (i (length key))
(when (stringp (aref key i))
(aset key i (substring-no-properties (aref key i))))))
(let ((tmp (format (let ((tmp (format
"(%s %s)" "(%s %s)"
(if (processp key) (if (processp key)
......
...@@ -518,12 +518,6 @@ EOL-TYPE can be one of `dos', `unix', or `mac'." ...@@ -518,12 +518,6 @@ EOL-TYPE can be one of `dos', `unix', or `mac'."
"`dos', `unix', or `mac'"))))) "`dos', `unix', or `mac'")))))
(t (error "Can't change EOL conversion -- is MULE missing?")))) (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."
; (tramp-backtrace)
(apply (if (fboundp 'user-error) 'user-error 'error) format args))
(add-hook 'tramp-unload-hook (add-hook 'tramp-unload-hook
(lambda () (lambda ()
(unload-feature 'tramp-compat 'force))) (unload-feature 'tramp-compat 'force)))
......
...@@ -490,7 +490,7 @@ Operations not mentioned here will be handled by the default Emacs primitives.") ...@@ -490,7 +490,7 @@ Operations not mentioned here will be handled by the default Emacs primitives.")
First arg specifies the OPERATION, second arg is a list of arguments to First arg specifies the OPERATION, second arg is a list of arguments to
pass to the OPERATION." pass to the OPERATION."
(unless tramp-gvfs-enabled (unless tramp-gvfs-enabled
(tramp-compat-user-error "Package `tramp-gvfs' not supported")) (tramp-user-error nil "Package `tramp-gvfs' not supported"))
(let ((fn (assoc operation tramp-gvfs-file-name-handler-alist))) (let ((fn (assoc operation tramp-gvfs-file-name-handler-alist)))
(if fn (if fn
(save-match-data (apply (cdr fn) args)) (save-match-data (apply (cdr fn) args))
......
...@@ -1120,6 +1120,12 @@ calling HANDLER.") ...@@ -1120,6 +1120,12 @@ calling HANDLER.")
;;; Internal functions which must come first: ;;; Internal functions which must come first:
(defsubst tramp-user-error (vec-or-proc format &rest args)
"Signal a pilot error."
(apply
'tramp-error vec-or-proc
(if (fboundp 'user-error) 'user-error 'error) format args))
;; Conversion functions between external representation and ;; Conversion functions between external representation and
;; internal data structure. Convenience functions for internal ;; internal data structure. Convenience functions for internal
;; data structure. ;; data structure.
...@@ -1232,9 +1238,9 @@ their replacement." ...@@ -1232,9 +1238,9 @@ their replacement."
(if noninteractive (if noninteractive
(warn "Method %s is obsolete, using %s" (warn "Method %s is obsolete, using %s"
result (substring result 0 -1)) result (substring result 0 -1))
(unless (y-or-n-p (format "Method %s is obsolete, use %s? " (unless (y-or-n-p (format "Method \"%s\" is obsolete, use \"%s\"? "
result (substring result 0 -1))) result (substring result 0 -1)))
(tramp-compat-user-error "Method \"%s\" not supported" result))) (tramp-user-error nil "Method \"%s\" not supported" result)))
(add-to-list 'tramp-warned-obsolete-methods result)) (add-to-list 'tramp-warned-obsolete-methods result))
;; This works with the current set of `tramp-obsolete-methods'. ;; This works with the current set of `tramp-obsolete-methods'.
;; Must be improved, if their are more sophisticated replacements. ;; Must be improved, if their are more sophisticated replacements.
...@@ -1289,8 +1295,8 @@ This is HOST, if non-nil. Otherwise, it is `tramp-default-host'." ...@@ -1289,8 +1295,8 @@ This is HOST, if non-nil. Otherwise, it is `tramp-default-host'."
(or (null method) (get-text-property 0 'tramp-default method)) (or (null method) (get-text-property 0 'tramp-default method))
(or (null user) (get-text-property 0 'tramp-default user)) (or (null user) (get-text-property 0 'tramp-default user))
(member host (mapcar 'car tramp-methods))) (member host (mapcar 'car tramp-methods)))
(tramp-compat-user-error (tramp-cleanup-connection vec)
"Host name must not match method `%s'" host)))) (tramp-user-error vec "Host name must not match method \"%s\"" host))))
(defun tramp-dissect-file-name (name &optional nodefault) (defun tramp-dissect-file-name (name &optional nodefault)
"Return a `tramp-file-name' structure. "Return a `tramp-file-name' structure.
...@@ -1300,7 +1306,7 @@ non-nil, the file name parts are not expanded to their default ...@@ -1300,7 +1306,7 @@ non-nil, the file name parts are not expanded to their default
values." values."
(save-match-data (save-match-data
(let ((match (string-match (nth 0 tramp-file-name-structure) name))) (let ((match (string-match (nth 0 tramp-file-name-structure) name)))
(unless match (tramp-compat-user-error "Not a Tramp file name: %s" name)) (unless match (tramp-user-error nil "Not a Tramp file name: \"%s\"" name))
(let ((method (match-string (nth 1 tramp-file-name-structure) name)) (let ((method (match-string (nth 1 tramp-file-name-structure) name))
(user (match-string (nth 2 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)) (host (match-string (nth 3 tramp-file-name-structure) name))
...@@ -1485,7 +1491,8 @@ ARGUMENTS to actually emit the message (if applicable)." ...@@ -1485,7 +1491,8 @@ ARGUMENTS to actually emit the message (if applicable)."
"tramp-debug-message" "tramp-debug-message"
"tramp-error" "tramp-error"
"tramp-error-with-buffer" "tramp-error-with-buffer"
"tramp-message") "tramp-message"
"tramp-user-error")
t) t)
"$") "$")
fn))) fn)))
...@@ -3236,7 +3243,7 @@ User is always nil." ...@@ -3236,7 +3243,7 @@ User is always nil."
(when p (when p
(if (yes-or-no-p "A command is running. Kill it? ") (if (yes-or-no-p "A command is running. Kill it? ")
(ignore-errors (kill-process p)) (ignore-errors (kill-process p))
(tramp-compat-user-error "Shell command in progress"))) (tramp-user-error p "Shell command in progress")))
(if current-buffer-p (if current-buffer-p
(progn (progn
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment