[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 5ad28b5ea0 003/301: updates
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 5ad28b5ea0 003/301: updates |
Date: |
Mon, 10 Jan 2022 22:58:44 -0500 (EST) |
branch: elpa/iedit
commit 5ad28b5ea08d52f636b195d5d811b1de7e569b64
Author: anybody <anybody@emacswiki.org>
Commit: Jonas Bernoulli <jonas@bernoul.li>
updates
---
iedit.el | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 96 insertions(+), 20 deletions(-)
diff --git a/iedit.el b/iedit.el
index a36c1f90c6..11b7392c56 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,12 +2,12 @@
;; Copyright (C) 2010 Victor Ren
-;; Time-stamp: <2010-03-13 17:17:16 Victor Ren>
+;; Time-stamp: <2011-02-25 14:54:30 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region replace simultaneous
-;; Version: 0.70
+;; Version: 0.90
;; X-URL: http://www.emacswiki.org/emacs/iedit.el
-;; Compatibility: GNU Emacs: 22.x, 23.x
+;; Compatibility: GNU Emacs: 22.x, 23.x, 24.x
;; This file is not part of GNU Emacs, but it is distributed under
;; the same terms as GNU Emacs.
@@ -57,9 +57,9 @@
;;; todo:
;; - Lazy highlight feature (from isearch)?
-;; - Help information
-;; - face for current occurrence
-;; - blank line between matched lines
+;; - toggle blank line between matched lines?
+;; - unit test
+;; - profile to find bottleneck for huge file
;;; Code:
@@ -81,6 +81,11 @@
:type 'boolean
:group 'iedit)
+(defcustom iedit-case-sensitive-default 't
+ "If no-nil, matching is case sensitive"
+ :type 'boolean
+ :group 'iedit)
+
(defcustom iedit-unmatched-lines-invisible-default nil
"If no-nil, hide lines that do not cover any occurrences by
default."
@@ -99,7 +104,7 @@ default."
(or (assq 'iedit-mode minor-mode-alist)
(nconc minor-mode-alist
- (list '(iedit-mode iedit-mode))))
+ (list '(iedit-mode iedit-mode))))
(defvar iedit-occurrences-overlays nil
"The occurrences slot contains a list of overlays used to
@@ -107,6 +112,10 @@ 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
+ "This is buffer local variable. If no-nil, matching is case
+ sensitive.")
+
(defvar iedit-unmatched-lines-invisible nil
"This is buffer local variable which indicates whether
unmatched lines are hided.")
@@ -121,12 +130,73 @@ forward or backward successful")
(make-variable-buffer-local 'iedit-occurrences-overlays)
(make-variable-buffer-local 'iedit-unmatched-lines-invisible)
+(make-variable-buffer-local 'iedit-case-sensitive)
(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)
-
+
+;;; Define iedit help map.
+(eval-when-compile (require 'help-macro))
+
+(defvar iedit-help-map
+ (let ((map (make-sparse-keymap)))
+;; (define-key map [t] 'iedit-other-control-char)
+ (define-key map (char-to-string help-char) 'iedit-help-for-help)
+ (define-key map [help] 'iedit-help-for-help)
+ (define-key map [f1] 'iedit-help-for-help)
+ (define-key map "?" 'iedit-help-for-help)
+ (define-key map "b" 'iedit-describe-bindings)
+ (define-key map "k" 'iedit-describe-key)
+ (define-key map "m" 'iedit-describe-mode)
+ (define-key map "q" 'help-quit)
+ map)
+ "Keymap for characters following the Help key for iedit mode.")
+
+(make-help-screen iedit-help-for-help-internal
+ (purecopy "Type a help option: [bkm] or ?")
+ "You have typed %THIS-KEY%, the help character. Type a Help option:
+\(Type \\<help-map>\\[help-quit] to exit the Help command.)
+
+b Display all Iedit key bindings.
+k KEYS Display full documentation of Iedit key sequence.
+m Display documentation of Iedit mode.
+
+You can't type here other help keys available in the global help map,
+but outside of this help window when you type them in Iedit mode,
+they exit Iedit mode before displaying global help."
+ iedit-help-map)
+
+(defun iedit-help-for-help ()
+ "Display Iedit help menu."
+ (interactive)
+ (let (same-window-buffer-names same-window-regexps)
+ (iedit-help-for-help-internal)))
+
+(defun iedit-describe-bindings ()
+ "Show a list of all keys defined in Iedit mode, and their definitions.
+This is like `describe-bindings', but displays only Iedit keys."
+ (interactive)
+ (let (same-window-buffer-names same-window-regexps)
+ (with-help-window "*Help*"
+ (with-current-buffer standard-output
+ (princ "Iedit Mode Bindings:\n")
+ (princ (substitute-command-keys "\\{iedit-mode-map}"))))))
+
+(defun iedit-describe-key ()
+ "Display documentation of the function invoked by iedit key."
+ (interactive)
+ (let (same-window-buffer-names same-window-regexps)
+ (call-interactively 'describe-key)))
+
+(defun iedit-describe-mode ()
+ "Display documentation of iedit mode."
+ (interactive)
+ (let (same-window-buffer-names same-window-regexps)
+ (describe-function 'iedit-mode)))
+
+;;; Define iedit mode map
(defvar iedit-mode-map nil
"Keymap used while iedit mode is enabled.")
@@ -137,11 +207,15 @@ forward or backward successful")
(define-key iedit-mode-map (kbd "TAB") 'iedit-next-occurrence)
(define-key iedit-mode-map (kbd "<S-tab>") 'iedit-prev-occurrence)
(define-key iedit-mode-map (kbd "<S-iso-lefttab>") 'iedit-prev-occurrence)
- (define-key iedit-mode-map (kbd "C-'")
'iedit-toggle-unmatched-lines-visible))
+ (define-key iedit-mode-map (kbd "<backtab>") 'iedit-prev-occurrence)
+ (define-key iedit-mode-map (kbd "C-'") 'iedit-toggle-unmatched-lines-visible)
+ (define-key iedit-mode-map (char-to-string help-char) iedit-help-map)
+ (define-key iedit-mode-map [help] iedit-help-map)
+ (define-key iedit-mode-map [f1] iedit-help-map))
(or (assq 'iedit-mode minor-mode-map-alist)
(setq minor-mode-map-alist
- (cons (cons 'iedit-mode iedit-mode-map) minor-mode-map-alist)))
+ (cons (cons 'iedit-mode iedit-mode-map) minor-mode-map-alist)))
;;;###autoload
(defun iedit-mode (&optional arg)
@@ -189,12 +263,14 @@ Commands:
(setq iedit-mode " Iedit")
(setq iedit-occurrences-overlays nil)
(setq iedit-unmatched-lines-invisible
iedit-unmatched-lines-invisible-default)
+ (setq iedit-case-sensitive iedit-case-sensitive-default)
(force-mode-line-update)
(run-hooks 'iedit-mode-hook)
- (add-hook 'mouse-leave-buffer-hook 'iedit-done)
+ ;; (add-hook 'mouse-leave-buffer-hook 'iedit-done)
(add-hook 'kbd-macro-termination-hook 'iedit-done)
;; Find and record each occurrence's markers and add the overlay to the
occurrences
- (let ((counter 0))
+ (let ((counter 0)
+ (case-fold-search (not iedit-case-sensitive)))
(save-excursion
(goto-char (point-min))
(while (search-forward occurrence-exp nil t)
@@ -209,7 +285,7 @@ Commands:
(if (> (length occurrence-exp) 50)
(concat (substring occurrence-exp 0 50) "...")
occurrence-exp)))))
-
+
(defun iedit-hide-unmatched-lines ()
"Hide unmatched lines using invisible overlay."
(let ((prev-occurrence-end 0)
@@ -230,7 +306,7 @@ Commands:
(when unmatched-lines
(dolist (unmatch unmatched-lines)
(iedit-make-unmatched-lines-overlay (car unmatch) (cadr
unmatch)))))))
-
+
(defun iedit-done ()
"Exit iedit mode."
(let ((ov (car iedit-occurrences-overlays)))
@@ -240,7 +316,7 @@ Commands:
(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)
- (remove-hook 'mouse-leave-buffer-hook 'iedit-done)
+ ;; (remove-hook 'mouse-leave-buffer-hook 'iedit-done)
(remove-hook 'kbd-macro-termination-hook 'iedit-done)
(setq iedit-mode nil)
(force-mode-line-update)
@@ -279,10 +355,10 @@ occurrences."
(dolist (like-occurrence iedit-occurrences-overlays)
(if (not (eq like-occurrence occurrence))
(progn
- (goto-char (overlay-start like-occurrence))
- (delete-region (overlay-start like-occurrence)
- (overlay-end like-occurrence))
- (insert value))))))))
+ (goto-char (overlay-start like-occurrence))
+ (delete-region (overlay-start like-occurrence)
+ (overlay-end like-occurrence))
+ (insert value))))))))
(defun iedit-next-occurrence ()
"Move forward to the next occurrence in the `iedit'.
@@ -321,7 +397,7 @@ the buffer."
(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
+ ;; 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))
- [nongnu] elpa/iedit 799a0d17d1 053/301: Bump to version 0.94, (continued)
- [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
- [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 <=
- [nongnu] elpa/iedit 6e49225083 042/301: Add iedit-toggle-case-sensitive, ELPA Syncer, 2022/01/10
- [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