emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/iedit 57beb10db5 141/301: Remove all the dependency to the


From: ELPA Syncer
Subject: [nongnu] elpa/iedit 57beb10db5 141/301: Remove all the dependency to the order of iedit-occurrences-overlays
Date: Mon, 10 Jan 2022 22:58:57 -0500 (EST)

branch: elpa/iedit
commit 57beb10db5b7913093bb435c2f36b719168f0530
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>

    Remove all the dependency to the order of iedit-occurrences-overlays
    Now iedit-ocurrences-overlays are no long sorted
---
 iedit-lib.el   | 27 +++++++++++----------------
 iedit-rect.el  | 15 +++++++++------
 iedit-tests.el |  3 +--
 3 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/iedit-lib.el b/iedit-lib.el
index 4e525cd06a..0b7d7b305c 100644
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -3,7 +3,7 @@
 
 ;; Copyright (C) 2010, 2011, 2012 Victor Ren
 
-;; Time-stamp: <2012-12-08 23:35:32 Victor Ren>
+;; Time-stamp: <2012-12-09 00:42:28 Victor Ren>
 ;; Author: Victor Ren <victorhge@gmail.com>
 ;; Keywords: occurrence region simultaneous rectangle refactoring
 ;; Version: 0.97
@@ -77,8 +77,7 @@ mode, set it as nil."
   "The occurrences slot contains a list of overlays used to
 indicate the position of each editable occurrence.  In addition, the
 occurrence overlay is used to provide a different face
-configurable via `iedit-occurrence'.  The list is sorted by
-the position of overlays.")             ;todo remove sort
+configurable via `iedit-occurrence'.")
 
 (defvar iedit-read-only-occurrences-overlays nil
   "The occurrences slot contains a list of overlays used to
@@ -216,8 +215,7 @@ Return the number of occurrences."
                   iedit-occurrences-overlays))
           (setq counter (1+ counter))))
       (message "%d matches for \"%s\"" counter (iedit-printable 
occurrence-regexp))
-      (when (/= 0 counter)              ;todo: remove nreverse
-        (setq iedit-occurrences-overlays (nreverse iedit-occurrences-overlays))
+      (when (/= 0 counter)
         (if iedit-unmatched-lines-invisible
             (iedit-hide-unmatched-lines iedit-occurrence-context-lines))))
     counter))
@@ -247,9 +245,6 @@ Return the number of occurrences."
         (push (iedit-make-occurrence-overlay (match-beginning 0)
                                              (match-end 0))
               iedit-occurrences-overlays)
-        (sort iedit-occurrences-overlays
-              (lambda (left right)
-                (< (overlay-start left) (overlay-start right))))
         (message "Add one match for \"%s\"" (iedit-printable occurrence-exp))
         (if iedit-unmatched-lines-invisible
             (iedit-hide-unmatched-lines iedit-occurrence-context-lines))))))
@@ -271,9 +266,7 @@ there are."
         (error "Conflict region."))
     (push (iedit-make-occurrence-overlay beg end)
           iedit-occurrences-overlays)
