aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/net/tramp-adb.el4
-rw-r--r--lisp/net/tramp-compat.el17
-rw-r--r--lisp/net/tramp-gvfs.el4
-rw-r--r--lisp/net/tramp-sh.el5
-rw-r--r--lisp/net/tramp-smb.el4
-rw-r--r--lisp/net/tramp.el27
6 files changed, 36 insertions, 25 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 3eb1bc44516..259b1cb1b88 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -571,7 +571,7 @@ Emacs dired can't find files."
571 (with-parsed-tramp-file-name filename nil 571 (with-parsed-tramp-file-name filename nil
572 (unless (file-exists-p (file-truename filename)) 572 (unless (file-exists-p (file-truename filename))
573 (tramp-error 573 (tramp-error
574 v 'file-error 574 v tramp-file-missing
575 "Cannot make local copy of non-existing file `%s'" filename)) 575 "Cannot make local copy of non-existing file `%s'" filename))
576 (let ((tmpfile (tramp-compat-make-temp-file filename))) 576 (let ((tmpfile (tramp-compat-make-temp-file filename)))
577 (with-tramp-progress-reporter 577 (with-tramp-progress-reporter
@@ -897,7 +897,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
897 (when p 897 (when p
898 (if (yes-or-no-p "A command is running. Kill it? ") 898 (if (yes-or-no-p "A command is running. Kill it? ")
899 (ignore-errors (kill-process p)) 899 (ignore-errors (kill-process p))
900 (tramp-user-error p "Shell command in progress"))) 900 (tramp-compat-user-error p "Shell command in progress")))
901 901
902 (if current-buffer-p 902 (if current-buffer-p
903 (progn 903 (progn
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index e953170ed09..4ebae79d32a 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -23,8 +23,9 @@
23 23
24;;; Commentary: 24;;; Commentary:
25 25
26;; Tramp's main Emacs version for development is Emacs 25. This 26;; Tramp's main Emacs version for development is Emacs 26. This
27;; package provides compatibility functions for Emacs 23 and Emacs 24. 27;; package provides compatibility functions for Emacs 23, Emacs 24 and
28;; Emacs 25.
28 29
29;;; Code: 30;;; Code:
30 31
@@ -261,6 +262,13 @@ process."
261 (memq (process-status process) 262 (memq (process-status process)
262 '(run open listen connect stop)))))) 263 '(run open listen connect stop))))))
263 264
265;; `user-error' has appeared in Emacs 24.3.
266(defsubst tramp-compat-user-error (vec-or-proc format &rest args)
267 "Signal a pilot error."
268 (apply
269 'tramp-error vec-or-proc
270 (if (fboundp 'user-error) 'user-error 'error) format args))
271
264;; `file-attribute-*' are introduced in Emacs 25.1. 272;; `file-attribute-*' are introduced in Emacs 25.1.
265 273
266(if (fboundp 'file-attribute-type) 274(if (fboundp 'file-attribute-type)
@@ -328,6 +336,11 @@ This is a string of ten letters or dashes as in ls -l."
328(unless (fboundp 'format-message) 336(unless (fboundp 'format-message)
329 (defalias 'format-message 'format)) 337 (defalias 'format-message 'format))
330 338
339;; `file-missing' is introduced in Emacs 26.
340(defconst tramp-file-missing
341 (if (get 'file-missing 'error-conditions) 'file-missing 'file-error)
342 "The error symbol for the `file-missing' error.")
343
331(add-hook 'tramp-unload-hook 344(add-hook 'tramp-unload-hook
332 (lambda () 345 (lambda ()
333 (unload-feature 'tramp-loaddefs 'force) 346 (unload-feature 'tramp-loaddefs 'force)
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 3d8d366daa4..637c2a70ab1 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -541,7 +541,7 @@ Operations not mentioned here will be handled by the default Emacs primitives.")
541First arg specifies the OPERATION, second arg is a list of arguments to 541First arg specifies the OPERATION, second arg is a list of arguments to
542pass to the OPERATION." 542pass to the OPERATION."
543 (unless tramp-gvfs-enabled 543 (unless tramp-gvfs-enabled
544 (tramp-user-error nil "Package `tramp-gvfs' not supported")) 544 (tramp-compat-user-error nil "Package `tramp-gvfs' not supported"))
545 (let ((fn (assoc operation tramp-gvfs-file-name-handler-alist))) 545 (let ((fn (assoc operation tramp-gvfs-file-name-handler-alist)))
546 (if fn 546 (if fn
547 (save-match-data (apply (cdr fn) args)) 547 (save-match-data (apply (cdr fn) args))
@@ -1033,7 +1033,7 @@ file names."
1033 (let ((tmpfile (tramp-compat-make-temp-file filename))) 1033 (let ((tmpfile (tramp-compat-make-temp-file filename)))
1034 (unless (file-exists-p filename) 1034 (unless (file-exists-p filename)
1035 (tramp-error 1035 (tramp-error
1036 v 'file-error 1036 v tramp-file-missing
1037 "Cannot make local copy of non-existing file `%s'" filename)) 1037 "Cannot make local copy of non-existing file `%s'" filename))
1038 (copy-file filename tmpfile 'ok-if-already-exists 'keep-time) 1038 (copy-file filename tmpfile 'ok-if-already-exists 'keep-time)
1039 tmpfile))) 1039 tmpfile)))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 6196b15237a..555e3711db2 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1960,7 +1960,8 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
1960 "File %s already exists; make it a new name anyway? " 1960 "File %s already exists; make it a new name anyway? "
1961 newname))) 1961 newname)))
1962 (tramp-error 1962 (tramp-error
1963 v2 'file-error "add-name-to-file: file %s already exists" newname)) 1963 v2 'file-already-exists
1964 "add-name-to-file: file %s already exists" newname))
1964 (when ok-if-already-exists (setq ln (concat ln " -f"))) 1965 (when ok-if-already-exists (setq ln (concat ln " -f")))
1965 (tramp-flush-file-property v2 (file-name-directory v2-localname)) 1966 (tramp-flush-file-property v2 (file-name-directory v2-localname))
1966 (tramp-flush-file-property v2 v2-localname) 1967 (tramp-flush-file-property v2 v2-localname)
@@ -3130,7 +3131,7 @@ the result will be a local, non-Tramp, file name."
3130 (with-parsed-tramp-file-name filename nil 3131 (with-parsed-tramp-file-name filename nil
3131 (unless (file-exists-p filename) 3132 (unless (file-exists-p filename)
3132 (tramp-error 3133 (tramp-error
3133 v 'file-error 3134 v tramp-file-missing
3134 "Cannot make local copy of non-existing file `%s'" filename)) 3135 "Cannot make local copy of non-existing file `%s'" filename))
3135 3136
3136 (let* ((size (tramp-compat-file-attribute-size 3137 (let* ((size (tramp-compat-file-attribute-size
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index fe24edb3930..0c8ecf470e1 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -902,7 +902,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
902 (with-parsed-tramp-file-name filename nil 902 (with-parsed-tramp-file-name filename nil
903 (unless (file-exists-p filename) 903 (unless (file-exists-p filename)
904 (tramp-error 904 (tramp-error
905 v 'file-error 905 v tramp-file-missing
906 "Cannot make local copy of non-existing file `%s'" filename)) 906 "Cannot make local copy of non-existing file `%s'" filename))
907 (let ((tmpfile (tramp-compat-make-temp-file filename))) 907 (let ((tmpfile (tramp-compat-make-temp-file filename)))
908 (with-tramp-progress-reporter 908 (with-tramp-progress-reporter
@@ -1125,7 +1125,7 @@ target of the symlink differ."
1125 "File %s already exists; make it a new name anyway? " 1125 "File %s already exists; make it a new name anyway? "
1126 linkname))) 1126 linkname)))
1127 (tramp-error 1127 (tramp-error
1128 v2 'file-error 1128 v2 'file-already-exists
1129 "make-symbolic-link: file %s already exists" linkname)) 1129 "make-symbolic-link: file %s already exists" linkname))
1130 (unless (tramp-smb-get-cifs-capabilities v1) 1130 (unless (tramp-smb-get-cifs-capabilities v1)
1131 (tramp-error v2 'file-error "make-symbolic-link not supported")) 1131 (tramp-error v2 'file-error "make-symbolic-link not supported"))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 7af40a818a1..730972e0c4e 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1068,13 +1068,6 @@ calling HANDLER.")
1068 1068
1069;;; Internal functions which must come first: 1069;;; Internal functions which must come first:
1070 1070
1071;; `user-error' has appeared in Emacs 24.3.
1072(defsubst tramp-user-error (vec-or-proc format &rest args)
1073 "Signal a pilot error."
1074 (apply
1075 'tramp-error vec-or-proc
1076 (if (fboundp 'user-error) 'user-error 'error) format args))
1077
1078;; Conversion functions between external representation and 1071;; Conversion functions between external representation and
1079;; internal data structure. Convenience functions for internal 1072;; internal data structure. Convenience functions for internal
1080;; data structure. 1073;; data structure.
@@ -1230,13 +1223,14 @@ This is HOST, if non-nil. Otherwise, it is `tramp-default-host'."
1230 (methods (mapcar 'car tramp-methods))) 1223 (methods (mapcar 'car tramp-methods)))
1231 (when (and method (not (member method methods))) 1224 (when (and method (not (member method methods)))
1232 (tramp-cleanup-connection vec) 1225 (tramp-cleanup-connection vec)
1233 (tramp-user-error vec "Unknown method \"%s\"" method)) 1226 (tramp-compat-user-error vec "Unknown method \"%s\"" method))
1234 (when (and (equal tramp-syntax 'ftp) host 1227 (when (and (equal tramp-syntax 'ftp) host
1235 (or (null method) (get-text-property 0 'tramp-default method)) 1228 (or (null method) (get-text-property 0 'tramp-default method))
1236 (or (null user) (get-text-property 0 'tramp-default user)) 1229 (or (null user) (get-text-property 0 'tramp-default user))
1237 (member host methods)) 1230 (member host methods))
1238 (tramp-cleanup-connection vec) 1231 (tramp-cleanup-connection vec)
1239 (tramp-user-error vec "Host name must not match method \"%s\"" host)))) 1232 (tramp-compat-user-error
1233 vec "Host name must not match method \"%s\"" host))))
1240 1234
1241(defun tramp-dissect-file-name (name &optional nodefault) 1235(defun tramp-dissect-file-name (name &optional nodefault)
1242 "Return a `tramp-file-name' structure. 1236 "Return a `tramp-file-name' structure.
@@ -1246,7 +1240,8 @@ non-nil, the file name parts are not expanded to their default
1246values." 1240values."
1247 (save-match-data 1241 (save-match-data
1248 (let ((match (string-match (nth 0 tramp-file-name-structure) name))) 1242 (let ((match (string-match (nth 0 tramp-file-name-structure) name)))
1249 (unless match (tramp-user-error nil "Not a Tramp file name: \"%s\"" name)) 1243 (unless match
1244 (tramp-compat-user-error nil "Not a Tramp file name: \"%s\"" name))
1250 (let ((method (match-string (nth 1 tramp-file-name-structure) name)) 1245 (let ((method (match-string (nth 1 tramp-file-name-structure) name))
1251 (user (match-string (nth 2 tramp-file-name-structure) name)) 1246 (user (match-string (nth 2 tramp-file-name-structure) name))
1252 (host (match-string (nth 3 tramp-file-name-structure) name)) 1247 (host (match-string (nth 3 tramp-file-name-structure) name))
@@ -1434,12 +1429,12 @@ ARGUMENTS to actually emit the message (if applicable)."
1434 '("tramp-backtrace" 1429 '("tramp-backtrace"
1435 "tramp-compat-condition-case-unless-debug" 1430 "tramp-compat-condition-case-unless-debug"
1436 "tramp-compat-funcall" 1431 "tramp-compat-funcall"
1432 "tramp-compat-user-error"
1437 "tramp-condition-case-unless-debug" 1433 "tramp-condition-case-unless-debug"
1438 "tramp-debug-message" 1434 "tramp-debug-message"
1439 "tramp-error" 1435 "tramp-error"
1440 "tramp-error-with-buffer" 1436 "tramp-error-with-buffer"
1441 "tramp-message" 1437 "tramp-message")
1442 "tramp-user-error")
1443 t) 1438 t)
1444 "$") 1439 "$")
1445 fn))) 1440 fn)))
@@ -3035,7 +3030,8 @@ User is always nil."
3035 (unwind-protect 3030 (unwind-protect
3036 (if (not (file-exists-p filename)) 3031 (if (not (file-exists-p filename))
3037 (tramp-error 3032 (tramp-error
3038 v 'file-error "File `%s' not found on remote host" filename) 3033 v tramp-file-missing
3034 "File `%s' not found on remote host" filename)
3039 3035
3040 (with-tramp-progress-reporter 3036 (with-tramp-progress-reporter
3041 v 3 (format-message "Inserting `%s'" filename) 3037 v 3 (format-message "Inserting `%s'" filename)
@@ -3160,7 +3156,8 @@ User is always nil."
3160 "File `%s' does not include a `.el' or `.elc' suffix" file))) 3156 "File `%s' does not include a `.el' or `.elc' suffix" file)))
3161 (unless noerror 3157 (unless noerror
3162 (when (not (file-exists-p file)) 3158 (when (not (file-exists-p file))
3163 (tramp-error v 'file-error "Cannot load nonexistent file `%s'" file))) 3159 (tramp-error
3160 v tramp-file-missing "Cannot load nonexistent file `%s'" file)))
3164 (if (not (file-exists-p file)) 3161 (if (not (file-exists-p file))
3165 nil 3162 nil
3166 (let ((tramp-message-show-message (not nomessage))) 3163 (let ((tramp-message-show-message (not nomessage)))
@@ -3221,7 +3218,7 @@ User is always nil."
3221 (when p 3218 (when p
3222 (if (yes-or-no-p "A command is running. Kill it? ") 3219 (if (yes-or-no-p "A command is running. Kill it? ")
3223 (ignore-errors (kill-process p)) 3220 (ignore-errors (kill-process p))
3224 (tramp-user-error p "Shell command in progress"))) 3221 (tramp-compat-user-error p "Shell command in progress")))
3225 3222
3226 (if current-buffer-p 3223 (if current-buffer-p
3227 (progn 3224 (progn