[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 3bca7e2da5 048/301: Fix iedit toggle case-sensitive
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 3bca7e2da5 048/301: Fix iedit toggle case-sensitive problem when getting occurrence from history |
Date: |
Mon, 10 Jan 2022 22:58:49 -0500 (EST) |
branch: elpa/iedit
commit 3bca7e2da51c000ab4a233b4c49efcfd21d7448b
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Fix iedit toggle case-sensitive problem when getting occurrence from history
---
iedit.el | 51 +++++++++++++++++++++++++++------------------------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/iedit.el b/iedit.el
index 5d562c4457..04c3ceae40 100644
--- a/iedit.el
+++ b/iedit.el
@@ -1,11 +1,11 @@
-;;; iedit.el --- Edit multiple regions with the same content simultaneously.
+;;; iedit.el --- Edit multiple regions simultaneously.
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2012-02-03 23:52:19 Victor Ren>
+;; Time-stamp: <2012-02-05 22:16:47 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region replace simultaneous
-;; Version: 0.92
+;; Version: 0.93
;; X-URL: http://www.emacswiki.org/emacs/iedit.el
;; Compatibility: GNU Emacs: 22.x, 23.x, 24.x
@@ -61,6 +61,7 @@
;; - C-n,C-p is slow when unmatched lines are hided.
;; - toggle blank line between matched lines?
;; - ert unit test
+;; - update documents for rectangle support
;;; Contributors
;; Adam Lindberg <eproxus@gmail.com> added a case sensitivity option that can
be toggled.
@@ -68,7 +69,7 @@
;; Tassilo Horn <tassilo@member.fsf.org> added an option to match only complete
;; words, not inside words
-;; Le Wang <l26wang@gmail.com> proposed to match only complete symbols,
not
+;; Le Wang <l26wang@gmail.com> proposed to match only complete symbols, not
;; inside symbols, contributed rectangle support
;;; Code:
@@ -143,7 +144,7 @@ unmatched lines are hided.")
"This is buffer local variable which is the occurrence when
iedit mode is turned off last time.")
-(defvar iedit-current-occurrence-complete-symbol nil
+(defvar iedit-occurrence-is-complete-symbol nil
"This is buffer local variable which indicates the occurrence
only matches complete symbol.")
@@ -293,13 +294,6 @@ This is like `describe-bindings', but displays only Iedit
keys."
map)
"Keymap used within overlays in iedit-RECT mode.")
-(defun iedit-kill-rectangle(&optional fill)
- "Kill the rectangle.
-The behavior is the same as `kill-rectangle' in rect mode."
- (interactive "P")
- (let ((inhibit-modification-hooks t))
- (kill-rectangle iedit-rect-start iedit-rect-end fill)))
-
(defun iedit-help-for-occurrences ()
"Display `iedit-occurrence-local-map' or `iedit-rect-local-map'."
(interactive)
@@ -347,12 +341,13 @@ Commands:
(interactive "P")
(if iedit-mode
(iedit-done)
- (let (occurrence rect-string)
+ (let (occurrence complete-symbol rect-string)
(cond ((and arg
(or (not transient-mark-mode) (not mark-active)
(equal (mark) (point)))
iedit-last-occurrence-in-history)
- (setq occurrence iedit-last-occurrence-in-history))
+ (setq occurrence iedit-last-occurrence-in-history)
+ (setq complete-symbol iedit-occurrence-is-complete-symbol))
((and arg
transient-mark-mode mark-active (not (equal (mark) (point))))
(setq rect-string t))
@@ -366,9 +361,9 @@ Commands:
((and iedit-current-symbol-default (current-word t))
(setq occurrence (regexp-quote (current-word)))
(when iedit-only-at-symbol-boundaries
- (setq iedit-current-occurrence-complete-symbol t)
- (setq occurrence (concat "\\_<" occurrence "\\_>"))))
+ (setq complete-symbol t)))
(t (error "No candidate of the occurrence, cannot enable iedit
mode.")))
+ (setq iedit-occurrence-is-complete-symbol complete-symbol)
(if rect-string
(let ((beg (region-beginning))
(end (region-end)))
@@ -385,6 +380,8 @@ Commands:
(setq iedit-aborting nil)
(setq iedit-rectangle nil)
(setq iedit-current-keymap iedit-occurrence-local-map)
+ (when iedit-occurrence-is-complete-symbol
+ (setq occurrence-exp (concat "\\_<" occurrence-exp "\\_>")))
;; Find and record each occurrence's markers and add the overlay to the
occurrences
(let ((counter 0)
(case-fold-search (not iedit-case-sensitive)))
@@ -454,13 +451,9 @@ Commands:
(end (overlay-end ov)))
(setq iedit-last-occurrence-in-history
(if (and ov (/= beg end))
- (let ((substring (buffer-substring-no-properties beg end)))
- (if iedit-current-occurrence-complete-symbol
- (concat "\\_<" substring "\\_>")
- substring))
+ (regexp-quote (buffer-substring-no-properties beg end))
nil)
))
- (setq iedit-current-occurrence-complete-symbol nil)
(remove-overlays (point-min) (point-max) iedit-occurrence-overlay-name t)
(remove-overlays (point-min) (point-max) iedit-invisible-overlay-name t)
(setq iedit-occurrences-overlays nil)
@@ -619,7 +612,9 @@ beginning of the buffer."
(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 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
@@ -785,8 +780,9 @@ be applied to other occurrences when buffering is off."
(insert-and-inherit modified-string)))))
(goto-char (+ (overlay-start ov) offset))))
(setq iedit-buffering nil)
- (setq iedit-mode (propertize (concat " Iedit:" (number-to-string (length
iedit-occurrences-overlays)))
- 'face 'font-lock-warning-face))
+ (setq iedit-mode (propertize
+ (concat " Iedit:" (number-to-string (length
iedit-occurrences-overlays)))
+ 'face 'font-lock-warning-face))
(force-mode-line-update)
(setq iedit-before-modification-undo-list nil)
(message "Iedit-mode buffering stopped."))
@@ -826,6 +822,13 @@ with a prefix argument, prompt for START-AT and FORMAT."
(setq iedit-number-line-counter
(1+ iedit-number-line-counter))) format)))
+(defun iedit-kill-rectangle(&optional fill)
+ "Kill the rectangle.
+The behavior is the same as `kill-rectangle' in rect mode."
+ (interactive "*P")
+ (let ((inhibit-modification-hooks t))
+ (kill-rectangle iedit-rect-start iedit-rect-end fill)))
+
(defun iedit-find-current-occurrence-overlay ()
"Always return the current occurrence overlay at point or point - 1,
since this function is supposed to be called in overlay local-map."
- [nongnu] elpa/iedit ac51555341 282/301: New feature: ignore hidden occurrences, (continued)
- [nongnu] elpa/iedit ac51555341 282/301: New feature: ignore hidden occurrences, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 31986b640a 289/301: Take iedit-goto-first-occurrence back, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 5e7253c36e 274/301: Update documents and comments, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit d4a878d52e 280/301: Minor docstring typo fix: covert -> convert., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 4765fa7a4d 271/301: Fix a conjoined overlay issue, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 68233e302d 300/301: Fix some byte-compiler warnings in Emacs 28, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 7d18e5d775 039/301: Add a help command C-? for occurrences, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e08ad5923a 043/301: Make Iedit mode available for read only buffer, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 78f606d4fc 045/301: Add iedit-number-occurrences function, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 0d4027fe10 046/301: Move save-excursion out of dolist, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 3bca7e2da5 048/301: Fix iedit toggle case-sensitive problem when getting occurrence from history,
ELPA Syncer <=
- [nongnu] elpa/iedit 5ab980908c 050/301: Update documents, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 799a0d17d1 053/301: Bump to version 0.94, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 00abe88e13 061/301: Hide line-feed between occurrence, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit bd8c116489 062/301: Add new occurrence function iedit-restrict-defun, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 7ebea0f43b 070/301: Add tests for iedit-rectangle, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e5f083f977 072/301: Add testcase for iedit-restrict-defun, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 62d2a5ac45 077/301: Fix iedit-kill-rectangle problem, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 8559638b9b 076/301: Fix C-u C-u iedit-last-inital-string-global problem, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 3ead6c6d3b 074/301: run checkdoc, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit ac2faa29d0 075/301: Add iedit-mode-defun and global key binding, ELPA Syncer, 2022/01/10