[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 9a891d7abf 002/301: updates
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 9a891d7abf 002/301: updates |
Date: |
Mon, 10 Jan 2022 22:58:44 -0500 (EST) |
branch: elpa/iedit
commit 9a891d7abf0d7820c6334589c36288764d6d961e
Author: anybody <anybody@emacswiki.org>
Commit: Jonas Bernoulli <jonas@bernoul.li>
updates
---
iedit.el | 109 +++++++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 71 insertions(+), 38 deletions(-)
diff --git a/iedit.el b/iedit.el
index 6a3052379a..a36c1f90c6 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,11 +2,11 @@
;; Copyright (C) 2010 Victor Ren
-;; Time-stamp: <2010-03-07 22:48:30 Victor Ren>
+;; Time-stamp: <2010-03-13 17:17:16 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region replace simultaneous
-;; Version: 0.60
-;; X-URL:
+;; Version: 0.70
+;; X-URL: http://www.emacswiki.org/emacs/iedit.el
;; Compatibility: GNU Emacs: 22.x, 23.x
;; This file is not part of GNU Emacs, but it is distributed under
@@ -56,13 +56,10 @@
;; (define-key isearch-mode-map (kbd "C-;") 'iedit-mode)
;;; todo:
-;; - wrapping around navigating
-;; - Lazy highlight feature (from isearch)
+;; - Lazy highlight feature (from isearch)?
;; - Help information
-;; - Option of enabling linum-mode when unmatched lines are hided.
;; - face for current occurrence
;; - blank line between matched lines
-;; - fix problem of iedit-next-occurrence with linum-mode
;;; Code:
@@ -85,7 +82,8 @@
:group 'iedit)
(defcustom iedit-unmatched-lines-invisible-default nil
- "If no-nil, hide lines that do not cover any occurrences by default."
+ "If no-nil, hide lines that do not cover any occurrences by
+default."
:type 'boolean
:group 'iedit)
@@ -104,21 +102,27 @@
(list '(iedit-mode iedit-mode))))
(defvar iedit-occurrences-overlays nil
- "The occurrences slot contains a list of overlays used to indicate
-the position of each occurrence. In addition, the occurrence overlay is
-used to provide a different face configurable via
-`iedit-occurrence-face'." )
+ "The occurrences slot contains a list of overlays used to
+indicate the position of each occurrence. In addition, the
+occurrence overlay is used to provide a different face
+configurable via `iedit-occurrence-face'.")
(defvar iedit-unmatched-lines-invisible nil
- "This is buffer local variable which indicates whether unmatched
-lines are hided.")
+ "This is buffer local variable which indicates whether
+unmatched lines are hided.")
(defvar iedit-last-occurrence-in-history nil
"This is buffer local variable which is the occurrence when
- iedit mode is turned off last time.")
+iedit mode is turned off last time.")
+
+(defvar iedit-forward-success t
+ "This is buffer local variable which indicate the moving
+forward or backward successful")
(make-variable-buffer-local 'iedit-occurrences-overlays)
(make-variable-buffer-local 'iedit-unmatched-lines-invisible)
+(make-variable-buffer-local 'iedit-last-occurrence-in-history)
+(make-variable-buffer-local 'iedit-forward-success)
(defconst iedit-occurrence-overlay-name 'iedit-occurrence-overlay-name)
(defconst iedit-invisible-overlay-name 'iedit-invisible-overlay-name)
@@ -265,8 +269,9 @@ occurrences if the user starts typing."
(defun iedit-occurrence-update (occurrence after beg end &optional change)
"Update all occurrences.
-This modification hook is triggered when a user edits any occurrence
-and is responsible for updating all other occurrences."
+This modification hook is triggered when a user edits any
+occurrence and is responsible for updating all other
+occurrences."
(when (and after (not undo-in-progress)) ; undo will do all the work
(let ((value (buffer-substring (overlay-start occurrence) (overlay-end
occurrence)))
(inhibit-modification-hooks t))
@@ -280,31 +285,59 @@ and is responsible for updating all other occurrences."
(insert value))))))))
(defun iedit-next-occurrence ()
- "Move point forward to the next occurrence in the `iedit'.
-If there are no more occurrences, point stays at the last
-occurrence."
+ "Move forward to the next occurrence in the `iedit'.
+If the point is already in the last occurrences, you ask to type
+another `iedit-next-occurrence', it starts again from the
+beginning of the buffer."
(interactive)
- (let* ((occurrences iedit-occurrences-overlays)
- (next-pos (loop for occurrence in occurrences
- for start = (overlay-start occurrence)
- when (< (point) start)
- return start)))
- (if (not (null next-pos))
- (goto-char next-pos)
- )))
+ (let ((pos (point))
+ (in-occurrence (get-char-property (point)
'iedit-occurrence-overlay-name)))
+ (when in-occurrence
+ (setq pos (next-single-char-property-change pos
'iedit-occurrence-overlay-name)))
+ (setq pos (next-single-char-property-change pos
'iedit-occurrence-overlay-name))
+
+ (if (/= pos (point-max))
+ (setq iedit-forward-success t)
+ (if (and iedit-forward-success in-occurrence)
+ (progn (message "This is the last occurrence.")
+ (setq iedit-forward-success nil))
+ (progn
+ (if (get-char-property (point-min) 'iedit-occurrence-overlay-name)
+ (setq pos (point-min))
+ (setq pos (next-single-char-property-change (point-min)
'iedit-occurrence-overlay-name)))
+ (setq iedit-forward-success t)
+ (message "Located the first occurrence."))))
+ (when iedit-forward-success
+ (goto-char pos))))
(defun iedit-prev-occurrence ()
- "Move point backward to the previous occurrence in the `iedit'.
-If there are no more occurrences, point stays at the first
-occurrence."
+ "Move backward to the previous occurrence in the `iedit'.
+If the point is already in the first occurrences, you ask to type
+another `iedit-prev-occurrence', it starts again from the end of
+the buffer."
(interactive)
- (let* ((occurrences iedit-occurrences-overlays)
- (prev-pos (loop for occurrence in (reverse occurrences)
- for end = (overlay-end occurrence)
- when (> (point) end)
- return (overlay-start occurrence))))
- (if (not (null prev-pos))
- (goto-char prev-pos))))
+ (let ((pos (point))
+ (in-occurrence (get-char-property (point)
'iedit-occurrence-overlay-name)))
+ (when in-occurrence
+ (setq pos (previous-single-char-property-change pos
'iedit-occurrence-overlay-name)))
+ (setq pos (previous-single-char-property-change pos
'iedit-occurrence-overlay-name))
+ ;; at the start of the first occurrence
+ (if (or (and (eq pos (point-min))
+ (not (get-char-property (point-min)
'iedit-occurrence-overlay-name)))
+ (and (eq (point) (point-min))
+ in-occurrence))
+ (if (and iedit-forward-success in-occurrence)
+ (progn (message "This is the first occurrence.")
+ (setq iedit-forward-success nil))
+ (progn
+ (setq pos (previous-single-char-property-change (point-max)
'iedit-occurrence-overlay-name))
+ (if (not (get-char-property (- (point-max) 1)
'iedit-occurrence-overlay-name))
+ (setq pos (previous-single-char-property-change pos
'iedit-occurrence-overlay-name)))
+ (setq iedit-forward-success t)
+ (message "Located the last occurrence.")))
+ (setq iedit-forward-success t))
+ (when iedit-forward-success
+ (goto-char pos))))
(defun iedit-toggle-unmatched-lines-visible ()
"Toggle whether to display unmatched lines."
- [nongnu] branch elpa/iedit created (now 3bd4c15e3d), ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e9a94852d8 001/301: updates, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 69d6c03e06 009/301: Fix syntax error, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 9a891d7abf 002/301: updates,
ELPA Syncer <=
- [nongnu] elpa/iedit ec6785b0d2 008/301: host on git, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit f808bf1ce9 012/301: Merge from lewang/master and update comments, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 02946e07b6 013/301: Update contributors and spell check, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit af6d0ef70b 007/301: host on github, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 17e8fca7e6 011/301: Merge from tsdh/master, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 6d96992291 015/301: Remove duplicated comments, ELPA Syncer, 2022/01/10
- [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