[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 17ce97381b 035/301: Clean up code
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 17ce97381b 035/301: Clean up code |
Date: |
Mon, 10 Jan 2022 22:58:48 -0500 (EST) |
branch: elpa/iedit
commit 17ce97381bfb1a0f7fe82f93ea7605fa25cfaa43
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Clean up code
---
iedit.el | 44 +++++++++-----------------------------------
1 file changed, 9 insertions(+), 35 deletions(-)
diff --git a/iedit.el b/iedit.el
index 87816ee58d..ac22fda5d5 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2012-01-27 17:26:28 Victor Ren>
+;; Time-stamp: <2012-01-27 23:07:31 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region replace simultaneous
;; Version: 0.91
@@ -149,13 +149,6 @@ only matches complete symbol.")
"This is buffer local variable which indicates the moving
forward or backward successful")
-(defvar iedit-before-modification-beg 0
- "This is buffer local variable which is the argment `end' of hook function
-before a change is made.")
-
-(defvar iedit-before-modification-end 0
- "This is buffer local variable which is the argment `end' of hook function
-before a change is made.")
(defvar iedit-before-modification-string ""
"This is buffer local variable which is the buffer substring that is going
to be changed.")
@@ -173,8 +166,6 @@ before a change is made.")
(make-variable-buffer-local 'iedit-case-sensitive)
(make-variable-buffer-local 'iedit-last-occurrence-in-history)
(make-variable-buffer-local 'iedit-forward-success)
-(make-variable-buffer-local 'iedit-before-modification-beg)
-(make-variable-buffer-local 'iedit-before-modification-end)
(make-variable-buffer-local 'iedit-before-modification-string)
(make-variable-buffer-local 'iedit-aborting)
@@ -411,10 +402,12 @@ iedit-occurrence-update is called for a removed overlay."
(defun iedit-done ()
"Exit iedit mode."
- (let ((ov (car iedit-occurrences-overlays)))
+ (let* ((ov (car iedit-occurrences-overlays))
+ (beg (overlay-start ov))
+ (end (overlay-end ov)))
(setq iedit-last-occurrence-in-history
- (if (and ov (not (eq (overlay-start ov) (overlay-end ov))))
- (let ((substring (buffer-substring-no-properties (overlay-start
ov) (overlay-end ov))))
+ (if (and ov (/= beg end))
+ (let ((substring (buffer-substring-no-properties beg end)))
(if iedit-current-occurrence-complete-symbol
(concat "\\_<" substring "\\_>")
substring))
@@ -466,10 +459,8 @@ exit iedti mode."
(> end (overlay-end occurrence)))
(progn (setq iedit-aborting t) ; abort iedit-mode
(add-hook 'post-command-hook 'iedit-reset-aborting nil t))
- (progn (setq iedit-before-modification-beg beg)
- (setq iedit-before-modification-end end)
- (setq iedit-before-modification-string
- (buffer-substring-no-properties beg end))))
+ (setq iedit-before-modification-string
+ (buffer-substring-no-properties beg end)))
;; after modification
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -509,7 +500,7 @@ exit iedti mode."
(unless (eq beg end) ;; replacement
(goto-char beginning)
(insert-and-inherit value))))))))))))
-;; (elp-instrument-list '(insert delete-region goto-char
iedit-occurrence-update buffer-substring-no-properties string=
re-search-forward replace-match))
+;; (elp-instrument-list '(insert-and-inherit delete-region goto-char
iedit-occurrence-update buffer-substring-no-properties string=
re-search-forward replace-match))
;; slowest verion:
;; (defun iedit-occurrence-update (occurrence after beg end &optional change)
@@ -554,23 +545,6 @@ exit iedti mode."
;; (goto-char (point-min))
;; (while (re-search-forward iedit-before-modification-string
(overlay-start occurrence) t)
;; (replace-match value nil nil)))))))
-;; occurrence and is responsible for updating all other
-;; occurrences."
-;; (when (and after
-;; (not undo-in-progress) ; undo will do all the work
-;; (not (< beg (overlay-start occurrence)))
-;; (not (eq occurrence iedit-last-overlay)))
-;; (setq iedit-last-overlay occurrence)
-;; (add-hook 'post-command-hook 'iedit-reset-last-overlay nil t)
-;; (let ((replacement-str (buffer-substring-no-properties beg end))
-;; (index (- beg (overlay-start occurrence)))
-;; (inhibit-modification-hooks t))
-;; (save-excursion
-;; (dolist (another-occurrence iedit-occurrences-overlays)
-;; (when (not (eq another-occurrence occurrence))
-;; (goto-char (+ index (overlay-start another-occurrence)))
-;; (delete-region (point) (+ (point) change))
-;; (insert replacement-str)))))))
(defun iedit-next-occurrence ()
"Move forward to the next occurrence in the `iedit'.
- [nongnu] elpa/iedit 7ed8e04557 021/301: Optmize iedit-hide-unmatched-lines, (continued)
- [nongnu] elpa/iedit 7ed8e04557 021/301: Optmize iedit-hide-unmatched-lines, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e6f558539e 025/301: fix org-mode text-property compatibility (use insert-and-inherit), ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 039c0e23ab 023/301: Postpone iedit-done after commands are excuted., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit c5a0d4de84 028/301: fix zero-width rectangle insertion, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 13ecba138a 026/301: Merge branch 'upstream-master', ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 1d070b7d36 029/301: move init code for iedit-mode-map inside defvar, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit a75c44645a 031/301: fix bug with autopair and iedit-rect, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 20c1075948 032/301: remove conditions on setting `iedit-before-modification-string'., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit c4091203ea 033/301: Merge pull request #3 from lewang/master, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit b81b9d6025 034/301: Clean code., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 17ce97381b 035/301: Clean up code,
ELPA Syncer <=
- [nongnu] elpa/iedit 9b3aaa8f21 037/301: Fix occurrence from history does not exist problem, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit b9ebb768b7 190/301: Merge pull request #60 from danrharms/issue-59-hotfix, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit f7b2d60989 167/301: Make occurrence string the latest kill in the kill ring, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit c25992ef7f 199/301: Fix doc strings, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 19f35aa1a0 172/301: Change the default key binding for `iedit-rectangle-mode' to c-x-r-ret, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 4864e17126 010/301: Merge remote-tracking branch 'tsdh/master', ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit fc71952cf9 014/301: Boolean `t', ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit df6c2ad919 017/301: fix search to use regexp-quote when needed, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 30971294b2 071/301: Remove a limitation of empty occurrence string, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit df9e958703 082/301: Add more short-cut to iedit on function, ELPA Syncer, 2022/01/10