[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ad6ad16: Use `auto-save-file-name-p' in tramp-*-write-region
From: |
Michael Albinus |
Subject: |
master ad6ad16: Use `auto-save-file-name-p' in tramp-*-write-region |
Date: |
Sun, 11 Jul 2021 11:41:41 -0400 (EDT) |
branch: master
commit ad6ad1646d7b3e9fac8198dc734d500ae0d40d78
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Use `auto-save-file-name-p' in tramp-*-write-region
* lisp/net/tramp.el (tramp-handle-write-region):
* lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
* lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
* lisp/net/tramp-smb.el (tramp-smb-handle-write-region):
* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-write-region):
Use `auto-save-file-name-p'.
---
lisp/net/tramp-adb.el | 11 +++++------
lisp/net/tramp-sh.el | 19 +++++++------------
lisp/net/tramp-smb.el | 7 +++----
lisp/net/tramp-sshfs.el | 7 +++----
lisp/net/tramp.el | 7 +++----
5 files changed, 21 insertions(+), 30 deletions(-)
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 788548b..63fd5eb 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -549,14 +549,13 @@ But handle the case, if the \"test\" command is not
available."
(format "File %s exists; overwrite anyway? " filename)))))
(tramp-error v 'file-already-exists filename))
- (let* ((auto-saving
- (string-match-p "^#.+#$" (file-name-nondirectory filename)))
- file-locked
- (curbuf (current-buffer))
- (tmpfile (tramp-compat-make-temp-file filename)))
+ (let (file-locked
+ (curbuf (current-buffer))
+ (tmpfile (tramp-compat-make-temp-file filename)))
;; Lock file.
- (when (and (not auto-saving) (file-remote-p lockname)
+ (when (and (not (auto-save-file-name-p (file-name-nondirectory
filename)))
+ (file-remote-p lockname)
(not (eq (file-locked-p lockname) t)))
(setq file-locked t)
;; `lock-file' exists since Emacs 28.1.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 404e9af..e5929bd 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3249,9 +3249,7 @@ implementation will be used."
(format "File %s exists; overwrite anyway? " filename)))))
(tramp-error v 'file-already-exists filename))
- (let ((auto-saving
- (string-match-p "^#.+#$" (file-name-nondirectory filename)))
- file-locked
+ (let (file-locked
(uid (or (tramp-compat-file-attribute-user-id
(file-attributes filename 'integer))
(tramp-get-remote-uid v 'integer)))
@@ -3260,7 +3258,8 @@ implementation will be used."
(tramp-get-remote-gid v 'integer))))
;; Lock file.
- (when (and (not auto-saving) (file-remote-p lockname)
+ (when (and (not (auto-save-file-name-p (file-name-nondirectory
filename)))
+ (file-remote-p lockname)
(not (eq (file-locked-p lockname) t)))
(setq file-locked t)
;; `lock-file' exists since Emacs 28.1.
@@ -3269,15 +3268,11 @@ implementation will be used."
(if (and (tramp-local-host-p v)
;; `file-writable-p' calls `file-expand-file-name'. We
;; cannot use `tramp-run-real-handler' therefore.
- (let (file-name-handler-alist)
- (and
- (file-writable-p (file-name-directory localname))
- (or (file-directory-p localname)
- (file-writable-p localname)))))
+ (file-writable-p (file-name-directory localname))
+ (or (file-directory-p localname)
+ (file-writable-p localname)))
;; Short track: if we are on the local host, we can run directly.
- (write-region
- start end localname append 'no-message
- (and lockname (file-local-name lockname)))
+ (write-region start end localname append 'no-message lockname)
(let* ((modes (tramp-default-file-modes
filename (and (eq mustbenew 'excl) 'nofollow)))
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 87f6239..d3de045 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1589,14 +1589,13 @@ errors for shares like \"C$/\", which are common in
Microsoft Windows."
(format "File %s exists; overwrite anyway? " filename)))))
(tramp-error v 'file-already-exists filename))
- (let ((auto-saving
- (string-match-p "^#.+#$" (file-name-nondirectory filename)))
- file-locked
+ (let (file-locked
(curbuf (current-buffer))
(tmpfile (tramp-compat-make-temp-file filename)))
;; Lock file.
- (when (and (not auto-saving) (file-remote-p lockname)
+ (when (and (not (auto-save-file-name-p (file-name-nondirectory
filename)))
+ (file-remote-p lockname)
(not (eq (file-locked-p lockname) t)))
(setq file-locked t)
;; `lock-file' exists since Emacs 28.1.
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index 3a3703b..f4872ce 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -295,12 +295,11 @@ arguments to pass to the OPERATION."
(format "File %s exists; overwrite anyway? " filename)))))
(tramp-error v 'file-already-exists filename))
- (let ((auto-saving
- (string-match-p "^#.+#$" (file-name-nondirectory filename)))
- file-locked)
+ (let (file-locked)
;; Lock file.
- (when (and (not auto-saving) (file-remote-p lockname)
+ (when (and (not (auto-save-file-name-p (file-name-nondirectory
filename)))
+ (file-remote-p lockname)
(not (eq (file-locked-p lockname) t)))
(setq file-locked t)
;; `lock-file' exists since Emacs 28.1.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index fc714c9..9e6bfce 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4438,9 +4438,7 @@ of."
(format "File %s exists; overwrite anyway? " filename)))))
(tramp-error v 'file-already-exists filename))
- (let ((auto-saving
- (string-match-p "^#.+#$" (file-name-nondirectory filename)))
- file-locked
+ (let (file-locked
(tmpfile (tramp-compat-make-temp-file filename))
(modes (tramp-default-file-modes
filename (and (eq mustbenew 'excl) 'nofollow)))
@@ -4452,7 +4450,8 @@ of."
(tramp-get-remote-gid v 'integer))))
;; Lock file.
- (when (and (not auto-saving) (file-remote-p lockname)
+ (when (and (not (auto-save-file-name-p (file-name-nondirectory
filename)))
+ (file-remote-p lockname)
(not (eq (file-locked-p lockname) t)))
(setq file-locked t)
;; `lock-file' exists since Emacs 28.1.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master ad6ad16: Use `auto-save-file-name-p' in tramp-*-write-region,
Michael Albinus <=