emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/iedit f707cce0b8 193/301: Remove the key binding to M-[


From: ELPA Syncer
Subject: [nongnu] elpa/iedit f707cce0b8 193/301: Remove the key binding to M-[
Date: Mon, 10 Jan 2022 22:59:02 -0500 (EST)

branch: elpa/iedit
commit f707cce0b8c98c37b20b3e026f51c36ae8251725
Author: Victor Ren <victor.ren@ericsson.com>
Commit: Victor Ren <victorhge@gmail.com>

    Remove the key binding to M-[
    
    Since M-[ is a profix of a key translation in xterm
    
    Rewrite iedit-expand-by-a-line
---
 README.org   |  4 ++--
 iedit-lib.el | 10 +++++-----
 iedit.el     | 35 ++++++++++++++---------------------
 3 files changed, 21 insertions(+), 28 deletions(-)

diff --git a/README.org b/README.org
index eec2121bc1..208518bc61 100644
--- a/README.org
+++ b/README.org
@@ -8,7 +8,7 @@ feedback as you type.
 
 Normal scenario of Iedit mode is like:
 
- - Highlight certain contents - by press C-;
+ - Highlight certain contents - by press C-; (The default key binding)
    All occurrences of a symbol, string or a rectangle in the buffer or a region
    may be highlighted corresponding to current mark, point and prefix
    argument. Refer to the document of `iedit-mode' for details.
@@ -40,7 +40,7 @@ Renaming refactoring is convinient in Iedit mode
 
  - Restricting the search area to the lines near the current line can
    be done by pressing M-{ and M-}. These will expand the search
-   region one line at a time from the top and bottom. Add a prefix
+   region one line at a time from the top and bottom.  Add a prefix
    argument to go the opposite direction.
 
 Iedit-rectangle-mode provides rectangle support with *visible rectangle*
diff --git a/iedit-lib.el b/iedit-lib.el
index d401b7d025..70b34ff869 100644
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -3,7 +3,7 @@
 
 ;; Copyright (C) 2010, 2011, 2012 Victor Ren
 
-;; Time-stamp: <2016-05-17 12:40:05 Victor Ren>
+;; Time-stamp: <2016-05-24 10:36:51 Victor Ren>
 ;; Author: Victor Ren <victorhge@gmail.com>
 ;; Keywords: occurrence region simultaneous rectangle refactoring
 ;; Version: 0.97
@@ -234,7 +234,7 @@ Return the number of occurrences."
   "Create previous occurrence overlay for `occurrence-exp'."
   (iedit-add-occurrence-overlay occurrence-exp point nil))
 
-(defun iedit-add-occurrence-overlay (occurrence-exp point forward)
+(defun iedit-add-occurrence-overlay (occurrence-exp point forward &optional 
bound)
   "Create next or previous occurrence overlay for `occurrence-exp'.
 Return the start position of the new occurrence if successful."
   (or point
@@ -244,9 +244,9 @@ Return the start position of the new occurrence if 
successful."
     (save-excursion
       (goto-char point)
       (if (not (if forward
-                   (re-search-forward occurrence-exp nil t)
-                 (re-search-backward occurrence-exp nil t)))
-          (message "No more match.")
+                   (re-search-forward occurrence-exp bound t)
+                 (re-search-backward occurrence-exp bound t)))
+          (message "No more matches.")
         (setq pos (match-beginning 0))
         (if (or (iedit-find-overlay-at-point (match-beginning 0) 
'iedit-occurrence-overlay-name)
                 (iedit-find-overlay-at-point (match-end 0) 
'iedit-occurrence-overlay-name))
diff --git a/iedit.el b/iedit.el
index 168da1946d..f990d223e1 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2010, 2011, 2012 Victor Ren
 
-;; Time-stamp: <2016-05-17 12:25:04 Victor Ren>
+;; Time-stamp: <2016-05-29 14:57:51 Victor Ren>
 ;; Author: Victor Ren <victorhge@gmail.com>
 ;; Keywords: occurrence region simultaneous refactoring
 ;; Version: 0.97
@@ -33,7 +33,7 @@
 ;;
 ;; Normal scenario of iedit-mode is like:
 ;;
-;; - Highlight certain contents - by press C-; (The default binding)
+;; - Highlight certain contents - by press C-; (The default key binding)
 ;;   All occurrences of a symbol, string in the buffer or a region may be
 ;;   highlighted corresponding to current mark, point and prefix argument.
 ;;   Refer to the document of `iedit-mode' for details.
@@ -220,7 +220,7 @@ This is like `describe-bindings', but displays only Iedit 
keys."
 ;;; Default key bindings:
 (when iedit-toggle-key-default
   (let ((key-def (lookup-key (current-global-map) iedit-toggle-key-default)))
-    (if (and key-def (not (eq key-def 'iedit-mode)))
+    (if key-def
         (display-warning 'iedit (format "Iedit default key %S is occupied by 
%s."
                                         (key-description 
iedit-toggle-key-default)
                                         key-def)
@@ -245,8 +245,8 @@ This is like `describe-bindings', but displays only Iedit 
keys."
     (define-key map (kbd "M-I") 'iedit-restrict-current-line)
     (define-key map (kbd "M-{") 'iedit-expand-up-a-line)
     (define-key map (kbd "M-}") 'iedit-expand-down-a-line)
-    (define-key map (kbd "M-[") 'iedit-expand-up-to-occurrence)
-    (define-key map (kbd "M-]") 'iedit-expand-down-to-occurrence)
+    (define-key map (kbd "M-p") 'iedit-expand-up-to-occurrence)
+    (define-key map (kbd "M-n") 'iedit-expand-down-to-occurrence)
     (define-key map (kbd "M-G") 'iedit-apply-global-modification)
     (define-key map (kbd "M-C") 'iedit-toggle-case-sensitive)
     map)
@@ -553,23 +553,16 @@ lines. The region being acted upon is controlled with
 bottom). With a prefix, collapses the top or bottom of the search
 region by `amount' lines."
   (interactive "P")
-  ;; Since iedit-done resets iedit-num-lines-to-expand-{down,up}, we
-  ;; have to hang on to them in tmp variables
-  (let ((tmp-up iedit-num-lines-to-expand-up)
-        (tmp-down iedit-num-lines-to-expand-down)
-        ;; we want to call iedit-mode with a universal prefix arg
-        (current-prefix-arg '(4)))
-    (iedit-done)
-    (call-interactively 'iedit-mode)
-    (setq iedit-num-lines-to-expand-up tmp-up)
-    (setq iedit-num-lines-to-expand-down tmp-down)
+  (let ((occurrence (iedit-current-occurrence-string)))
+    (iedit-cleanup)
     (if (eq where 'top)
-        (setq iedit-num-lines-to-expand-up (max 0
-                                                (+ amount 
iedit-num-lines-to-expand-up)))
-      (setq iedit-num-lines-to-expand-down (max 0
-                                                (+ amount 
iedit-num-lines-to-expand-down))))
-    (iedit-restrict-region (iedit-char-at-bol (- iedit-num-lines-to-expand-up))
-                           (iedit-char-at-eol iedit-num-lines-to-expand-down))
+        (setq iedit-num-lines-to-expand-up
+              (max 0 (+ amount iedit-num-lines-to-expand-up)))
+      (setq iedit-num-lines-to-expand-down
+            (max 0 (+ amount iedit-num-lines-to-expand-down))))
+    (iedit-start (iedit-regexp-quote occurrence)
+                 (iedit-char-at-bol (- iedit-num-lines-to-expand-up))
+                 (iedit-char-at-eol iedit-num-lines-to-expand-down))
     (message "Now looking -%d/+%d lines around current line, %d match%s."
              iedit-num-lines-to-expand-up
              iedit-num-lines-to-expand-down



reply via email to

[Prev in Thread] Current Thread [Next in Thread]