[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 5e7253c36e 274/301: Update documents and comments
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 5e7253c36e 274/301: Update documents and comments |
Date: |
Mon, 10 Jan 2022 22:59:10 -0500 (EST) |
branch: elpa/iedit
commit 5e7253c36ee4ca2cdb6dfce50a98e0aa04fb67b7
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor <victorhge@gmail.com>
Update documents and comments
---
README.org | 25 +++++++++++++++----------
iedit-lib.el | 34 +++++++++++++++++++++-------------
iedit.el | 19 ++++++++++++-------
3 files changed, 48 insertions(+), 30 deletions(-)
diff --git a/README.org b/README.org
index 93b824be20..5a54abca9a 100644
--- a/README.org
+++ b/README.org
@@ -4,18 +4,23 @@
[[./iedit-demo.gif]]
** Introduction
-This package includes Emacs minor modes (iedit-mode and
-iedit-rectangle-mode) based on a API library (iedit-lib) and allows you to edit
-one occurrence of some text in a buffer (possibly narrowed) or region, and
-simultaneously have other occurrences edited in the same way, with visual
-feedback as you type.
+This package includes Emacs minor modes (iedit-mode and iedit-rectangle-mode)
+based on a API library (iedit-lib) and allows you to alter one occurrence of
+some text in a buffer (possibly narrowed) or region, and simultaneously have
+other occurrences changed in the same way, with visual feedback as you type.
+
+`iedit-mode' is a great alternative of build-in replace commands:
+
+ - A more intuitive way to alter all the occurrences at once
+ - Visual feedback
+ - Less keystrokes in most cases
Normal work flow of Iedit mode is like:
- - Move to certain point and press C-; (The default key binding). All
- occurrences of a symbol, string or a region in the buffer are highlighted
- corresponding to the thing under the point, current mark and prefix
argument.
- Refer to the document of `iedit-mode' for details.
+ - Move to certain point and press C-; (The default key binding) to enable
+ `iedit-mode'. All occurrences of a symbol, string or a region in the buffer
+ are highlighted corresponding to the thing under the point, current mark and
+ prefix argument. Refer to the document of `iedit-mode' for details.
- Edit one of the occurrences
The change is applied to other occurrences simultaneously.
@@ -30,7 +35,7 @@ buffer lines that match the current text being edited. This
gives you the
effect of a temporary `keep-lines' or `occur'. To get this effect, hit C-'
when in Iedit mode - it toggles hiding non-matching lines.
-Renaming refactoring is convenient in Iedit mode
+`iedit-mode' is optimized for renaming refactoring in many ways:
- The symbol under point is selected as occurrence by default and only
complete
symbols are matched
diff --git a/iedit-lib.el b/iedit-lib.el
index 1186e30958..77846b02df 100755
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2010 - 2019, 2020 Victor Ren
-;; Time-stamp: <2020-11-21 21:16:05 Victor Ren>
+;; Time-stamp: <2020-11-23 15:50:37 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous rectangle refactoring
;; Version: 0.9.9.9
@@ -124,7 +124,9 @@ configurable via `iedit-ready-only-occurrence'.")
(defvar iedit-case-sensitive iedit-case-sensitive-default
"This is buffer local variable.
-If no-nil, matching is case sensitive.")
+If no-nil, matching is case sensitive. If nil and `case-replace'
+is no-nil, iedit try to preserve the case pattern of each
+occurrence.")
(defvar iedit-hiding nil
"This is buffer local variable which indicates whether buffer lines are
hided. ")
@@ -431,8 +433,9 @@ occurrences if the user starts typing."
(overlay-put occurrence 'insert-behind-hooks '(iedit-update-occurrences))
(overlay-put occurrence 'modification-hooks '(iedit-update-occurrences))
(overlay-put occurrence 'priority iedit-overlay-priority)
+ ;; Identify case pattern of the occurrence.
(overlay-put occurrence 'category (if (and (not iedit-case-sensitive)
case-replace)
-
(iedit-case-action begin end)
+
(iedit-case-pattern begin end)
'no-change))
occurrence))
@@ -561,10 +564,11 @@ Apply the change to all the other occurrences. "
(save-excursion
(iedit-move-conjoined-overlays occurrence)
(when (/= beg end)
+ ;; apply the case pattern on the current occurrence
(case (overlay-get occurrence 'category)
('all-caps
(upcase-region beg end))
- ('cap-initial
+ ('cap-initial
(when (= 0 offset) (capitalize-region beg end )))))
(dolist (another-occurrence iedit-occurrences-overlays)
(when (not (eq another-occurrence occurrence))
@@ -574,6 +578,7 @@ Apply the change to all the other occurrences. "
(when (/= beg end) ;; insert
(goto-char beginning)
(insert-and-inherit
+ ;; preserve the case pattern of each occurrence
(case (overlay-get another-occurrence 'category)
('no-change value)
('all-caps
@@ -907,23 +912,26 @@ be applied to other occurrences when buffering is off."
(buffer-disable-undo)
(message "Start buffering editing..."))
-(defun iedit-case-action (beg end)
- "Decide how to casify by examining the text between `beg' and `end'.
+(defun iedit-case-pattern (beg end)
+ "Distinguish the case pattern of the text between `beg' and `end'.
+
+These case ptterns are the same as the ones Emacs replace
+commands can recognized - three alternatives - all caps,
+captilized, the others.
-Maybe capitalize the whole text, or maybe just word initials,
-based on the text between `beg' and `end'. If the text has only
-capital letters and has at least one multiletter word, convert
-`new-text' to all caps. Otherwise if all words are capitalized
-in the replaced text, capitalize each word in `new-text'"
+If the text has only capital letters and has at least one
+multiletter word, it is 'all caps'. If all words are capitalized,
+it is captilized.'"
(let ((some-word nil)
(some-lowercase nil)
(some-uppercase nil)
(some-non-uppercase-init nil)
(previous-char ?\n)
(char nil)
- (index 0))
+ (index 0)
+ (text (buffer-substring beg end)))
(while (< index (- end beg))
- (setq char (elt (buffer-substring beg end) index))
+ (setq char (elt text index))
(if (and (= char (downcase char))
(/= char (upcase char)))
(progn
diff --git a/iedit.el b/iedit.el
index 80625d267f..e5efccc2d7 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010 - 2019, 2020 Victor Ren
-;; Time-stamp: <2020-11-21 21:08:37 Victor Ren>
+;; Time-stamp: <2020-11-23 15:18:05 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous refactoring
;; Version: 0.9.9.9
@@ -28,11 +28,16 @@
;;; Commentary:
-;; This package includes Emacs minor modes (iedit-mode and
-;; iedit-rectangle-mode) based on a API library (iedit-lib) and allows you to
edit
-;; one occurrence of some text in a buffer (possibly narrowed) or region, and
-;; simultaneously have other occurrences edited in the same way, with visual
-;; feedback as you type.
+;; This package includes Emacs minor modes (iedit-mode and
iedit-rectangle-mode)
+;; based on a API library (iedit-lib) and allows you to alter one occurrence of
+;; some text in a buffer (possibly narrowed) or region, and simultaneously have
+;; other occurrences changed in the same way, with visual feedback as you type.
+
+;; `iedit-mode' is a great alternative of build-in replace commands:
+
+;; - A more intuitive way to alter all the occurrences at once
+;; - Visual feedback
+;; - Less keystrokes in most cases
;; Normal work flow of Iedit mode is like:
@@ -54,7 +59,7 @@
;; effect of a temporary `keep-lines' or `occur'. To get this effect, hit C-'
;; when in Iedit mode - it toggles hiding non-matching lines.
-;; Renaming refactoring is convenient in Iedit mode
+;; `iedit-mode' is optimized for renaming refactoring in many ways:
;; - The symbol under point is selected as occurrence by default and only
complete
;; symbols are matched
- [nongnu] elpa/iedit 9c08a48c88 281/301: Remove the workaround for slow c-before-change, (continued)
- [nongnu] elpa/iedit 9c08a48c88 281/301: Remove the workaround for slow c-before-change, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 01767ddca3 258/301: Fix a failed testcase in batch mode, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 7e507b370b 255/301: Set the FIXEDCASE argument of replace-match in iedit-replace-occurrences to T to allow preserving case., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 745ea6f812 239/301: Rename iedit-toggle-unmatched-lines-visible to iedit-show/hide-unmatched-lines, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit dfed75064e 285/301: Save and restore `line-move-ignore-invisible', ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit c448864424 216/301: Remove iedit-unmatched-lines-invisible-default, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 5fdf89edc9 238/301: Fix switch to mc mode problem, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit de54411d0e 220/301: Detect markup tag only if region inactive, ELPA Syncer, 2022/01/10
- [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 <=
- [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, 2022/01/10
- [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