[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/wfnames 056e032d18 60/98: Save all overwrites in an alist
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/wfnames 056e032d18 60/98: Save all overwrites in an alist |
Date: |
Tue, 8 Aug 2023 04:01:34 -0400 (EDT) |
branch: elpa/wfnames
commit 056e032d18849fd9f616129448474a8c769fa908
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Save all overwrites in an alist
and don't modify it to always been able to get the association.
---
wfnames.el | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/wfnames.el b/wfnames.el
index 3fa7c7e001..9873a50223 100644
--- a/wfnames.el
+++ b/wfnames.el
@@ -148,7 +148,7 @@ Special commands:
(defun wfnames-commit-buffer ()
(interactive)
- (let ((renamed 0) (skipped 0) delayed)
+ (let ((renamed 0) (skipped 0) delayed overwrites)
(cl-labels ((commit ()
(with-current-buffer wfnames-buffer
(goto-char (point-min))
@@ -169,11 +169,12 @@ Special commands:
;; new is one of the old
;; files about to be modified.
(member new wfnames--modified)
- (not (assoc new delayed)))
+ (not (member new delayed)))
;; Maybe ask.
(if (wfnames-ask-for-overwrite new)
(let ((tmpfile (make-temp-name new)))
- (push (cons new tmpfile) delayed)
+ (push (cons new tmpfile) overwrites)
+ (push new delayed)
(rename-file new tmpfile))
;; Answer is no, skip.
(add-text-properties
@@ -182,27 +183,25 @@ Special commands:
;; Now really rename files.
(t
(when (and (file-exists-p new)
- (not (assoc new delayed)))
+ (not (member new delayed)))
(setq ow t))
(when wfnames-create-parent-directories
;; Check if base directory of new exists.
(let ((basedir (file-name-directory
- (directory-file-name
new))))
+ (directory-file-name new))))
(unless (file-directory-p basedir)
(mkdir basedir 'parents))))
(if (and ow (wfnames-ask-for-overwrite new))
- (rename-file
- ;; Use old temp file if it
- ;; exists [1].
- (or (assoc-default old delayed) old)
- new ow)
+ (rename-file old new 'overwrite)
;; 'No' answered.
(and ow (cl-incf skipped))
;; Not an overwrite, do normal renaming.
- (and (null ow) (rename-file old new)))
+ (and (null ow)
+ (rename-file
+ (or (assoc-default old overwrites)
old)
+ new)))
(add-text-properties beg end `(old-name ,new))
- (setq delayed
- (delete (assoc new delayed) delayed))
+ (setq delayed (delete new delayed))
(cl-incf renamed))))
(forward-line 1)))
(when delayed (commit)))))
- [nongnu] elpa/wfnames 924319f51a 23/98: Fixup comments, (continued)
- [nongnu] elpa/wfnames 924319f51a 23/98: Fixup comments, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 8e34c7bb75 18/98: Reindent, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 73104c1cbd 29/98: Fix group and use someting else than helm-basedir, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 2e9f34d939 20/98: Handle directories rename, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames d034d09e6d 36/98: Restore props after changes made by something else than self-insert-command, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 810aea61db 38/98: Long lines only, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames ac577774ef 40/98: Revert "Handle backup overwrite", ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames f510d716b6 43/98: Fix interactive rename, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 221ac4691f 52/98: Add face to prefix filenames in wfnames buffer, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 860512b33c 58/98: Merge branch 'devel' into main, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 056e032d18 60/98: Save all overwrites in an alist,
ELPA Syncer <=
- [nongnu] elpa/wfnames d58dbf06c3 67/98: Add wfnames-make-backup, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 53813526b1 62/98: Bind C-x C-s, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames fefd46c97e 74/98: Fix headers, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 59a61c5725 80/98: Update README, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 7202294447 85/98: Allow appending to existing wfnames-buffer, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 7b50001525 89/98: Shutup warnings with point-at-bol/eol, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 900da88db7 91/98: Use defconst for buffer name and prefer defvar-local, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 9c99e94560 10/98: Fix paren error, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames a0d1f99760 02/98: Fix overwriting, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames baee8ebfc0 03/98: Use delayed instead of suspended which is more meaningful, ELPA Syncer, 2023/08/08