emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/wfnames 75bae40bf4 17/98: Add comments


From: ELPA Syncer
Subject: [nongnu] elpa/wfnames 75bae40bf4 17/98: Add comments
Date: Tue, 8 Aug 2023 04:01:13 -0400 (EDT)

branch: elpa/wfnames
commit 75bae40bf424de2385dcd8a0cafd0d3e1845cf7b
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Add comments
---
 helm-edit-marked.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/helm-edit-marked.el b/helm-edit-marked.el
index 15c30fe084..f913cdc91c 100644
--- a/helm-edit-marked.el
+++ b/helm-edit-marked.el
@@ -82,7 +82,12 @@ Special commands:
                              (old (get-text-property (point) 'old-name))
                              (new (buffer-substring-no-properties beg end)))
                         (unless (string= old new) ; not modified.
-                          (cond ((and (file-exists-p new)
+                          (cond (;; New file exists and is one of the
+                                 ;; next files to rename, make a temp
+                                 ;; file of OLD and assign this temp
+                                 ;; file to OLD, then delay renaming
+                                 ;; to next turn.
+                                 (and (file-exists-p new)
                                       (member new
                                               helm-ff--edit-marked-old-files)
                                       (not (assoc new delayed)))
@@ -91,16 +96,23 @@ Special commands:
                                    (rename-file old tmpfile)
                                    (add-text-properties
                                     beg end `(old-name ,tmpfile))))
+                                ;; New file exists but is not part of
+                                ;; the next files to rename, make a
+                                ;; temp file of NEW and delay renaming
+                                ;; to next turn.
                                 ((and (file-exists-p new)
                                       (not (assoc new delayed)))
                                  (let ((tmpfile (make-temp-name new)))
                                    (push (cons new tmpfile) delayed)
                                    (rename-file new tmpfile)))
+                                ;; Now really rename files.
                                 (t
                                  (rename-file old new)
                                  (add-text-properties beg end `(old-name ,new))
                                  (let* ((assoc (assoc new delayed))
                                         (tmp   (cdr assoc)))
+                                   ;; The temp file was created in
+                                   ;; clause 2, delete it.
                                    (when (and tmp (file-exists-p tmp))
                                      (delete-file tmp))
                                    (setq delayed



reply via email to

[Prev in Thread] Current Thread [Next in Thread]