[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit e99e65fccb 044/301: Fix current point move problem w
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit e99e65fccb 044/301: Fix current point move problem when call iedit-replace-occurrences. |
Date: |
Mon, 10 Jan 2022 22:58:49 -0500 (EST) |
branch: elpa/iedit
commit e99e65fccb3a377623e6b019ac1469ced3cc5567
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Fix current point move problem when call iedit-replace-occurrences.
Replace funcall with "apply"
---
iedit.el | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/iedit.el b/iedit.el
index 3bf2ed174d..2bcecd7715 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2012-02-01 23:13:47 Victor Ren>
+;; Time-stamp: <2012-02-02 22:17:45 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region replace simultaneous
;; Version: 0.92
@@ -69,7 +69,7 @@
;; words, not inside words
;; Le Wang <l26wang@gmail.com> proposed to match only complete symbols,
not
-;; inside symbols, contributed iedit-rect mode
+;; inside symbols, contributed rectangle support
;;; Code:
@@ -645,7 +645,7 @@ the buffer."
(iedit-make-unmatched-lines-overlay (car unmatch) (cadr
unmatch)))))))
;;;; functions for overlay local-map
-(defun iedit-foreach-occurrence-call (function &optional string)
+(defun iedit-apply-on-occurrences (function &rest args)
"Call function for each occurrence."
(let* ((ov (car iedit-occurrences-overlays))
(beg (overlay-start ov))
@@ -653,35 +653,36 @@ the buffer."
(when (/= beg end)
(let ((inhibit-modification-hooks t))
(dolist (occurrence iedit-occurrences-overlays)
- (if string
- (funcall function (overlay-start occurrence) (overlay-end
occurrence) string)
- (funcall function (overlay-start occurrence) (overlay-end
occurrence))))))))
+ (apply function (overlay-start occurrence) (overlay-end occurrence)
args))))))
(defun iedit-upcase-occurrences ()
"Covert occurrences to upper case."
(interactive "*")
- (iedit-foreach-occurrence-call 'upcase-region))
+ (iedit-apply-on-occurrences 'upcase-region))
(defun iedit-downcase-occurrences()
"Covert occurrences to lower case."
(interactive "*")
- (iedit-foreach-occurrence-call 'downcase-region))
+ (iedit-apply-on-occurrences 'downcase-region))
(defun iedit-replace-occurrences(string)
"Replace occurrences with STRING."
- (interactive "sString: ")
- (iedit-foreach-occurrence-call
- (lambda (beg end string)
- (save-excursion
- (delete-region beg end)
- (goto-char beg)
- (insert-and-inherit string)))
- string))
+ (interactive "*sString: ")
+ (let* ((ov (iedit-find-current-occurrence-overlay))
+ (offset (- (point) (overlay-start ov))))
+ (iedit-apply-on-occurrences
+ (lambda (beg end string)
+ (save-excursion
+ (delete-region beg end)
+ (goto-char beg)
+ (insert-and-inherit string)))
+ string)
+ (goto-char (+ (overlay-start ov) offset))))
(defun iedit-clear-occurrences()
"Replace occurrences with blank spaces."
(interactive "*")
- (iedit-foreach-occurrence-call
+ (iedit-apply-on-occurrences
(lambda (beg end)
(save-excursion
(delete-region beg end)
@@ -691,7 +692,7 @@ the buffer."
(defun iedit-delete-occurrences()
"Delete occurrences."
(interactive "*")
- (iedit-foreach-occurrence-call 'delete-region))
+ (iedit-apply-on-occurrences 'delete-region))
(defun iedit-toggle-buffering ()
"Toggle buffering."
- [nongnu] elpa/iedit 011e8d354c 016/301: Performance optimization of iedit-occurrence-update, (continued)
- [nongnu] elpa/iedit 011e8d354c 016/301: Performance optimization of iedit-occurrence-update, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit c8dac6bee8 020/301: exit iedit mode when change is not inside of occurrence., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 768d89b60c 022/301: Merge remote-tracking branch 'lewang/master', ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 0edc86ff41 024/301: Fix the last occurrence problem when it is a complete symbol., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit dd7d2f95f8 027/301: fix org-mode text-property compatibility (use insert-and-inherit), ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit d5d4027a33 030/301: fix `iedit-toggle-unmatched-lines-visible' for rectangles, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 652087d63c 036/301: fix warning: the function `make-sparse-key-map' is not known to be, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit da47784c8d 038/301: Add iedit mode easy access keys, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit c53a885fe5 040/301: Add bufferring modification functionalities, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 9bc57d2a30 041/301: make iedit-skipped-modification-once buffer local, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e99e65fccb 044/301: Fix current point move problem when call iedit-replace-occurrences.,
ELPA Syncer <=
- [nongnu] elpa/iedit 4e31d50327 052/301: Add a prefix arg handling to iedit-toggle-unmatched-lines-visible, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 87053a3d44 054/301: Remove two buffer local variables for rectangle., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e568677fe4 056/301: Add new functionality: restrict iedit-mode in region, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit a9bda4db66 060/301: Refine hotkeys, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 4fa7342be9 065/301: Copy from iedit.el, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit b579dd0739 063/301: Update with new information, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit a13c4d6b56 067/301: Remove README, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 90ef2d5ac9 064/301: Add digit prefix argment 0 to enable restricting match in a function, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 697e24c337 073/301: remove a todo item: add ert test case, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 428be4e13e 078/301: Fix iedit-kill-rectangle problem, ELPA Syncer, 2022/01/10