-    (sort iedit-occurrences-overlays
-          (lambda (left right)
-            (< (overlay-start left) (overlay-start right)))))) ;; todo test 
this function
+    )) ;; todo test this function
 
 (defun iedit-cleanup ()
   "Clean up occurrence overlay, invisible overlay and local variables."
@@ -710,12 +703,14 @@ FORMAT."
   (let ((iedit-number-occurrence-counter start-at)
         (inhibit-modification-hooks t))
     (save-excursion
-      (dolist (occurrence iedit-occurrences-overlays)
-        (goto-char (overlay-start occurrence))
+      (iedit-first-occurrence)
+      (while (/= (point) (point-max))
         (insert (format format-string iedit-number-occurrence-counter))
-        (iedit-move-conjoined-overlays occurrence)
+        (iedit-move-conjoined-overlays (iedit-find-current-occurrence-overlay))
         (setq iedit-number-occurrence-counter
-              (1+ iedit-number-occurrence-counter))))))
+              (1+ iedit-number-occurrence-counter))
+        (goto-char (next-single-char-property-change (point) 
'iedit-occurrence-overlay-name))
+        (goto-char (next-single-char-property-change (point) 
'iedit-occurrence-overlay-name))))))
 
 
 ;;; help functions
@@ -813,7 +808,7 @@ Return nil if occurrence string is empty string."
     (dolist (overlay iedit-occurrences-overlays)
       (if (overlay-buffer overlay)
           (push overlay overlays)))
-    (setq iedit-occurrences-overlays (nreverse overlays))))
+    (setq iedit-occurrences-overlays overlays)))
 
 (defun iedit-printable (string)
   "Return a omitted substring that is not longer than 50.
diff --git a/iedit-rect.el b/iedit-rect.el
index a668956c9a..95d2c88e7d 100644
--- a/iedit-rect.el
+++ b/iedit-rect.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2010, 2011, 2012 Victor Ren
 
-;; Time-stamp: <2012-09-05 09:49:55 Victor Ren>
+;; Time-stamp: <2012-12-09 00:34:58 Victor Ren>
 ;; Author: Victor Ren <victorhge@gmail.com>
 ;; Keywords: occurrence region simultaneous rectangle refactoring
 ;; Version: 0.97
@@ -125,10 +125,12 @@ Commands:
                        iedit-occurrences-overlays)
                  (forward-line 1))
             until (> (point) end))
-      (setq iedit-occurrences-overlays (nreverse iedit-occurrences-overlays))))
-  (setq iedit-rectangle-mode (propertize
-                    (concat " Iedit-rect:" (number-to-string (length 
iedit-occurrences-overlays)))
-                    'face 'font-lock-warning-face))
+      ))
+  (setq iedit-rectangle-mode
+        (propertize
+         (concat " Iedit-rect:"
+                 (number-to-string (length iedit-occurrences-overlays)))
+         'face 'font-lock-warning-face))
   (force-mode-line-update)
   (add-hook 'kbd-macro-termination-hook 'iedit-rectangle-done nil t)
   (add-hook 'change-major-mode-hook 'iedit-rectangle-done nil t)
@@ -154,7 +156,8 @@ The behavior is the same as `kill-rectangle' in rect mode."
   (or (and iedit-rectangle (iedit-same-column))
       (error "Not a rectangle"))
   (let ((inhibit-modification-hooks t)
-        (beg (overlay-start (car iedit-occurrences-overlays)))
+        (beg (overlay-start (progn (iedit-first-occurrence)
+                                   (iedit-find-current-occurrence-overlay))))
         (end (overlay-end (progn (iedit-last-occurrence)
                                  (iedit-find-current-occurrence-overlay)))))
     (kill-rectangle beg end fill)))
diff --git a/iedit-tests.el b/iedit-tests.el
index 9a68798550..8bb59eeaae 100644
--- a/iedit-tests.el
+++ b/iedit-tests.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2010, 2011, 2012 Victor Ren
 
-;; Time-stamp: <2012-12-08 23:40:48 Victor Ren>
+;; Time-stamp: <2012-12-09 00:11:33 Victor Ren>
 ;; Author: Victor Ren <victorhge@gmail.com>
 ;; Version: 0.97
 ;; X-URL: http://www.emacswiki.org/emacs/Iedit
@@ -567,7 +567,6 @@ abcd" 
"12345678901234567890123456789012345678901234567890...")))
 ;;                        ;; replace-match
 ;;                        text-property-not-all
 ;;                        iedit-make-occurrence-overlay
-;;                        nreverse
 ;;                        iedit-make-occurrences-overlays
 ;;                        match-beginning
 ;;                        match-end



reply via email to

[Prev in Thread] Current Thread [Next in Thread]