[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 5fdf89edc9 238/301: Fix switch to mc mode problem
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 5fdf89edc9 238/301: Fix switch to mc mode problem |
Date: |
Mon, 10 Jan 2022 22:59:05 -0500 (EST) |
branch: elpa/iedit
commit 5fdf89edc9bbd5982fb12c7fbfed0611a3accde1
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Fix switch to mc mode problem
`post-command-hook' run the the command itself, which set up the hook. So
the
hook function must have a way to avoid this.
---
iedit-lib.el | 47 +++++++++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 20 deletions(-)
diff --git a/iedit-lib.el b/iedit-lib.el
index 4897ce4816..5efd812654 100644
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2017-09-09 19:22:51 Victor Ren>
+;; Time-stamp: <2017-09-14 23:10:36 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous rectangle refactoring
;; Version: 0.9.9
@@ -185,6 +185,32 @@ is not applied to other occurrences when it is true.")
map)
"Default keymap used within occurrence overlays.")
+(when (require 'multiple-cursors-core nil t)
+ (defun iedit-switch-to-mc-mode ()
+ "Switch to multiple-cursors-mode. So that you can navigate
+out of the occurrence and edit simutaneously with multiple
+cursors."
+ (interactive "*")
+ (iedit-barf-if-buffering)
+ (let* ((ov (iedit-find-current-occurrence-overlay))
+ (offset (- (point) (overlay-start ov)))
+ (master (point)))
+ (mc/save-excursion
+ (dolist (occurrence iedit-occurrences-overlays)
+ (goto-char (+ (overlay-start occurrence) offset))
+ (unless (= master (point))
+ (mc/create-fake-cursor-at-point))
+ ))
+ (run-hooks 'iedit-aborting-hook)
+ (multiple-cursors-mode 1)
+ ))
+ ;; `multiple-cursors-mode' runs `post-command-hook' function for all the
+ ;; currors. `post-command-hook' is setup in `iedit-switch-to-mc-mode' So the
+ ;; function is excuted after `iedit-switch-to-mc-mode'. It is not expected.
+ ;; `mc/cmds-to-runn-once' is for skipping this.
+ (add-to-list 'mc/cmds-to-run-once 'iedit-switch-to-mc-mode)
+ (define-key iedit-occurrence-keymap-default (kbd "M-M")
'iedit-switch-to-mc-mode))
+
(defvar iedit-occurrence-keymap 'iedit-occurrence-keymap-default
"Keymap used within occurrence overlays.
It should be set before occurrence overlay is created.")
@@ -598,26 +624,7 @@ value of `iedit-occurrence-context-lines' is used for this
time."
(iedit-barf-if-buffering)
(iedit-apply-on-occurrences 'upcase-region))
-(when (require 'multiple-cursors-core nil t)
- (defun iedit-switch-to-mc-mode ()
- "Switch to multiple-cursors-mode. So that you can navigate
-out of the occurrence and edit simutaneously with multiple
-cursors."
- (interactive "*")
- (iedit-barf-if-buffering)
- (let* ((ov (iedit-find-current-occurrence-overlay))
- (offset (- (point) (overlay-start ov)))
- (master (point)))
- (mc/save-excursion
- (dolist (occurrence iedit-occurrences-overlays)
- (goto-char (+ (overlay-start occurrence) offset))
- (unless (= master (point))
- (mc/create-fake-cursor-at-point))
- ))
- (multiple-cursors-mode 1)
- (run-hooks 'iedit-aborting-hook)))
- (define-key iedit-occurrence-keymap-default (kbd "M-M")
'iedit-switch-to-mc-mode))
(defun iedit-downcase-occurrences()
"Covert occurrences to lower case."
- [nongnu] elpa/iedit e1decb37e5 245/301: Fix verion numbers, (continued)
- [nongnu] elpa/iedit e1decb37e5 245/301: Fix verion numbers, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit f09b675c67 249/301: Add an option 'iedit-auto-narrow', ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 44601e01fa 269/301: fix an issue with electric pair, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 3f9eed229e 232/301: Allow custom mode-line, ELPA Syncer, 2022/01/10
- [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 <=
- [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, 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