[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 6e49225083 042/301: Add iedit-toggle-case-sensitive
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 6e49225083 042/301: Add iedit-toggle-case-sensitive |
Date: |
Mon, 10 Jan 2022 22:58:49 -0500 (EST) |
branch: elpa/iedit
commit 6e49225083fb2e5d2486a34b298ae436b3bdc1e5
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Add iedit-toggle-case-sensitive
---
iedit.el | 68 +++++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 39 insertions(+), 29 deletions(-)
diff --git a/iedit.el b/iedit.el
index bb9df39602..a9577c94d4 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2012-01-30 13:33:21 Victor Ren>
+;; Time-stamp: <2012-01-30 21:44:34 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region replace simultaneous
;; Version: 0.92
@@ -130,7 +130,7 @@ 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-case-sensitive nil
+(defvar iedit-case-sensitive iedit-case-sensitive-default
"This is buffer local variable. If no-nil, matching is case
sensitive.")
@@ -264,7 +264,8 @@ This is like `describe-bindings', but displays only Iedit
keys."
(define-key map (kbd "M-u") 'iedit-upcase-occurrences)
(define-key map (kbd "M-l") 'iedit-downcase-occurrences)
(define-key map (kbd "M-r") 'iedit-replace-occurrences)
- (define-key map (kbd "M-c") 'iedit-clear-occurrences)
+ (define-key map (kbd "M-C") 'iedit-clear-occurrences)
+ (define-key map (kbd "M-c") 'iedit-toggle-case-sensitive)
(define-key map (kbd "M-D") 'iedit-delete-occurrences)
(define-key map [C-return] 'iedit-toggle-buffering)
(define-key map (kbd "C-?") 'iedit-help-for-occurrences)
@@ -344,13 +345,13 @@ Commands:
(deactivate-mark)
(iedit-rectangle beg end))
(deactivate-mark)
+ (setq iedit-case-sensitive iedit-case-sensitive-default)
(iedit-start occurrence)))))
(defun iedit-start (occurrence-exp)
"Start an iedit for the occurrence-exp in the current buffer."
(setq iedit-occurrences-overlays nil)
(setq iedit-unmatched-lines-invisible
iedit-unmatched-lines-invisible-default)
- (setq iedit-case-sensitive iedit-case-sensitive-default)
(setq iedit-aborting nil)
;; Find and record each occurrence's markers and add the overlay to the
occurrences
(let ((counter 0)
@@ -380,13 +381,6 @@ Commands:
;; (add-hook 'mouse-leave-buffer-hook 'iedit-done)
(add-hook 'kbd-macro-termination-hook 'iedit-done))
-(defun iedit-reset-aborting ()
- "Turning iedit-mode off and reset iedit-aborting. `iedit-done'
-is postponed after the command is executed for avoiding
-iedit-occurrence-update is called for a removed overlay."
- (iedit-done)
- (remove-hook 'post-command-hook 'iedit-reset-aborting t)
- (setq iedit-aborting nil))
(defun iedit-rectangle (beg end)
"Start an iedit for the region as a rectangle"
@@ -414,24 +408,6 @@ iedit-occurrence-update is called for a removed overlay."
until (> (point) end))
(setq iedit-occurrences-overlays (nreverse
iedit-occurrences-overlays)))))
-(defun iedit-hide-unmatched-lines ()
- "Hide unmatched lines using invisible overlay."
- (let ((prev-occurrence-end 0)
- (unmatched-lines nil))
- (save-excursion
- (dolist (overlay iedit-occurrences-overlays)
- (goto-char (overlay-start overlay))
- (let ((line-beginning (line-beginning-position)))
- (if (> line-beginning (1+ prev-occurrence-end))
- (push (list (1+ prev-occurrence-end) (1- line-beginning))
unmatched-lines)))
- (goto-char (overlay-end overlay))
- (setq prev-occurrence-end (line-end-position)))
- (if (< prev-occurrence-end (point-max))
- (push (list (1+ prev-occurrence-end) (point-max)) unmatched-lines))
- (when unmatched-lines
- (dolist (unmatch unmatched-lines)
- (iedit-make-unmatched-lines-overlay (car unmatch) (cadr
unmatch)))))))
-
(defun iedit-done ()
"Exit iedit mode."
(if iedit-buffering
@@ -482,6 +458,14 @@ occurrences if the user starts typing."
(overlay-put unmatched-lines-overlay 'intangible t)
unmatched-lines-overlay))
+(defun iedit-reset-aborting ()
+ "Turning iedit-mode off and reset iedit-aborting. `iedit-done'
+is postponed after the command is executed for avoiding
+iedit-occurrence-update is called for a removed overlay."
+ (iedit-done)
+ (remove-hook 'post-command-hook 'iedit-reset-aborting t)
+ (setq iedit-aborting nil))
+
(defun iedit-occurrence-update (occurrence after beg end &optional change)
"Update all occurrences.
This modification hook is triggered when a user edits any
@@ -641,6 +625,25 @@ the buffer."
(iedit-hide-unmatched-lines)
(remove-overlays (point-min) (point-max) iedit-invisible-overlay-name t)))
+(defun iedit-hide-unmatched-lines ()
+ "Hide unmatched lines using invisible overlay."
+ (let ((prev-occurrence-end 0)
+ (unmatched-lines nil))
+ (save-excursion
+ (dolist (overlay iedit-occurrences-overlays)
+ (goto-char (overlay-start overlay))
+ (let ((line-beginning (line-beginning-position)))
+ (if (> line-beginning (1+ prev-occurrence-end))
+ (push (list (1+ prev-occurrence-end) (1- line-beginning))
unmatched-lines)))
+ (goto-char (overlay-end overlay))
+ (setq prev-occurrence-end (line-end-position)))
+ (if (< prev-occurrence-end (point-max))
+ (push (list (1+ prev-occurrence-end) (point-max)) unmatched-lines))
+ (when unmatched-lines
+ (dolist (unmatch unmatched-lines)
+ (iedit-make-unmatched-lines-overlay (car unmatch) (cadr
unmatch)))))))
+
+;;;; functions for overlay local-map
(defun iedit-foreach-occurrence-call (function &optional string)
"Call function for each occurrence."
(let* ((ov (car iedit-occurrences-overlays))
@@ -756,6 +759,13 @@ since this function is supposed to be called in overlay
local-map."
(setq overlays (cdr overlays)))))
found))
+(defun iedit-toggle-case-sensitive ()
+ "Toggle case-sensitive matching occurrences."
+ (interactive)
+ (iedit-done)
+ (setq iedit-case-sensitive (not iedit-case-sensitive))
+ (iedit-start iedit-last-occurrence-in-history))
+
(provide 'iedit)
;;; iedit.el ends here
- [nongnu] elpa/iedit 00abe88e13 061/301: Hide line-feed between occurrence, (continued)
- [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
- [nongnu] elpa/iedit 09c5063668 088/301: Merge pull request #10 from lewang/master, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 5ad28b5ea0 003/301: updates, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 6e49225083 042/301: Add iedit-toggle-case-sensitive,
ELPA Syncer <=
- [nongnu] elpa/iedit a8cbb6838b 047/301: Add iedit-kill-rectangle to iedit-rect mode and adjust keymap help, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 16ed986c33 066/301: Update document, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit f8c930f073 068/301: Add org markup, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 6300ca95d0 084/301: Update document with "narrowing" information, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 641d062b1b 081/301: Update documents, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit ab4a3857e7 085/301: Adds a .gitignore file to avoid dirty submodules., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit b9d97fa50e 095/301: Fix iedit-blank-occurrences broken with rectangles problem, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e35530f45d 097/301: Fix conjointed overlays overlapped problem after modification, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 2bf67ff6c7 100/301: Merge changes in master and, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 84c02ea4b6 049/301: Fix toggle case-sensitive problem when occurrence is empty string., ELPA Syncer, 2022/01/10