[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/wfnames a0d1f99760 02/98: Fix overwriting
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/wfnames a0d1f99760 02/98: Fix overwriting |
Date: |
Tue, 8 Aug 2023 04:01:11 -0400 (EDT) |
branch: elpa/wfnames
commit a0d1f997604909c09bb8801a748d178534a00f08
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Fix overwriting
---
helm-edit-marked.el | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/helm-edit-marked.el b/helm-edit-marked.el
index 5f625968db..bccaba181c 100644
--- a/helm-edit-marked.el
+++ b/helm-edit-marked.el
@@ -55,10 +55,16 @@ Special commands:
;; /home/thierry/tmp/test005.txt
-;; /home/thierry/tmp/test005.txt
-;; /home/thierry/tmp/test004.txt
-;; /home/thierry/tmp/test003.txt
-;; /home/thierry/tmp/test002.txt
+;; /home/thierry/tmp/test001.txt => /home/thierry/tmp/test005.txt
+;; /home/thierry/tmp/test002.txt => /home/thierry/tmp/test004.txt
+;; /home/thierry/tmp/test004.txt => /home/thierry/tmp/test002.txt
+
+(setq helm-find-files-actions
+ (helm-append-at-nth
+ helm-find-files-actions
+ '(("Edit marked files" . helm-ff-edit-marked-files)) 2))
+
+(setq helm-source-find-files nil)
(defun helm-ff-edit-marked-commit-buffer ()
(interactive)
@@ -71,12 +77,18 @@ Special commands:
(new (buffer-substring-no-properties
(point-at-bol) (point-at-eol))))
(unless (string= old new) ; not modified.
- (if (file-exists-p new)
- (push new suspended)
+ (if (and (file-exists-p new)
+ (not (assoc new suspended)))
+ (let ((tmpfile (make-temp-name new)))
+ (push (cons new tmpfile) suspended)
+ (rename-file new tmpfile)
+ (delete-region (point-at-bol) (point-at-eol))
+ (insert (propertize new 'old-name tmpfile)))
(rename-file old new)
(add-text-properties
(point-at-bol) (point-at-eol) `(old-name ,new))
- (setq suspended (delete new suspended))
+ (setq suspended
+ (delete (assoc new suspended) suspended))
(cl-incf renamed))))
(forward-line 1))
(when suspended (commit)))))
- [nongnu] elpa/wfnames 860512b33c 58/98: Merge branch 'devel' into main, (continued)
- [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, 2023/08/08
- [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 <=
- [nongnu] elpa/wfnames baee8ebfc0 03/98: Use delayed instead of suspended which is more meaningful, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 6b79eb9b16 11/98: Fix unused lex var end, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 756f1a2da0 06/98: Fix headers, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames d7a082a573 27/98: Add new file, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 8e549f1e6a 16/98: Fix the logic in commit fn, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames f5216cf10b 35/98: Fix forgotten add-text-properties call in overwriting clause, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames b4b0d280ef 42/98: Simplify commit fn, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames e2528615c4 47/98: Modify end message, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 2691695d28 53/98: Fix keymap typo, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames b6b416ef76 55/98: Comment only, ELPA Syncer, 2023/08/08