[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/wfnames 0cf41398c2 05/98: Fix after-change-function
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/wfnames 0cf41398c2 05/98: Fix after-change-function |
Date: |
Tue, 8 Aug 2023 04:01:11 -0400 (EDT) |
branch: elpa/wfnames
commit 0cf41398c2cd49ed85a17d281335dc87fcd27528
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Fix after-change-function
---
helm-edit-marked.el | 56 +++++++++++++++++++++++++++--------------------------
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/helm-edit-marked.el b/helm-edit-marked.el
index 070c9edee5..8959129edd 100644
--- a/helm-edit-marked.el
+++ b/helm-edit-marked.el
@@ -1,4 +1,4 @@
-;;; Edit marked files
+;;; helm-edit-marked.el -- Edit marked files.
;;
(defvar helm-ff-edit-buffer "*edit hff marked*")
(defvar helm-ff--edit-marked-old-files nil)
@@ -20,22 +20,31 @@ Special commands:
(defun helm-ff-edit-marked-after-change-hook (beg end _leng-before)
(with-current-buffer helm-ff-edit-buffer
- (let ((old (get-text-property (point-at-bol) 'old-name))
- (new (buffer-substring-no-properties
- (point-at-bol) (point-at-eol)))
- ov)
- (cl-loop for o in (overlays-in (point-at-bol) (point-at-eol))
- when (overlay-get o 'hff-changed)
- do (delete-overlay o))
- (unless (string= old new)
- (setq ov (make-overlay (point-at-bol) (point-at-eol)))
- (overlay-put ov 'face
- `(:background ,(if (file-exists-p new)
+ (save-excursion
+ (save-match-data
+ (goto-char beg)
+ (let* ((bol (point-at-bol))
+ (eol (point-at-eol))
+ (old (get-text-property bol 'old-name))
+ (new (buffer-substring-no-properties bol eol))
+ ov face)
+ (setq face `(:background ,(if (file-exists-p new)
"DarkOrange" "LightBlue")))
- (overlay-put ov 'hff-changed t)
- (setq ov (make-overlay beg end))
- (overlay-put ov 'face 'font-lock-variable-name-face)
- (overlay-put ov 'hff-changed t)))))
+ (cl-loop for o in (overlays-in bol eol)
+ when (overlay-get o 'hff-changed)
+ return (setq ov o))
+ (cond ((string= old new)
+ (cl-loop for o in (overlays-in bol eol)
+ when (overlay-get o 'hff-changed)
+ do (delete-overlay o)))
+ (ov
+ (move-overlay ov bol eol)
+ (overlay-put ov 'face face))
+ (t (setq ov (make-overlay bol eol))
+ (overlay-put ov 'face face)
+ (overlay-put ov 'hff-changed t)
+ (overlay-put ov 'priority 0)
+ (overlay-put ov 'evaporate t))))))))
(defun helm-ff-edit-marked-files (_candidate)
(let ((marked (helm-marked-candidates :with-wildcard t)))
@@ -49,17 +58,6 @@ Special commands:
(set (make-local-variable 'helm-ff--edit-marked-old-files) marked))
(switch-to-buffer helm-ff-edit-buffer)))
-;; /home/thierry/tmp/test001.txt
-;; /home/thierry/tmp/test002.txt
-;; /home/thierry/tmp/test003.txt
-;; /home/thierry/tmp/test004.txt
-;; /home/thierry/tmp/test005.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
@@ -114,3 +112,7 @@ Special commands:
(insert (propertize
old 'old-name old 'face 'helm-ff-file)))
(forward-line 1))))))
+
+(provide 'helm-edit-marked)
+
+;;; helm-edit-marked.el ends here
- [nongnu] elpa/wfnames 6899da10b2 75/98: Modify revert binding, (continued)
- [nongnu] elpa/wfnames 6899da10b2 75/98: Modify revert binding, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 8d267316e8 83/98: Minor fixes in headers and keep requiring cl-lib as always, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 14cd7e7108 87/98: Ensure we have not an empty line at point, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames db1f17a5dd 92/98: Require emacs-24.4 for delete-duplicate-lines, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 3a12c46be1 64/98: Comments only, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames c761a398ab 65/98: Add a minimal capf, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 0064a2b8e4 82/98: Fix errors according to package-lint, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames c7e895f406 86/98: Allow reverting changes line by line, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 4447417c58 88/98: Bump to 1.1, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 810a606075 04/98: Use a different face when file would be overwrited, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 0cf41398c2 05/98: Fix after-change-function,
ELPA Syncer <=
- [nongnu] elpa/wfnames 120c08652a 15/98: Revert "Remove unused variable", ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 1219dca135 14/98: Bind beg and end to avoid repeating, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 75bae40bf4 17/98: Add comments, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames ca6e126e15 49/98: Change commit buffer default binding, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 6d661e78a2 68/98: Erase buffer, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 14e9d0204d 66/98: New user var to decide what to to with buffer when done, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 4ccea88ae1 93/98: Prefer defcustom over defvar, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 1f7513b8d1 95/98: Only stylistic changes, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames 25baac1a2e 22/98: Skip rename when saying no in interactive rename, ELPA Syncer, 2023/08/08
- [nongnu] elpa/wfnames d7ff78a1ec 31/98: Add COPYING, ELPA Syncer, 2023/08/08