aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2024-08-04 13:23:43 +0200
committerMichael Albinus2024-08-04 13:23:43 +0200
commit1b806a200edcb893471237f47e969dbb9d6a99f1 (patch)
tree615ac6d1f074bbc4da6f3f90653898c6e83379dd
parentff6954b9c833bfeb8032fb772fa08e60e9ec56a8 (diff)
downloademacs-1b806a200edcb893471237f47e969dbb9d6a99f1.tar.gz
emacs-1b806a200edcb893471237f47e969dbb9d6a99f1.zip
Remove further compat code from Tramp
* lisp/net/tramp-adb.el (tramp-adb-handle-process-file): Use `process-file-return-signal-string'. * lisp/net/tramp-cache.el (tramp-dump-connection-properties): Use "lisp-data" for persistency file. * lisp/net/tramp-cmds.el (tramp-cleanup-this-connection) (tramp-rename-these-files, tramp-recompile-elpa): Declare `completion'. * lisp/net/tramp-container.el (tramp-kubernetes--container) (tramp-kubernetes--pod, tramp-kubernetes--namespace): Make more robust. * lisp/net/tramp-crypt.el (tramp-crypt-remove-directory): Declare `completion'. * lisp/net/tramp-gvfs.el (file-notyify-callback): Declare. * lisp/net/tramp-sh.el (process-file-return-signal-string) (vc-handled-backends): Don't declare. * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory): Use `copy-directory-create-symlink'. * lisp/net/tramp.el (tramp-skeleton-write-region): Use `lock-file' and `unlock-file'.. (tramp-handle-make-lock-file-name): Use `remote-file-name-inhibit-locks'. (tramp-handle-unlock-file): Use `remote-file-name-inhibit-locks' and `userlock--handle-unlock-error'. (tramp-handle-shell-command): Use `shell-command-buffer-name-async' and `shell-command-buffer-name'. (tramp-read-passwd): Remove workaround.
-rw-r--r--lisp/net/tramp-adb.el4
-rw-r--r--lisp/net/tramp-cache.el3
-rw-r--r--lisp/net/tramp-cmds.el28
-rw-r--r--lisp/net/tramp-container.el19
-rw-r--r--lisp/net/tramp-crypt.el12
-rw-r--r--lisp/net/tramp-gvfs.el4
-rw-r--r--lisp/net/tramp-message.el5
-rw-r--r--lisp/net/tramp-sh.el11
-rw-r--r--lisp/net/tramp-smb.el3
-rw-r--r--lisp/net/tramp.el63
10 files changed, 50 insertions, 102 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 3b8a930cb57..e8bb8ec3184 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -763,9 +763,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
763 (kill-buffer (tramp-get-connection-buffer v)) 763 (kill-buffer (tramp-get-connection-buffer v))
764 (setq ret 1))) 764 (setq ret 1)))
765 765
766 ;; Handle signals. `process-file-return-signal-string' exists 766 (when (and process-file-return-signal-string
767 ;; since Emacs 28.1.
768 (when (and (bound-and-true-p process-file-return-signal-string)
769 (natnump ret) (> ret 128)) 767 (natnump ret) (> ret 128))
770 (setq ret (nth (- ret 128) (tramp-adb-get-signal-strings v)))))) 768 (setq ret (nth (- ret 128) (tramp-adb-get-signal-strings v))))))
771 769
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 9d7fb488412..85a318b8a93 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -584,8 +584,7 @@ PROPERTIES is a list of file properties (strings)."
584 ;; Dump it. 584 ;; Dump it.
585 (with-temp-file tramp-persistency-file-name 585 (with-temp-file tramp-persistency-file-name
586 (insert 586 (insert
587 ;; Starting with Emacs 28, we could use `lisp-data'. 587 (format ";; -*- lisp-data -*- <%s %s>\n"
588 (format ";; -*- emacs-lisp -*- <%s %s>\n"
589 (time-stamp-string "%02y/%02m/%02d %02H:%02M:%02S") 588 (time-stamp-string "%02y/%02m/%02d %02H:%02M:%02S")
590 tramp-persistency-file-name) 589 tramp-persistency-file-name)
591 ";; Tramp connection history. Don't change this file.\n" 590 ";; Tramp connection history. Don't change this file.\n"
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 866532041c5..3cc8704aaba 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -157,18 +157,12 @@ When called interactively, a Tramp connection has to be selected."
157;;;###tramp-autoload 157;;;###tramp-autoload
158(defun tramp-cleanup-this-connection () 158(defun tramp-cleanup-this-connection ()
159 "Flush all connection related objects of the current buffer's connection." 159 "Flush all connection related objects of the current buffer's connection."
160 ;; (declare (completion tramp-command-completion-p))) 160 (declare (completion tramp-command-completion-p))
161 (interactive) 161 (interactive)
162 (and (tramp-tramp-file-p default-directory) 162 (and (tramp-tramp-file-p default-directory)
163 (tramp-cleanup-connection 163 (tramp-cleanup-connection
164 (tramp-dissect-file-name default-directory 'noexpand)))) 164 (tramp-dissect-file-name default-directory 'noexpand))))
165 165
166;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form.
167;;;###tramp-autoload
168(function-put
169 #'tramp-cleanup-this-connection 'completion-predicate
170 #'tramp-command-completion-p)
171
172;;;###tramp-autoload 166;;;###tramp-autoload
173(defvar tramp-cleanup-all-connections-hook nil 167(defvar tramp-cleanup-all-connections-hook nil
174 "List of functions to be called after all Tramp connections are cleaned up.") 168 "List of functions to be called after all Tramp connections are cleaned up.")
@@ -521,7 +515,7 @@ Interactively, TARGET is selected from `tramp-default-rename-alist'
521without confirmation if the prefix argument is non-nil. 515without confirmation if the prefix argument is non-nil.
522 516
523For details, see `tramp-rename-files'." 517For details, see `tramp-rename-files'."
524 ;; (declare (completion tramp-command-completion-p)) 518 (declare (completion tramp-command-completion-p))
525 (interactive 519 (interactive
526 (let ((source default-directory) 520 (let ((source default-directory)
527 target 521 target
@@ -552,11 +546,6 @@ For details, see `tramp-rename-files'."
552 546
553 (tramp-rename-files default-directory target)) 547 (tramp-rename-files default-directory target))
554 548
555;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form.
556;;;###tramp-autoload
557(function-put
558 #'tramp-rename-these-files 'completion-predicate #'tramp-command-completion-p)
559
560;;; Run as sudo 549;;; Run as sudo
561 550
562(defcustom tramp-file-name-with-method "sudo" 551(defcustom tramp-file-name-with-method "sudo"
@@ -625,9 +614,8 @@ If the buffer runs `dired', the buffer is reverted."
625 614
626;;; Recompile on ELPA 615;;; Recompile on ELPA
627 616
628;; This function takes action since Emacs 28.1, when 617;; This function takes action, when `read-extended-command-predicate'
629;; `read-extended-command-predicate' is set to 618;; is set to `command-completion-default-include-p'.
630;; `command-completion-default-include-p'.
631;;;###tramp-autoload 619;;;###tramp-autoload
632(defun tramp-recompile-elpa-command-completion-p (_symbol _buffer) 620(defun tramp-recompile-elpa-command-completion-p (_symbol _buffer)
633 "A predicate for `tramp-recompile-elpa'. 621 "A predicate for `tramp-recompile-elpa'.
@@ -642,7 +630,7 @@ Tramp is an installed ELPA package."
642(defun tramp-recompile-elpa () 630(defun tramp-recompile-elpa ()
643 "Recompile the installed Tramp ELPA package. 631 "Recompile the installed Tramp ELPA package.
644This is needed if there are compatibility problems." 632This is needed if there are compatibility problems."
645 ;; (declare (completion tramp-recompile-elpa-command-completion-p)) 633 (declare (completion tramp-recompile-elpa-command-completion-p))
646 (interactive) 634 (interactive)
647 ;; We expect just one Tramp package is installed. 635 ;; We expect just one Tramp package is installed.
648 (when-let 636 (when-let
@@ -662,12 +650,6 @@ This is needed if there are compatibility problems."
662 "--eval" (format "(byte-recompile-directory %S 0 t)" dir)) 650 "--eval" (format "(byte-recompile-directory %S 0 t)" dir))
663 (message "Package `tramp' recompiled."))))) 651 (message "Package `tramp' recompiled.")))))
664 652
665;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form.
666;;;###tramp-autoload
667(function-put
668 #'tramp-recompile-elpa 'completion-predicate
669 #'tramp-recompile-elpa-command-completion-p)
670
671;; Tramp version is useful in a number of situations. 653;; Tramp version is useful in a number of situations.
672 654
673;;;###tramp-autoload 655;;;###tramp-autoload
diff --git a/lisp/net/tramp-container.el b/lisp/net/tramp-container.el
index 27bad70753c..57c34a1b8e4 100644
--- a/lisp/net/tramp-container.el
+++ b/lisp/net/tramp-container.el
@@ -339,27 +339,26 @@ see its function help for a description of the format."
339;;;###tramp-autoload 339;;;###tramp-autoload
340(defun tramp-kubernetes--container (vec) 340(defun tramp-kubernetes--container (vec)
341 "Extract the container name from a kubernetes host name in VEC." 341 "Extract the container name from a kubernetes host name in VEC."
342 (or (let ((host (tramp-file-name-host vec))) 342 (or (when-let ((host (and vec (tramp-file-name-host vec)))
343 (and (string-match tramp-kubernetes--host-name-regexp host) 343 ((string-match tramp-kubernetes--host-name-regexp host)))
344 (match-string 1 host))) 344 (match-string 1 host))
345 "")) 345 ""))
346 346
347;;;###tramp-autoload 347;;;###tramp-autoload
348(defun tramp-kubernetes--pod (vec) 348(defun tramp-kubernetes--pod (vec)
349 "Extract the pod name from a kubernetes host name in VEC." 349 "Extract the pod name from a kubernetes host name in VEC."
350 (or (let ((host (tramp-file-name-host vec))) 350 (or (when-let ((host (and vec (tramp-file-name-host vec)))
351 (and (string-match tramp-kubernetes--host-name-regexp host) 351 ((string-match tramp-kubernetes--host-name-regexp host)))
352 (match-string 2 host))) 352 (match-string 2 host))
353 "")) 353 ""))
354 354
355;;;###tramp-autoload 355;;;###tramp-autoload
356(defun tramp-kubernetes--namespace (vec) 356(defun tramp-kubernetes--namespace (vec)
357 "Extract the namespace from a kubernetes host name in VEC. 357 "Extract the namespace from a kubernetes host name in VEC.
358Use `tramp-kubernetes-namespace' otherwise." 358Use `tramp-kubernetes-namespace' otherwise."
359 (or (when-let ((_ vec) 359 (or (when-let ((host (and vec (tramp-file-name-host vec)))
360 (host (tramp-file-name-host vec))) 360 ((string-match tramp-kubernetes--host-name-regexp host)))
361 (and (string-match tramp-kubernetes--host-name-regexp host) 361 (match-string 3 host))
362 (match-string 3 host)))
363 tramp-kubernetes-namespace)) 362 tramp-kubernetes-namespace))
364 363
365;; We must change `vec' and `default-directory' to the previous hop, 364;; We must change `vec' and `default-directory' to the previous hop,
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index e9d9eb2a2c2..2bcdfb061d7 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -112,9 +112,8 @@ initializing a new encrypted remote directory."
112 "Non-nil when encryption support is available.") 112 "Non-nil when encryption support is available.")
113(setq tramp-crypt-enabled (executable-find tramp-crypt-encfs-program)) 113(setq tramp-crypt-enabled (executable-find tramp-crypt-encfs-program))
114 114
115;; This function takes action since Emacs 28.1, when 115;; This function takes action, when `read-extended-command-predicate'
116;; `read-extended-command-predicate' is set to 116;; is set to `command-completion-default-include-p'.
117;; `command-completion-default-include-p'.
118(defun tramp-crypt-command-completion-p (symbol _buffer) 117(defun tramp-crypt-command-completion-p (symbol _buffer)
119 "A predicate for Tramp interactive commands. 118 "A predicate for Tramp interactive commands.
120They are completed by `M-x TAB' only when encryption support is enabled." 119They are completed by `M-x TAB' only when encryption support is enabled."
@@ -522,7 +521,7 @@ directory. File names will be also encrypted."
522 "Unmark expanded remote directory NAME for encryption. 521 "Unmark expanded remote directory NAME for encryption.
523Existing files in that directory and its subdirectories will be 522Existing files in that directory and its subdirectories will be
524kept in their encrypted form." 523kept in their encrypted form."
525 ;; (declare (completion tramp-crypt-command-completion-p)) 524 (declare (completion tramp-crypt-command-completion-p))
526 (interactive "DRemote directory name: ") 525 (interactive "DRemote directory name: ")
527 (unless tramp-crypt-enabled 526 (unless tramp-crypt-enabled
528 (tramp-user-error nil "Feature is not enabled")) 527 (tramp-user-error nil "Feature is not enabled"))
@@ -536,11 +535,6 @@ kept in their encrypted form."
536 (setq tramp-crypt-directories (delete name tramp-crypt-directories)) 535 (setq tramp-crypt-directories (delete name tramp-crypt-directories))
537 (tramp-register-file-name-handlers))) 536 (tramp-register-file-name-handlers)))
538 537
539;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form.
540(function-put
541 #'tramp-crypt-remove-directory 'completion-predicate
542 #'tramp-crypt-command-completion-p)
543
544;; `auth-source' requires a user. 538;; `auth-source' requires a user.
545(defun tramp-crypt-dissect-file-name (name) 539(defun tramp-crypt-dissect-file-name (name)
546 "Return a `tramp-file-name' structure for NAME. 540 "Return a `tramp-file-name' structure for NAME.
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 1f61c5fdd36..6e331396d01 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -108,6 +108,7 @@
108(require 'url-util) 108(require 'url-util)
109 109
110;; Pacify byte-compiler. 110;; Pacify byte-compiler.
111(declare-function file-notify-callback "filenotify")
111(declare-function zeroconf-init "zeroconf") 112(declare-function zeroconf-init "zeroconf")
112(declare-function zeroconf-list-service-types "zeroconf") 113(declare-function zeroconf-list-service-types "zeroconf")
113(declare-function zeroconf-list-services "zeroconf") 114(declare-function zeroconf-list-services "zeroconf")
@@ -1571,8 +1572,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
1571 ;; `unread-command-events' does not accept several events at 1572 ;; `unread-command-events' does not accept several events at
1572 ;; once. Therefore, we apply the callback directly. 1573 ;; once. Therefore, we apply the callback directly.
1573 (when (member action events) 1574 (when (member action events)
1574 (tramp-compat-funcall 1575 (file-notify-callback (list proc action file file1)))))
1575 'file-notify-callback (list proc action file file1)))))
1576 1576
1577 ;; Save rest of the string. 1577 ;; Save rest of the string.
1578 (when (string-empty-p string) (setq string nil)) 1578 (when (string-empty-p string) (setq string nil))
diff --git a/lisp/net/tramp-message.el b/lisp/net/tramp-message.el
index 5e1c9904aa7..901ccc49ad0 100644
--- a/lisp/net/tramp-message.el
+++ b/lisp/net/tramp-message.el
@@ -124,9 +124,8 @@ The outline level is equal to the verbosity of the Tramp message."
124 (declare (tramp-suppress-trace t)) 124 (declare (tramp-suppress-trace t))
125 (1+ (string-to-number (match-string 3)))) 125 (1+ (string-to-number (match-string 3))))
126 126
127;; This function takes action since Emacs 28.1, when 127;; This function takes action, when `read-extended-command-predicate'
128;; `read-extended-command-predicate' is set to 128;; is set to `command-completion-default-include-p'.
129;; `command-completion-default-include-p'.
130(defun tramp-debug-buffer-command-completion-p (_symbol buffer) 129(defun tramp-debug-buffer-command-completion-p (_symbol buffer)
131 "A predicate for Tramp interactive commands. 130 "A predicate for Tramp interactive commands.
132They are completed by `M-x TAB' only in Tramp debug buffers." 131They are completed by `M-x TAB' only in Tramp debug buffers."
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index b011b7ca3d4..e4e14912579 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -38,9 +38,6 @@
38(declare-function dired-compress-file "dired-aux") 38(declare-function dired-compress-file "dired-aux")
39(declare-function dired-remove-file "dired-aux") 39(declare-function dired-remove-file "dired-aux")
40(defvar dired-compress-file-suffixes) 40(defvar dired-compress-file-suffixes)
41;; Added in Emacs 28.1.
42(defvar process-file-return-signal-string)
43(defvar vc-handled-backends)
44(defvar vc-bzr-program) 41(defvar vc-bzr-program)
45(defvar vc-git-program) 42(defvar vc-git-program)
46(defvar vc-hg-program) 43(defvar vc-hg-program)
@@ -2026,8 +2023,7 @@ ID-FORMAT valid values are `string' and `integer'."
2026 (unless (file-exists-p dirname) 2023 (unless (file-exists-p dirname)
2027 (tramp-error v 'file-missing dirname)) 2024 (tramp-error v 'file-missing dirname))
2028 2025
2029 ;; `copy-directory-create-symlink' exists since Emacs 28.1. 2026 (if (and copy-directory-create-symlink
2030 (if (and (bound-and-true-p copy-directory-create-symlink)
2031 (setq target (file-symlink-p dirname)) 2027 (setq target (file-symlink-p dirname))
2032 (tramp-equal-remote dirname newname)) 2028 (tramp-equal-remote dirname newname))
2033 (make-symbolic-link 2029 (make-symbolic-link
@@ -3288,9 +3284,8 @@ will be used."
3288 (kill-buffer (tramp-get-connection-buffer v)) 3284 (kill-buffer (tramp-get-connection-buffer v))
3289 (setq ret 1))) 3285 (setq ret 1)))
3290 3286
3291 ;; Handle signals. `process-file-return-signal-string' exists 3287 ;; Handle signals.
3292 ;; since Emacs 28.1. 3288 (when (and process-file-return-signal-string
3293 (when (and (bound-and-true-p process-file-return-signal-string)
3294 (natnump ret) (>= ret 128)) 3289 (natnump ret) (>= ret 128))
3295 (setq ret (nth (- ret 128) (tramp-sh-get-signal-strings v))))))) 3290 (setq ret (nth (- ret 128) (tramp-sh-get-signal-strings v)))))))
3296 3291
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 1f4ee8bc8e5..da62773ccc6 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -431,8 +431,7 @@ arguments to pass to the OPERATION."
431 (unless (file-exists-p dirname) 431 (unless (file-exists-p dirname)
432 (tramp-error v 'file-missing dirname)) 432 (tramp-error v 'file-missing dirname))
433 433
434 ;; `copy-directory-create-symlink' exists since Emacs 28.1. 434 (if (and copy-directory-create-symlink
435 (if (and (bound-and-true-p copy-directory-create-symlink)
436 (setq target (file-symlink-p dirname)) 435 (setq target (file-symlink-p dirname))
437 (tramp-equal-remote dirname newname)) 436 (tramp-equal-remote dirname newname))
438 (make-symbolic-link 437 (make-symbolic-link
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 3260cf5daac..5d6ab3991df 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2335,26 +2335,22 @@ Must be handled by the callers."
2335 ((member operation 2335 ((member operation
2336 '(access-file byte-compiler-base-file-name delete-directory 2336 '(access-file byte-compiler-base-file-name delete-directory
2337 delete-file diff-latest-backup-file directory-file-name 2337 delete-file diff-latest-backup-file directory-file-name
2338 directory-files directory-files-and-attributes 2338 directory-files directory-files-and-attributes dired-compress-file
2339 dired-compress-file dired-uncache file-acl 2339 dired-uncache file-acl file-accessible-directory-p file-attributes
2340 file-accessible-directory-p file-attributes 2340 file-directory-p file-executable-p file-exists-p file-local-copy
2341 file-directory-p file-executable-p file-exists-p 2341 file-locked-p file-modes file-name-as-directory
2342 file-local-copy file-modes file-name-as-directory
2343 file-name-case-insensitive-p file-name-directory 2342 file-name-case-insensitive-p file-name-directory
2344 file-name-nondirectory file-name-sans-versions 2343 file-name-nondirectory file-name-sans-versions
2345 file-notify-add-watch file-ownership-preserved-p 2344 file-notify-add-watch file-ownership-preserved-p file-readable-p
2346 file-readable-p file-regular-p file-remote-p 2345 file-regular-p file-remote-p file-selinux-context file-symlink-p
2347 file-selinux-context file-symlink-p file-system-info 2346 file-system-info file-truename file-writable-p
2348 file-truename file-writable-p find-backup-file-name 2347 find-backup-file-name get-file-buffer
2349 get-file-buffer insert-directory insert-file-contents 2348 insert-directory insert-file-contents load lock-file make-directory
2350 load make-directory set-file-acl set-file-modes 2349 make-lock-file-name set-file-acl set-file-modes
2351 set-file-selinux-context set-file-times 2350 set-file-selinux-context set-file-times substitute-in-file-name
2352 substitute-in-file-name unhandled-file-name-directory 2351 unhandled-file-name-directory unlock-file vc-registered
2353 vc-registered
2354 ;; Emacs 28- only. 2352 ;; Emacs 28- only.
2355 make-directory-internal 2353 make-directory-internal
2356 ;; Emacs 28+ only.
2357 file-locked-p lock-file make-lock-file-name unlock-file
2358 ;; Emacs 29+ only. 2354 ;; Emacs 29+ only.
2359 abbreviate-file-name 2355 abbreviate-file-name
2360 ;; Tramp internal magic file name function. 2356 ;; Tramp internal magic file name function.
@@ -2699,9 +2695,8 @@ Run BODY."
2699 2695
2700;;; File name handler functions for completion mode: 2696;;; File name handler functions for completion mode:
2701 2697
2702;; This function takes action since Emacs 28.1, when 2698;; This function takes action, when `read-extended-command-predicate'
2703;; `read-extended-command-predicate' is set to 2699;; is set to `command-completion-default-include-p'.
2704;; `command-completion-default-include-p'.
2705(defun tramp-command-completion-p (_symbol buffer) 2700(defun tramp-command-completion-p (_symbol buffer)
2706 "A predicate for Tramp interactive commands. 2701 "A predicate for Tramp interactive commands.
2707They are completed by `M-x TAB' only if the current buffer is remote." 2702They are completed by `M-x TAB' only if the current buffer is remote."
@@ -3823,8 +3818,7 @@ BODY is the backend specific code."
3823 (tramp-tramp-file-p lockname) 3818 (tramp-tramp-file-p lockname)
3824 (not file-locked)) 3819 (not file-locked))
3825 (setq file-locked t) 3820 (setq file-locked t)
3826 ;; `lock-file' exists since Emacs 28.1. 3821 (lock-file lockname))
3827 (tramp-compat-funcall 'lock-file lockname))
3828 3822
3829 ;; The body. 3823 ;; The body.
3830 ,@body 3824 ,@body
@@ -3862,8 +3856,7 @@ BODY is the backend specific code."
3862 3856
3863 ;; Unlock file. 3857 ;; Unlock file.
3864 (when file-locked 3858 (when file-locked
3865 ;; `unlock-file' exists since Emacs 28.1. 3859 (unlock-file lockname))
3866 (tramp-compat-funcall 'unlock-file lockname))
3867 3860
3868 ;; Sanity check. 3861 ;; Sanity check.
3869 (unless (equal curbuf (current-buffer)) 3862 (unless (equal curbuf (current-buffer))
@@ -4825,8 +4818,7 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.")
4825(defun tramp-handle-make-lock-file-name (file) 4818(defun tramp-handle-make-lock-file-name (file)
4826 "Like `make-lock-file-name' for Tramp files." 4819 "Like `make-lock-file-name' for Tramp files."
4827 (and create-lockfiles 4820 (and create-lockfiles
4828 ;; This variable has been introduced with Emacs 28.1. 4821 (not remote-file-name-inhibit-locks)
4829 (not (bound-and-true-p remote-file-name-inhibit-locks))
4830 (tramp-run-real-handler 'make-lock-file-name (list file)))) 4822 (tramp-run-real-handler 'make-lock-file-name (list file))))
4831 4823
4832(defun tramp-handle-unlock-file (file) 4824(defun tramp-handle-unlock-file (file)
@@ -4844,12 +4836,10 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.")
4844 (unless (or (not create-lockfiles) 4836 (unless (or (not create-lockfiles)
4845 (bound-and-true-p remote-file-name-inhibit-locks)) 4837 (bound-and-true-p remote-file-name-inhibit-locks))
4846 (signal 'file-error `("Cannot remove lock file for" ,file)))) 4838 (signal 'file-error `("Cannot remove lock file for" ,file))))
4847 ;; `userlock--handle-unlock-error' exists since Emacs 28.1. It 4839 ;; `userlock--handle-unlock-error' checks for `create-lockfiles'
4848 ;; checks for `create-lockfiles' since Emacs 30.1, we don't need 4840 ;; since Emacs 30.1, we don't need this check here, then.
4849 ;; this check here, then. 4841 (error (unless (or (not create-lockfiles) remote-file-name-inhibit-locks)
4850 (error (unless (or (not create-lockfiles) 4842 (userlock--handle-unlock-error err)))))
4851 (bound-and-true-p remote-file-name-inhibit-locks))
4852 (tramp-compat-funcall 'userlock--handle-unlock-error err)))))
4853 4843
4854(defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) 4844(defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
4855 "Like `load' for Tramp files." 4845 "Like `load' for Tramp files."
@@ -5312,12 +5302,9 @@ support symbolic links."
5312 (setq current-buffer-p t) 5302 (setq current-buffer-p t)
5313 (current-buffer)) 5303 (current-buffer))
5314 (t (get-buffer-create 5304 (t (get-buffer-create
5315 ;; These variables have been introduced with Emacs 28.1.
5316 (if asynchronous 5305 (if asynchronous
5317 (or (bound-and-true-p shell-command-buffer-name-async) 5306 (or shell-command-buffer-name-async "*Async Shell Command*")
5318 "*Async Shell Command*") 5307 (or shell-command-buffer-name "*Shell Command Output*"))))))
5319 (or (bound-and-true-p shell-command-buffer-name)
5320 "*Shell Command Output*"))))))
5321 (error-buffer 5308 (error-buffer
5322 (cond 5309 (cond
5323 ((bufferp error-buffer) error-buffer) 5310 ((bufferp error-buffer) error-buffer)
@@ -6849,10 +6836,6 @@ Consults the auth-source package."
6849 (lambda () (password-cache-add key auth-passwd))) 6836 (lambda () (password-cache-add key auth-passwd)))
6850 auth-passwd)) 6837 auth-passwd))
6851 6838
6852 ;; Workaround. Prior Emacs 28.1, auth-source has saved empty
6853 ;; passwords. See discussion in Bug#50399.
6854 (when (tramp-string-empty-or-nil-p auth-passwd)
6855 (setq tramp-password-save-function nil))
6856 (tramp-set-connection-property vec "first-password-request" nil)))) 6839 (tramp-set-connection-property vec "first-password-request" nil))))
6857 6840
6858(defun tramp-read-passwd-without-cache (proc &optional prompt) 6841(defun tramp-read-passwd-without-cache (proc &optional prompt)