iedit-0.9.9.9.9/0000755000175000017500000000000014170176532013005 5ustar dogslegdogslegiedit-0.9.9.9.9/iedit-demo.gif0000755000175000017500000027504614170176532015535 0ustar dogslegdogslegGIF89a` ~$|%y%w(w+v-s3n5j4c1\0Z0Y/W.V-R(I$A(<$8)5|-4y-4x04w14v56t6>n6Ig5Ra4Y\3XV2WR1SO/PJ.OG.B?.==.::.46.46.46.46.46.46.46.46.46.4:.4A.4J.3Q.3T.3R.3N.3F.3A.3?137233233233233233233233233233233222222+,-"#!"    "%"( $% $% $% $% $%!%&!%&/.*?4/O84S:6V95[76`16a&7b8` 1e/i2m!Bp.Jp2Ls3@u87u85x:2@)R5S9V8Y3a.g.k)r3w3y6{:BCJqQoZmdujslpmm~pr|t{y~~}{~|}~{ncXY]irw~׊Րדܕϯ븱ﰰ鶴riknrߋڔ֧֞խԴԸйҴڳ{ұyͯpΩjͤeʠ`ʝ\͚YЙWҚXڟYWSLSXTRS]p߈! NETSCAPE2.0! ,`H*\ȰÇ#JHŋ3jȱǏ CI(S\ɲ˗0cʜI͛8sɳϟ@ JѣH*]S ӧPJJիXjӮ`ÊKٳhӪm:`۷pʝKݠ_˷߿+È+^=R] ?}k̹H |ɗ0n/3װc˞XtǿN*ci NSӽdKKNzY.سkWc\p&Gټy/RE *=8{ߦ9هKp-tKg݃b^K"wu'^[-?\t+G)eb)#'/(ӊA(2dK8SGD"UJGua42*"LKX>e8'bM^gr9Ӛf2CYxdJ{uᒍTe(!jT )}_fǨrI5v[?~]'r`AMG|hΦjg:i63dj阎$(,MK{ŪªҬbJfK{˩:)l̛ENZ=^+'{ji_qJlK&J"B 0.IrxrX|O\sѮ+B4+4|7 4iL1P7Jг.=6håoC MONZi0+U}`s m w71y'zS:Jݪx(ei@zCz.|6SK]?(,"t%:^S݃ {'^靓Z@ۃ/8S{s>MMf@Ɂ~&;YBY6S E798ݞ -nw) b8S,{OɈ2FMs.\ ¨ gk!6PC (?`펨"ShgE Zy`M`T9 /U l x|J% :%o g'^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%EH9{ {Eh>ȑFPB5)' `yi 0>')pYeP.p`[>pȎxRb98q;`ÕzN%50VP 0Ycd08VTAyQ<zARX I6u0Vhulƒo mǙY|rXu$!,Ho .46S uЉ.n6S46 &n6.RSnR6&<H*DH  C(80cŋ<x4h ʜ!?,-o\22.46N>O.4yu46ҘY.XTT46.4Y.49{46ҵyy.yu8ӗ;Wu=W46.48uuݯ>X6y6uTy:ҵ.K:;ӗ{=Y=݉9uuX6Ӵ{>݉:Ѿ>yYVJ{N`6>yYTX6{u={K6W`;.Xyu8WK6앵ݔ:w6{u;ӗ.`;>=`8TyѕJTuXy=ҘyTXY=;u9WK8K6;9ݝ:{K9V46;C>V6VwFw6yyN.VC>>ӴT4yu4yHA*Tx@#JHŋ3jȱǏ CIɓ(S\ɲKc6\HS8sɳϟ@ ԦQ4%HӧPJJХ62ׯ`ÊK,F1& plKݻxBDP퀁,%BA+^̸1H3\aǘ3k̙j o 0G 2 .ƀ2b+0`naҵȓ+|ZI&u$%pmx@ [eӫ_Ͼqo ]B ,[;v|P{& X _+xw H^e (J .HC}ȠНmbWbe.l (D9:@G@2d\EqDiQ[Ii͠di&{Zg曎d\ix%gAk֙矀Ԟ&K6z٢F*)GVZܤfj駉r(jꩨꪬ*무j뭸뮼+k&6F+Vkfv+k覫%*)g$ Y2/_g$0|h t|K < @!) dL y0&,\gVYka@'\ ŻTl @ 0`\@ x @SsDԌ6qWu={>ݯ>.48݉9>{u;>:W46.`;.K:<H*DH`  C(80cŋ<p4H0`ʜ!Made with ScreenToGif;iedit-0.9.9.9.9/iedit-rect.el0000644000175000017500000001445714170176532015373 0ustar dogslegdogsleg;;; iedit-rect.el --- visible rectangle editing support based on Iedit. ;; Copyright (C) 2010 - 2019, 2020 Victor Ren ;; Time-stamp: <2022-01-14 12:33:45 Victor Ren> ;; Author: Victor Ren ;; Keywords: occurrence region simultaneous rectangle refactoring ;; Version: 0.9.9.9.9 ;; X-URL: https://github.com/victorhge/iedit ;; https://www.emacswiki.org/emacs/Iedit ;; Compatibility: GNU Emacs: 22.x, 23.x, 24.x, 25.x ;; This file is not part of GNU Emacs, but it is distributed under ;; the same terms as GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . ;;; Commentary: ;; This package also provides rectangle support with *visible rectangle* ;; highlighting, which is similar with cua-mode rectangle support. But it is ;; lighter weight and uses iedit mechanisms. ;; The code was developed and fully tested on Gnu Emacs 24.0.93, partially ;; tested on Gnu Emacs 22. If you have any compatible problem, please let me ;; know. ;;; todo: ;; - Add restrict function back ;;; Code: ;; (eval-when-compile (require 'cl-lib)) (require 'rect) ;; kill-rectangle (require 'iedit-lib) (defvar iedit-rectangle-mode nil) ;; Name of the minor mode (make-variable-buffer-local 'iedit-rectangle-mode) (or (assq 'iedit-rectangle-mode minor-mode-alist) (nconc minor-mode-alist (list '(iedit-rectangle-mode iedit-rectangle-mode)))) ;;; Default key bindings: (when (null (where-is-internal 'iedit-rectangle-mode)) (let ((key-def (lookup-key ctl-x-r-map ";"))) (if key-def (display-warning 'iedit (format "Iedit rect default key %S is occupied by %s." (key-description [C-x r RET]) key-def) :warning) (define-key ctl-x-r-map "\r" 'iedit-rectangle-mode) (define-key ctl-x-r-map ";" 'iedit-rectangle-mode) (define-key rectangle-mark-mode-map ";" 'iedit-rectangle-mode) (message "Iedit-rect default key binding is %s" (key-description [C-x r \;]))))) (defvar iedit-rectangle nil "This buffer local variable which is the rectangle geometry if current mode is iedit-rect. Otherwise it is nil. \(car iedit-rectangle) is the top-left corner and \(cadr iedit-rectangle) is the bottom-right corner" ) (make-variable-buffer-local 'iedit-rectangle) ;;; Define Iedit rect mode map (defvar iedit-rect-keymap (let ((map (make-sparse-keymap))) (set-keymap-parent map iedit-occurrence-keymap-default) (define-key map (kbd "M-K") 'iedit-kill-rectangle) (define-key map (kbd "C-;") 'iedit-rectangle-mode) ; to exit iedit-rect mode map) "Keymap used within overlays in Iedit-rect mode.") (or (assq 'iedit-rectangle-mode minor-mode-map-alist) (setq minor-mode-map-alist (cons (cons 'iedit-rectangle-mode iedit-lib-keymap) minor-mode-map-alist))) ;; Avoid to restore Iedit-rect mode when restoring desktop (add-to-list 'desktop-minor-mode-handlers '(iedit-rectangle-mode . nil)) ;;;###autoload (defun iedit-rectangle-mode (&optional beg end) "Toggle Iedit-rect mode. When Iedit-rect mode is on, a rectangle is started with visible rectangle highlighting. Rectangle editing support is based on Iedit mechanism. Commands: \\{iedit-rect-keymap}" (interactive (when (iedit-region-active) (list (region-beginning) (region-end)))) ;; enforce skip modification once, errors may happen to cause this to be ;; unset. (setq iedit-skip-modification-once t) (if iedit-rectangle-mode (iedit-rectangle-done) (iedit-barf-if-lib-active) (if (and beg end) (progn (iedit-rectangle-start beg end)) (error "no region available.")))) (defun iedit-rectangle-line (startcol endcol) (push (iedit-make-occurrence-overlay (progn (move-to-column startcol t) (point)) (progn (move-to-column endcol t) (point))) iedit-occurrences-overlays)) (defun iedit-rectangle-start (beg end) "Start Iedit mode for the region as a rectangle." (barf-if-buffer-read-only) (setq iedit-rectangle (list (copy-marker beg) (copy-marker end t))) (setq iedit-occurrences-overlays nil) (setq iedit-occurrence-keymap iedit-rect-keymap) (goto-char (apply-on-rectangle 'iedit-rectangle-line beg end)) (setq mark-active nil) (run-hooks 'deactivate-mark-hook) (setq iedit-rectangle-mode (propertize (concat " Iedit-rect:" (number-to-string (length iedit-occurrences-overlays))) 'face 'font-lock-warning-face)) (iedit-lib-start 'iedit-rectangle-done) (force-mode-line-update)) (defun iedit-rectangle-done () "Exit Iedit mode. Save the current occurrence string locally and globally. Save the initial string globally." (iedit-lib-cleanup) (setq iedit-rectangle-mode nil) (force-mode-line-update)) (defun iedit-kill-rectangle(&optional fill) "Kill the rectangle. The behavior is the same as `kill-rectangle' in rect mode." (interactive "*P") (or (and iedit-rectangle (iedit-same-column)) (error "Not a rectangle")) (let ((inhibit-modification-hooks t)) (kill-rectangle (marker-position (car iedit-rectangle)) (marker-position (cadr iedit-rectangle)) fill))) (provide 'iedit-rect) ;;; iedit-rect.el ends here ;; LocalWords: iedit el MERCHANTABILITY kbd isearch todo ert Lindberg Tassilo ;; LocalWords: eval rect defgroup defcustom boolean defvar assq alist nconc ;; LocalWords: substring cadr keymap defconst purecopy bkm defun princ prev ;; LocalWords: iso lefttab backtab upcase downcase concat setq autoload arg ;; LocalWords: refactoring propertize cond goto nreverse progn rotatef eq elp ;; LocalWords: dolist pos unmatch args ov sReplace iedit's cdr quote'ed Ren ;; LocalWords: cua ctl RET iedit-0.9.9.9.9/README.org0000644000175000017500000000654014170176532014460 0ustar dogslegdogsleg* Iedit - Edit multiple occurrences in the same way simultaneously [[http://melpa.org/#/iedit][file:http://melpa.org/packages/iedit-badge.svg]] [[http://stable.melpa.org/#/iedit][file:http://stable.melpa.org/packages/iedit-badge.svg]] [[./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 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 - Preserve case optionally Normal work flow of Iedit mode is like: - Move point to a target by `isearch' or other moving commands - Press C-;(The default key binding) to enable Iedit mode. The thing under the point is recognized as an occurrence, and all the occurrences in the buffer are highlighted - Edit one of the occurrences The change is applied to other occurrences simultaneously. - Finish - by pressing C-; again Many other work flows to highlight occurrences are possible, for example, activation from isearch, incremental selection and markup tag pair selection. You can also use Iedit mode as a quick way to temporarily show only the 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. `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 - With digit prefix argument 0, only occurrences in current function are matched - Last renaming refactoring is remembered and can be applied to other buffers later - Once in iedit mode, you can select a region and hit C-; again to restrict the search area to the region - Restricting the search area to just the current line can be done by pressing M-I. - 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 argument to go the opposite direction. Iedit-rectangle-mode provides rectangle support with *visible rectangle* highlighting, which is similar with cua mode rectangle support. But it's lighter weight and uses iedit mechanisms. There are also some other facilities you may never think about. Refer to the document of function `iedit-mode' (C-h f iedit-mode RET) for more details. ** Installation instruction *** Installing from MELPA The easiest way to install and keep Iedit up-to-date is using Emacs’s built-in package manager. Iedit is available in the MELPA repository. Refer to http://melpa.org/#/getting-started for how to install a package from MELPA. *** Installing from GitHub You can also clone Iedit's repository or download a zip package from GitHub https://github.com/victorhge/iedit You will need to add a few extra lines in your .emacs file, to make your Emacs knows about the package: #+BEGIN_SRC elisp (add-to-list 'load-path "~/dir/to/your/iedit") (require 'iedit) #+END_SRC # LocalWords: Iedit iedit iedit-0.9.9.9.9/iedit-tests.el0000644000175000017500000005661214170176532015577 0ustar dogslegdogsleg;;; iedit-tests.el --- iedit's automatic-tests ;; Copyright (C) 2010 - 2019, 2020 Victor Ren ;; Time-stamp: <2022-01-14 12:33:56 Victor Ren> ;; Author: Victor Ren ;; Version: 0.9.9.9.9 ;; X-URL: https://github.com/victorhge/iedit ;; https://www.emacswiki.org/emacs/Iedit ;; Compatibility: GNU Emacs: 22.x, 23.x, 24.x, 25.x ;; This file is not part of GNU Emacs, but it is distributed under ;; the same terms as GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . ;;; Commentary: ;; This file is part of iedit. ;;; Code: (require 'ert) (require 'iedit) (require 'iedit-rect) (require 'elp) (ert-deftest iedit-batch-compile-test () (with-temp-buffer (call-process-shell-command "emacs -L . -Q --batch -f batch-byte-compile *.el" nil (current-buffer)) (should (string= (buffer-string) "Iedit default key binding is C-; Iedit-rect default key binding is <;> ")) (delete-file (byte-compile-dest-file "iedit-lib.el") nil) (delete-file (byte-compile-dest-file "iedit-rect.el") nil) (delete-file (byte-compile-dest-file "iedit-tests.el") nil) (delete-file (byte-compile-dest-file "iedit.el") nil))) (defmacro with-iedit-test-buffer (buffer-name &rest body) (declare (indent 1) (debug t)) `(progn (when (get-buffer ,buffer-name) (kill-buffer ,buffer-name)) (with-current-buffer (get-buffer-create ,buffer-name) ;; Give the current temp buffer a window. Otherwise `recenter' will ;; trigger an error message. (progn (set-window-buffer nil ,buffer-name) ,@body)))) (defun marker-position-list (l) "convert list of markers to positions" (mapcar (lambda (m) (marker-position m)) l)) (defun goto-word (word &optional beginning) (goto-char (point-min)) (search-forward word) (when beginning (goto-char (- (point) (length word))))) (defun goto-word-beginning (word) (goto-word word t)) (defun with-iedit-test-fixture (input-buffer-string body) "iedit test fixture" (let ((old-transient-mark-mode transient-mark-mode) (old-iedit-transient-sensitive iedit-transient-mark-sensitive)) (unwind-protect (progn (with-iedit-test-buffer "* iedit transient mark *" (transient-mark-mode t) (setq iedit-transient-mark-sensitive t) (setq iedit-case-sensitive t) (insert input-buffer-string) (goto-char 1) (iedit-mode) (funcall body)) (with-iedit-test-buffer "* iedit NO transient mark *" (setq iedit-transient-mark-sensitive nil) (setq iedit-case-sensitive t) (transient-mark-mode -1) (insert input-buffer-string) (goto-char 1) (iedit-mode) (funcall body))) (transient-mark-mode old-transient-mark-mode) (setq iedit-transient-mark-sensitive old-transient-mark-mode)))) (ert-deftest iedit-mode-base-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (should (= 3 (length iedit-occurrences-overlays))) (should (string= iedit-initial-string-local "foo")) (set-mark-command nil) (forward-line 2) (iedit-mode) (should (= 2 (length iedit-occurrences-overlays))) (should (string= iedit-initial-string-local "foo")) (iedit-mode) (should (null iedit-occurrences-overlays))))) (ert-deftest iedit-mode-with-region-test () (with-iedit-test-fixture "foobar foo foo bar foo" (lambda () (iedit-mode) (goto-char 1) (set-mark-command nil) (forward-char 3) (iedit-mode) (should (= 4 (length iedit-occurrences-overlays))) (should (string= iedit-initial-string-local "foo")) (should (eq 'selection iedit-occurrence-type-local)) (goto-char 1) (set-mark-command nil) (forward-line 3) (iedit-mode 4) (should (= 1 (length iedit-occurrences-overlays)))))) (ert-deftest iedit-mode-with-tag-pair-test () (with-iedit-test-fixture "
foo
bar
foobar
div foobar foo bar foo" (lambda () (iedit-mode) (goto-char 2) (iedit-mode) (should (= 2 (length iedit-occurrences-overlays))) (should (string= iedit-initial-string-local "div")) ;; (should (eq 'tag iedit-occurrence-type-local)) (iedit-mode) (sgml-electric-tag-pair-mode t) (iedit-mode) (should (= 3 (length iedit-occurrences-overlays))) (should (string= iedit-initial-string-local "
")) (should (eq 'symbol iedit-occurrence-type-local)) (sgml-electric-tag-pair-mode)))) (ert-deftest iedit-move-conjointed-overlays-test () (with-iedit-test-fixture "foobar foofoofoo foofoo foo" (lambda () (iedit-mode) (goto-char 1) (set-mark-command nil) (forward-char 3) (iedit-mode) (should (= 7 (length iedit-occurrences-overlays))) (should (string= iedit-initial-string-local "foo")) (should (eq 'selection iedit-occurrence-type-local)) (goto-char 1) (insert "123") (run-hooks 'post-command-hook) (should (string= (buffer-string) "123foobar 123foo123foo123foo 123foo123foo 123foo")) (forward-char 3) (insert "456") (run-hooks 'post-command-hook) (should (string= (buffer-string) "123foo456bar 123foo456123foo456123foo456 123foo456123foo456 123foo456"))))) (ert-deftest iedit-overlay-at-end-of-buffer () (with-iedit-test-fixture "foo foo" (lambda () (iedit-mode) (goto-char (point-min)) (goto-char (point-at-eol)) (iedit-mode) (delete-region (point) (1- (point))) (run-hooks 'post-command-hook) (should (string= (buffer-string) "fo fo")) (insert "b") (run-hooks 'post-command-hook) (should (string= (buffer-string) "fob fob"))))) (ert-deftest iedit-mode-start-from-isearch-test () (with-iedit-test-fixture "a (defun foo (foo bar foo) \"foo bar foobar\" nil) (defun bar (bar foo bar) \"bar foo barfoo\" nil) foo foo" (lambda () (iedit-mode) (emacs-lisp-mode) (goto-char 5) (iedit-mode) (isearch-mode t) (isearch-process-search-char ?f) (isearch-process-search-char ?o) (isearch-process-search-char ?o) (iedit-mode-from-isearch 0) (should (string= iedit-initial-string-local "foo")) (should (= 5 (length iedit-occurrences-overlays))) (iedit-mode) (isearch-mode t) (isearch-process-search-char ?f) (isearch-process-search-char ?o) (isearch-process-search-char ?o) (iedit-mode-from-isearch) (should (= 10 (length iedit-occurrences-overlays))) ))) (ert-deftest iedit-mode-start-from-isearch-regexp-test () (with-iedit-test-fixture "foo fobar foobar fooobar barfoo foo" (lambda () (iedit-mode) (call-interactively 'isearch-forward-regexp) (isearch-process-search-char ?f) (isearch-process-search-char ?o) (isearch-process-search-char ?*) (isearch-process-search-char ?b) (call-interactively 'iedit-mode-from-isearch) (should (null iedit-occurrences-overlays)) (should (null iedit-mode)) ;; (should (string= (current-message) "Matches are not the same length.")) (goto-char (point-min)) (call-interactively 'isearch-forward-regexp) (isearch-process-search-char ?f) (isearch-process-search-char ?o) (isearch-process-search-char ?.) (isearch-process-search-char ?b) (call-interactively 'iedit-mode-from-isearch) (should (= 1 (length iedit-occurrences-overlays))) ))) (ert-deftest iedit-mode-last-local-occurrence-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (should (= 3 (length iedit-occurrences-overlays))) (should (string= iedit-initial-string-local "foo")) (iedit-mode) (goto-char 15) (iedit-mode 4) ; last local (should (string= iedit-initial-string-local "foo")) (should (= 3 (length iedit-occurrences-overlays)))))) (ert-deftest iedit-mode-last-global-occurrence-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (should (= 3 (length iedit-occurrences-overlays))) (should (string= iedit-initial-string-local "foo")) (iedit-mode) (with-temp-buffer (set-window-buffer nil (current-buffer)) (insert "bar foo foo") (goto-char 1) (iedit-mode 16) (should (string= iedit-initial-string-local "foo")) (should (= 2 (length iedit-occurrences-overlays))))))) (ert-deftest iedit-execute-last-modification-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (should (= 3 (length iedit-occurrences-overlays))) (should (string= iedit-initial-string-local "foo")) (iedit-mode) (with-temp-buffer (insert "bar foo foo") (should-error (iedit-execute-last-modification)))))) (ert-deftest iedit-movement-test () (with-iedit-test-fixture "foo foo barfoo foo " (lambda () (iedit-goto-last-occurrence) (should (= (point) 24)) (should (= iedit-occurrence-index 3)) (iedit-goto-first-occurrence) (should (= (point) 1)) (should (= iedit-occurrence-index 1)) (iedit-next-occurrence 1) (should (= (point) 7)) (should (= iedit-occurrence-index 2)) (iedit-next-occurrence 1) (should (= (point) 24)) (should (= iedit-occurrence-index 3)) (iedit-next-occurrence 1) (should (= (point) 24)) ;; (should (string= (current-message) "This is the last occurrence.")) (should (= iedit-occurrence-index 3)) (iedit-next-occurrence 1) (should (= (point) 1)) ;; (should (string= (current-message) "Located the first occurrence.")) (should (= iedit-occurrence-index 1)) (iedit-next-occurrence 1) (should (= (point) 7)) (should (= iedit-occurrence-index 2)) (goto-char (point-max)) (iedit-prev-occurrence 1) (should (= (point) 24)) (should (= iedit-occurrence-index 3)) (iedit-prev-occurrence 1) (should (= (point) 7)) (iedit-prev-occurrence 1) (should (= (point) 1)) (iedit-prev-occurrence 1) (should (= (point) 1)) ;; (should (string= (current-message) "This is the first occurrence.")) (iedit-prev-occurrence 1) (should (= (point) 24)) ;; (should (string= (current-message) "Located the last occurrence.")) ))) (ert-deftest iedit-occurrence-update-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (insert "1") (run-hooks 'post-command-hook) (should (string= (buffer-string) "1foo 1foo barfoo 1foo")) (backward-delete-char 1) (run-hooks 'post-command-hook) (should (string= (buffer-string) "foo foo barfoo foo")) (capitalize-word 1) (run-hooks 'post-command-hook) (should (string= (buffer-string) "Foo Foo barfoo Foo")) ;; test insert from empty (iedit-delete-occurrences) (insert "1") (run-hooks 'post-command-hook) (should (string= (buffer-string) "1 1 barfoo 1"))))) (ert-deftest iedit-occurrence-update-with-read-only-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-mode) (put-text-property 1 2 'read-only t) (iedit-mode) (goto-char 2) (should-error (insert "1")) (should (string= (buffer-string) "foo foo barfoo foo")) (goto-char 7) (insert "1") (run-hooks 'post-command-hook) (should (string= (buffer-string) "foo 1foo barfoo 1foo")) ))) (ert-deftest iedit-aborting-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (kill-region (point) (+ 4 (point))) (should (string= (buffer-string) " foo barfoo foo"))))) (ert-deftest iedit-toggle-case-sensitive-test () (with-iedit-test-fixture "foo Foo barfoo foo" (lambda () (should (= 2 (length iedit-occurrences-overlays))) (iedit-toggle-case-sensitive) (should (= 3 (length iedit-occurrences-overlays))) (iedit-next-occurrence 1) (iedit-toggle-case-sensitive) (should (= 1 (length iedit-occurrences-overlays)))))) (ert-deftest iedit-toggle-search-invisible-test () (with-iedit-test-fixture "foo * foo ** foo" (lambda () (iedit-mode) ; turn off iedit-mode (outline-mode) (forward-line 1) (call-interactively 'outline-hide-subtree) (setq iedit-search-invisible t) (goto-char 1) (iedit-mode) (should (= 3 (length iedit-occurrences-overlays))) (should (= 0 iedit-lib-skip-invisible-count)) (iedit-toggle-search-invisible) (should (= 2 (length iedit-occurrences-overlays))) (should (null iedit-search-invisible)) (should (= 1 iedit-lib-skip-invisible-count)) (iedit-toggle-search-invisible) (should (= 3 (length iedit-occurrences-overlays))) (should (= 0 iedit-lib-skip-invisible-count)) (should (eq 'open iedit-search-invisible))))) (ert-deftest iedit-case-preserve-test () (with-iedit-test-fixture "foo Foo barFoo FOO" (lambda () (iedit-mode) (goto-char 1) (set-mark-command nil) (forward-char 3) (let ((iedit-case-sensitive nil) (case-replace t)) (iedit-mode) (goto-char 1) (insert "bar") (run-hooks 'post-command-hook) (should (string= (buffer-string) "barfoo BarFoo barBarFoo BARFOO")))))) (ert-deftest iedit-apply-on-occurrences-test () "Test functions deal with the whole occurrences" (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-upcase-occurrences) (should (string= (buffer-string) "FOO FOO barfoo FOO")) (iedit-downcase-occurrences) (should (string= (buffer-string) "foo foo barfoo foo")) (iedit-replace-occurrences "bar") (should (string= (buffer-string) "bar bar barfoo bar")) (iedit-number-occurrences 1 "%d ") (should (string= (buffer-string) "1 bar 2 bar barfoo 3 bar"))))) (ert-deftest iedit-blank-occurrences-test () "Test functions deal with the whole occurrences" (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-blank-occurrences) (should (string= (buffer-string) " barfoo "))))) (ert-deftest iedit-blank-occurrences-rectangle-test () "Test functions deal with the whole occurrences" (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-mode) ; turn off iedit (goto-char 2) (set-mark-command nil) (goto-char 7) (call-interactively 'iedit-rectangle-mode) (iedit-blank-occurrences) (should (string= (buffer-string) "f o oo barfoo foo"))))) (ert-deftest iedit-delete-occurrences-test () "Test functions deal with the whole occurrences" (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-delete-occurrences) (should (string= (buffer-string) " barfoo "))))) (ert-deftest iedit-toggle-buffering-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-toggle-buffering) (insert "bar") (run-hooks 'post-command-hook) (should (string= (buffer-string) "barfoo foo barfoo foo")) (iedit-toggle-buffering) (should (string= (buffer-string) "barfoo barfoo barfoo barfoo")) (should (= (point) 4)) (iedit-toggle-buffering) (backward-delete-char 3) (should (string= (buffer-string) "foo barfoo barfoo barfoo")) (goto-char 15) ;not in an occurrence (should (null (iedit-find-current-occurrence-overlay))) (iedit-toggle-buffering) (should (string= (buffer-string) "foo foo barfoo foo"))))) (ert-deftest iedit-buffering-undo-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-mode) ;turnoff (setq iedit-auto-buffering t) (push nil buffer-undo-list) (call-interactively 'iedit-mode) (insert "bar") (run-hooks 'post-command-hook) (should (string= (buffer-string) "barfoo foo barfoo foo")) (call-interactively 'iedit-mode) (should (string= (buffer-string) "barfoo barfoo barfoo barfoo")) (should (= (point) 4)) (push nil buffer-undo-list) (undo 1) (should (= (point) 1)) (should (string= (buffer-string) "foo foo barfoo foo")) ))) (ert-deftest iedit-buffering-quit-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-mode) ;turnoff (setq iedit-auto-buffering t) (push nil buffer-undo-list) (call-interactively 'iedit-mode) (insert "bar") (run-hooks 'post-command-hook) (should (string= (buffer-string) "barfoo foo barfoo foo")) (call-interactively 'iedit--quit) (should (string= (buffer-string) "barfoo foo barfoo foo")) (should (= (point) 4)) (push nil buffer-undo-list) (undo 1) (should (= (point) 1)) (should (string= (buffer-string) "foo foo barfoo foo")) ))) (ert-deftest iedit-rectangle-start-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-mode) (set-mark-command nil) (forward-char 3) (forward-line 3) (call-interactively 'iedit-rectangle-mode) (should (equal (marker-position-list iedit-rectangle) '(1 19))) (call-interactively 'iedit-rectangle-mode) (goto-char (point-min)) (set-mark-command nil) (goto-char (point-max)) (call-interactively 'iedit-rectangle-mode) (should (equal (marker-position-list iedit-rectangle) '(1 33)))))) (ert-deftest iedit-kill-rectangle-error-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-mode) (set-mark-command nil) (goto-char 22) (call-interactively 'iedit-rectangle-mode) (should (iedit-same-column)) (should (equal (marker-position-list iedit-rectangle) '(1 22))) (iedit-prev-occurrence 1) (delete-char -1) (should (not (iedit-same-column))) (should-error (iedit-kill-rectangle))))) (ert-deftest iedit-expand-to-occurrence-test () (with-iedit-test-fixture "a a a a a a a a" (lambda() (goto-char 5) (iedit-restrict-current-line) (call-interactively 'iedit-expand-down-to-occurrence) (should (equal (length iedit-occurrences-overlays) 4)) (should (= (point) 11)) (call-interactively 'iedit-expand-up-to-occurrence) (should (equal (length iedit-occurrences-overlays) 5)) (should (= (point) 3)) (call-interactively 'iedit-expand-up-to-occurrence) (call-interactively 'iedit-expand-up-to-occurrence) (should (equal (length iedit-occurrences-overlays) 6)) (should (= (point) 1)) (call-interactively 'iedit-expand-down-to-occurrence) (call-interactively 'iedit-expand-down-to-occurrence) (call-interactively 'iedit-expand-down-to-occurrence) (should (equal (length iedit-occurrences-overlays) 8)) (should (= (point) 15))))) (ert-deftest iedit-kill-rectangle-test () (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-mode) (set-mark-command nil) (goto-char 22) (call-interactively 'iedit-rectangle-mode) (should (iedit-same-column)) (should (equal (marker-position-list iedit-rectangle) '(1 22))) (iedit-kill-rectangle) (should (string= (buffer-string) " o arfoo foo")) (should (equal killed-rectangle '("foo" " fo" " b" " ")))))) (ert-deftest iedit-kill-rectangle-fill-extra-spaces () "lines within rectangle shorter than rectangle right column should have spaces filled in." (with-iedit-test-fixture "foo foo barfoo foo" (lambda () (iedit-mode) (setq indent-tabs-mode nil) (set-mark-command nil) (goto-word "barfoo") (call-interactively 'iedit-rectangle-mode) (should (iedit-same-column)) (should (equal '(1 27) (marker-position-list iedit-rectangle)))))) (ert-deftest iedit-restrict-defun-test () (with-iedit-test-fixture "a (defun foo (foo bar foo) \"foo bar foobar\" nil) (defun bar (bar foo bar) \"bar foo barfoo\" nil)" (lambda () (iedit-mode) (emacs-lisp-mode) (goto-char 5) (iedit-mode) (setq iedit-auto-narrow t) (iedit-restrict-function) (should (= 1 (length iedit-occurrences-overlays))) (should (equal (buffer-narrowed-p) iedit-is-narrowed)) (iedit-mode) (goto-char 13) (setq iedit-auto-narrow nil) (call-interactively 'iedit-mode-toggle-on-function) (should (= 4 (length iedit-occurrences-overlays))) (iedit-mode) (iedit-mode) (mark-defun) (iedit-mode) (should (= 4 (length iedit-occurrences-overlays)))))) (ert-deftest iedit-transient-sensitive-test () (with-iedit-test-fixture "a (defun foo (foo bar foo) \"foo bar foobar\" nil) (defun bar (bar foo bar) \"bar foo barfoo\" nil)" (lambda () (iedit-mode) (emacs-lisp-mode) (setq iedit-transient-mark-sensitive t) (transient-mark-mode -1) (goto-char 5) (iedit-mode) (iedit-restrict-function) (should (= 1 (length iedit-occurrences-overlays))) (iedit-mode) (goto-char 13) (iedit-mode 0) (should (= 4 (length iedit-occurrences-overlays))) (iedit-mode) ;;turn off iedit mode (iedit-mode) (mark-defun) (iedit-mode) (should (= 0 (length iedit-occurrences-overlays)))))) (defvar iedit-printable-test-lists '(("" "") ("abc" "abc") ("abc bcd" "abc...") ("abc\n34" "abc...") ("12345678901234567890123456789012345678901234567890abc" "12345678901234567890123456789012345678901234567890...") ("12345678901234567890123456789012345678901234567890abc abcd" "12345678901234567890123456789012345678901234567890..."))) (ert-deftest iedit-printable-test () (dolist (test iedit-printable-test-lists) (should (string= (iedit-printable (car test)) (cadr test))))) (ert-deftest iedit-hide-context-lines-test () "Test function iedit-hide-context-lines." (with-iedit-test-fixture "foo foo a foo bar a a bar foo a a a bar foo a a a a foo bar a a a a a foo" (lambda () (should (equal (iedit-hide-context-lines 0) '((64 73) (47 54) (33 38) (21 24) (9 10)))) (iedit-show-all) (should (equal (iedit-hide-context-lines 1) '((66 71) (49 52) (35 36)))) (iedit-show-all) (should (equal (iedit-hide-context-lines 2) '((68 69)) )) (iedit-show-all) (should (equal (iedit-hide-context-lines 3) nil))))) (ert-deftest iedit-hide-occurrence-lines-test () "Test function iedit-hide-occurrence-lines." (with-iedit-test-fixture "foo foo a foo bar a a bar foo a a a bar foo a a a a foo bar a a a a a foo" (lambda () (should (equal (iedit-hide-occurrence-lines) '((74 77) (55 63) (39 46) (25 32) (11 20) (1 8))))))) ;; todo add a auto performance test (setq elp-function-list '(;; insert-and-inherit ;; delete-region ;; goto-char ;; iedit-occurrence-update ;; buffer-substring-no-properties ;; string= re-search-forward ;; replace-match text-property-not-all iedit-make-occurrence-overlay iedit-make-occurrences-overlays match-beginning match-end push )) ;;; iedit-tests.el ends here iedit-0.9.9.9.9/Makefile0000644000175000017500000000212514170176532014445 0ustar dogslegdogsleg# makefile for iedit. # Emacs invocation EMACS_COMMAND := emacs EMACS := $(EMACS_COMMAND) -Q -batch EVAL := $(EMACS) --eval PKGDIR := . # Additional emacs loadpath LOADPATH := -L . # Files to compile EL := $(sort $(wildcard iedit*.el)) # Compiled files ELC := $(EL:.el=.elc) .PHONY: clean autoloads batch-compile install uninstall all: clean autoloads batch-compile $(ELC): %.elc: %.el $(EMACS) $(LOADPATH) -f batch-byte-compile $< # Compile needed files compile: $(ELC) # Compile all files at once batch-compile: $(EMACS) $(LOADPATH) -f batch-byte-compile $(EL) # Remove all generated files clean: rm -f $(ELC) # Make autoloads file autoloads: $(EVAL) "(progn (setq generated-autoload-file (expand-file-name \"iedit-autoloads.el\" \"$(PKGDIR)\")) \ (setq backup-inhibited t) (update-directory-autoloads \"$(PKGDIR)\"))" PREFIX=/usr/local/share/ DESTDIR=${PREFIX}emacs/site-lisp/iedit/ install: test -d ${DESTDIR} || mkdir ${DESTDIR} cp -vf *.el $(DESTDIR) cp -vf *.elc $(DESTDIR) cp -vf iedit-autoloads.el $(DESTDIR) uninstall: rm -vf ${DESTDIR}*.elc rm -vf ${DESTDIR}*.el iedit-0.9.9.9.9/release.sh0000755000175000017500000000143114170176532014763 0ustar dogslegdogsleg#!/bin/sh # Create a tar file from the current sources for e.g. Marmalade. VERSION="$(sed -ne 's/^;; Version: *\([0-9.]*\)/\1/p' iedit.el)" mkdir -p release mkdir -p "release/iedit-$VERSION" cp *.el README.org "release/iedit-$VERSION" echo "(define-package \"iedit\" \"$VERSION\" \"Edit multiple regions in the same way simultaneously.\" '())" > "release/iedit-$VERSION/iedit-pkg.el" AUTOLOADS="$(pwd)/release/iedit-$VERSION/iedit-autoloads.el" emacs -q --batch --eval \ "(let ((generated-autoload-file \"$AUTOLOADS\")) (batch-update-autoloads))" \ "release/iedit-$VERSION" rm -f "release/iedit-$VERSION"/*.el~ tar -C release -c "iedit-$VERSION" > "release/iedit-${VERSION}.tar" rm -rf "release/iedit-$VERSION" echo echo "Release read for upload in release/iedit-${VERSION}.tar" iedit-0.9.9.9.9/iedit-lib.el0000644000175000017500000015354414170176532015205 0ustar dogslegdogsleg;;; iedit-lib.el --- APIs for editing multiple regions in the same way ;;; simultaneously. ;; Copyright (C) 2010 - 2019, 2020, 2021 Victor Ren ;; Time-stamp: <2022-01-14 12:33:36 Victor Ren> ;; Author: Victor Ren ;; Keywords: occurrence region simultaneous rectangle refactoring ;; Version: 0.9.9.9.9 ;; X-URL: https://github.com/victorhge/iedit ;; https://www.emacswiki.org/emacs/Iedit ;; Compatibility: GNU Emacs: 22.x, 23.x, 24.x, 25.x ;; This file is not part of GNU Emacs, but it is distributed under ;; the same terms as GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . ;;; Commentary: ;; This package is iedit APIs library that allow you to write your own minor mode. ;; The functionalities of the APIs: ;; - Create occurrence overlays ;; - Navigate in the occurrence overlays ;; - Modify the occurrences ;; - Hide/show ;; - Other basic support APIs ;; ;; A few concepts that help you understand what this is about: ;; ;; Occurrence - one of the regions that are selected, highlighted, usually the ;; same and about to be modified. ;; ;; Occurrence overlay - overlay used to provide a different face for occurrence ;; ;; Occurrence line - the line that has at least one occurrence ;; ;; Context line - the line that doesn't have occurrences ;;; todo: ;; - Update comments for APIs ;; - Add more easy access keys for whole occurrence ;;; Code: (eval-when-compile (require 'cl-lib)) (require 'kmacro) (declare-function c-before-change "cc-mode.el") (defgroup iedit nil "Edit multiple regions in the same way simultaneously. The regions are usually the same, called 'occurrence' in the mode." :prefix "iedit-" :group 'replace :group 'convenience) (defface iedit-occurrence '((t :inherit highlight)) "*Face used for the occurrences' default values." :group 'iedit) (defface iedit-read-only-occurrence '((t :inherit region)) "*Face used for the read-only occurrences' default values." :group 'iedit) (defcustom iedit-case-sensitive-default t "If no-nil, matching is case sensitive." :type 'boolean :group 'iedit) (defcustom iedit-transient-mark-sensitive t "If no-nil, Iedit mode is sensitive to the Transient Mark mode. It means Iedit works as expected only when regions are highlighted. If you want to use iedit without Transient Mark mode, set it as nil." :type 'boolean :group 'iedit) (defcustom iedit-auto-buffering nil "If no-nil, iedit-mode automatically starts buffering the changes. This could be a workaround for lag problem under certain modes." :type 'boolean :group 'iedit) (defcustom iedit-overlay-priority 200 "The priority of the overlay used to indicate matches." :type 'integer :group 'iedit) (defcustom iedit-index-update-limit 200 "If the number of occurrences is great than this, the `iedit-occurrence-index' will not be updated. This is to avoid the traverse of the long `iedit-occurrences-overlays' list." :type 'integer :group 'iedit) (defcustom iedit-increment-format-string "%03d" "Format string used to format incremented numbers. This is used by `iedit-number-occurrences'." :type 'string :group 'iedit) (defvar iedit-occurrences-overlays nil "The occurrences slot contains a list of overlays used to indicate the position of each editable occurrence. In addition, the occurrence overlay is used to provide a different face configurable via `iedit-occurrence'.") (defvar iedit-read-only-occurrences-overlays nil "The occurrences slot contains a list of overlays used to indicate the position of each read-only occurrence. In addition, the occurrence overlay is used to provide a different face 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 nil and `case-replace' is no-nil, iedit try to preserve the case pattern of each occurrence.") (defvar iedit-search-invisible search-invisible "search-invisible while matching. Either nil, t, or 'open. 'open means the same as t except that opens hidden overlays. ") (defvar iedit-lib-skip-invisible-count 0 "This is buffer local variable which is the number of skipped invisible occurrence. ") (defvar iedit-lib-skip-filtered-count 0 "This is buffer local variable which is the number of filtered occurrence. ") (defvar iedit-hiding nil "This is buffer local variable which indicates whether buffer lines are hided. ") (defvar iedit-forward-success t "This is buffer local variable which indicates the moving forward or backward successful") (defvar iedit-before-modification-string "" "This is buffer local variable which is the buffer substring that is going to be changed.") (defvar iedit-before-buffering-string "" "This is buffer local variable which is the buffer substring that is going to be changed.") (defvar iedit-before-buffering-undo-list nil "This is buffer local variable which is the buffer undo list before modification.") (defvar iedit-before-buffering-point nil "This is buffer local variable which is the point before modification.") (defvar iedit-buffering-overlay nil "This is buffer local variable which is the current overlay before starting recording kmacro.") (defvar iedit-start-kmacro-offset nil "This is buffer local variable which is the offset from the current overlay start before starting recording kmacro.") ;; `iedit-record-changes' gets called twice when change==0 and ;; occurrence is zero-width (beg==end) -- for front and back insertion. (defvar iedit-skip-modification-once t "Variable used to skip first modification hook run when insertion against a zero-width occurrence.") (defvar iedit-aborting nil "This is buffer local variable which indicates Iedit mode is aborting.") (defvar iedit-lib-quit-func nil "Function to call to exit mode using `iedit-lib'. Should be set in `iedit-lib-start'.") (defvar iedit-post-undo-hook-installed nil "This is buffer local variable which indicated if `iedit-post-undo' is installed in `post-command-hook'.") (defvar iedit-buffering nil "This is buffer local variable which indicates iedit-mode is buffering, which means the modification to the current occurrence is not applied to other occurrences when it is true.") (defvar iedit-occurrence-context-lines 1 "The number of lines before or after the occurrence.") (defvar iedit-occurrence-index 0 "The index of the current occurrence, counted from the beginning of the buffer. Used in mode-line to indicate the position of the current occurrence.") (defvar iedit-after-change-list nil "Used to store the modifications in the command being run.") (defvar iedit-updating nil "Used to prevent recursive calling change hooks. It replaces `inhibit-modification-hooks' which prevents calling `after-change-functions'.") (defvar iedit-line-move-ignore-invisible-value nil "Used to save and restore the value of `line-move-ignore-invisible'.") (make-variable-buffer-local 'iedit-updating) (make-variable-buffer-local 'iedit-after-change-list) (make-variable-buffer-local 'iedit-occurrences-overlays) (make-variable-buffer-local 'iedit-read-only-occurrences-overlays) (make-variable-buffer-local 'iedit-hiding) (make-variable-buffer-local 'iedit-case-sensitive) (make-variable-buffer-local 'iedit-forward-success) (make-variable-buffer-local 'iedit-before-modification-string) (make-variable-buffer-local 'iedit-before-buffering-string) (make-variable-buffer-local 'iedit-before-buffering-undo-list) (make-variable-buffer-local 'iedit-before-buffering-point) (make-variable-buffer-local 'iedit-buffering-overlay) (make-variable-buffer-local 'iedit-start-kmacro-offset) (make-variable-buffer-local 'iedit-skip-modification-once) (make-variable-buffer-local 'iedit-aborting) (make-variable-buffer-local 'iedit-buffering) (make-variable-buffer-local 'iedit-auto-buffering) (make-variable-buffer-local 'iedit-post-undo-hook-installed) (make-variable-buffer-local 'iedit-occurrence-context-lines) (make-variable-buffer-local 'iedit-occurrence-index) (make-variable-buffer-local 'iedit-lib-quit-func) (make-variable-buffer-local 'iedit-lib-skip-invisible-count) (make-variable-buffer-local 'iedit-lib-skip-filtered-count) (make-variable-buffer-local 'iedit-line-move-ignore-invisible-value) (defconst iedit-occurrence-overlay-name 'iedit-occurrence-overlay-name) (defconst iedit-invisible-overlay-name 'iedit-invisible-overlay-name) ;;; Define Iedit mode map (defvar iedit-lib-keymap (let ((map (make-sparse-keymap))) ;; Default key bindings (define-key map (kbd "TAB") 'iedit-next-occurrence) (define-key map (kbd "") 'iedit-next-occurrence) (define-key map (kbd "") 'iedit-prev-occurrence) (define-key map (kbd "") 'iedit-prev-occurrence) (define-key map (kbd "") 'iedit-prev-occurrence) (define-key map (kbd "C-'") 'iedit-show/hide-context-lines) (define-key map (kbd "C-\"") 'iedit-show/hide-occurrence-lines) map) "Keymap used while Iedit mode is enabled.") (defvar iedit-occurrence-keymap-default (let ((map (make-sparse-keymap))) ;; `yas-minor-mode' uses tab by default and installs its keymap in ;; `emulation-mode-map-alists', which is used before before ;; ‘minor-mode-map-alist’. So TAB is bond to get used even before ;; `yas-minor-mode', to prevent overriding. (define-key map (kbd "TAB") 'iedit-next-occurrence) (define-key map (kbd "") 'iedit-next-occurrence) (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-SPC") 'iedit-blank-occurrences) (define-key map (kbd "M-D") 'iedit-delete-occurrences) (define-key map (kbd "M-N") 'iedit-number-occurrences) (define-key map (kbd "M-B") 'iedit-toggle-buffering) (define-key map [remap kmacro-start-macro-or-insert-counter] 'iedit-start-kmacro) (define-key map [remap kmacro-end-or-call-macro] 'iedit-end-and-call-kmacro) (define-key map [remap kmacro-end-and-call-macro] 'iedit-end-and-call-kmacro) (define-key map (kbd "M-<") 'iedit-goto-first-occurrence) (define-key map (kbd "M->") 'iedit-goto-last-occurrence) (define-key map (kbd "C-?") 'iedit-help-for-occurrences) (define-key map [remap keyboard-escape-quit] 'iedit--quit) (define-key map [remap keyboard-quit] 'iedit--quit) map) "Default keymap used within occurrence overlays.") ;; The declarations are to avoid compile errors if mc is unknown by Emacs. (declare-function mc/create-fake-cursor-at-point "ext:mutiple-cursors-core.el" nil) (declare-function multiple-cursors-mode "ext:mutiple-cursors-core.el") (defvar mc/cmds-to-run-once) (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 simultaneously with multiple cursors." (interactive "*") (iedit-barf-if-buffering) (let* ((ov (iedit-find-current-occurrence-overlay)) (offset (- (point) (overlay-start ov))) (master (point))) (save-excursion (dolist (occurrence iedit-occurrences-overlays) (goto-char (+ (overlay-start occurrence) offset)) (unless (= master (point)) (mc/create-fake-cursor-at-point)))) (iedit--quit) (multiple-cursors-mode 1))) ;; `multiple-cursors-mode' runs `post-command-hook' function on all the ;; cursors for updating them . `iedit-switch-to-mc-mode' is not supposed to ;; be run in mc mode. `mc/cmds-to-run-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.") (make-local-variable 'iedit-occurrence-keymap) (defun iedit-help-for-occurrences () "Display `iedit-occurrence-keymap-default'" (interactive) (message (concat (substitute-command-keys "\\[iedit-upcase-occurrences]") "/" (substitute-command-keys "\\[iedit-downcase-occurrences]") ":up/downcase " (substitute-command-keys "\\[iedit-replace-occurrences]") ":replace " (substitute-command-keys "\\[iedit-blank-occurrences]") ":blank " (substitute-command-keys "\\[iedit-delete-occurrences]") ":delete " (substitute-command-keys "\\[iedit-number-occurrences]") ":number " (substitute-command-keys "\\[iedit-toggle-buffering]") ":buffering " (substitute-command-keys "\\[iedit-goto-first-occurrence]") "/" (substitute-command-keys "\\[iedit-goto-last-occurrence]") ":first/last " ))) (defun iedit--quit () "Quit the current mode by calling mode exit function." (interactive) (when iedit-buffering ;; keep the content and quit iedit only (setq iedit-buffering nil) (when defining-kbd-macro (kmacro-keyboard-quit) (force-mode-line-update t) (setq defining-kbd-macro nil))) (funcall iedit-lib-quit-func)) (defun iedit-make-markers-overlays (markers) "Create occurrence overlays on a list of markers." (setq iedit-occurrences-overlays (mapcar #'(lambda (marker) (iedit-make-occurrence-overlay (car marker) (cdr marker))) markers))) (defun iedit-make-occurrences-overlays (occurrence-regexp beg end) "Create occurrence overlays for `occurrence-regexp' in a region. Return the number of occurrences." (setq iedit-occurrences-overlays nil) (setq iedit-read-only-occurrences-overlays nil) (setq iedit-lib-skip-invisible-count 0) (setq iedit-lib-skip-filtered-count 0) ;; Find and record each occurrence's markers and add the overlay to the occurrences (let ((counter 0) (case-fold-search (not iedit-case-sensitive)) (search-invisible iedit-search-invisible) (length 0)) (save-excursion (save-window-excursion (goto-char end) ;; todo: figure out why re-search-forward is slow without "recenter" (recenter) (goto-char beg) (while (re-search-forward occurrence-regexp end t) (let ((beginning (match-beginning 0)) (ending (match-end 0))) (if (and (> length 0) (/= (- ending beginning) length)) (throw 'not-same-length 'not-same-length) (setq length (- ending beginning))) (cond ((text-property-not-all beginning ending 'read-only nil) (push (iedit-make-read-only-occurrence-overlay beginning ending) iedit-read-only-occurrences-overlays)) ((and (not (eq search-invisible t)) (isearch-range-invisible beginning ending)) (setq iedit-lib-skip-invisible-count (1+ iedit-lib-skip-invisible-count))) ((not (funcall isearch-filter-predicate beginning ending)) (setq iedit-lib-skip-filtered-count (1+ iedit-lib-skip-filtered-count))) (t (push (iedit-make-occurrence-overlay beginning ending) iedit-occurrences-overlays) (setq counter (1+ counter)))))))) (iedit-update-index) counter)) (defun iedit-update-index (&optional point) "Update `iedit-occurrence-index' with the current occurrence, if the total number of occurrences is less than `iedit-index-update-limit'." (if (< (length iedit-occurrences-overlays) iedit-index-update-limit) (let ((pos (or point (point))) (index 0)) (dolist (occurrence iedit-occurrences-overlays) (if (>= pos (overlay-start occurrence)) (setq index (1+ index)))) (setq iedit-occurrence-index index)))) (defun iedit-add-next-occurrence-overlay (occurrence-exp &optional point) "Create next occurrence overlay for `occurrence-exp'." (iedit-add-occurrence-overlay occurrence-exp point t)) (defun iedit-add-previous-occurrence-overlay (occurrence-exp &optional point) "Create previous occurrence overlay for `occurrence-exp'." (iedit-add-occurrence-overlay occurrence-exp point nil)) (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 (setq point (point))) (let ((case-fold-search (not iedit-case-sensitive)) (pos nil)) (save-excursion (goto-char point) (if (not (if forward (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)) (error "Conflict region")) (push (iedit-make-occurrence-overlay (match-beginning 0) (match-end 0)) iedit-occurrences-overlays) (iedit-update-index point) (message "Add one match for \"%s\"." (iedit-printable occurrence-exp)) (when iedit-hiding (iedit-show-all) (iedit-hide-context-lines iedit-occurrence-context-lines)) )) pos)) ;; todo: this function is not used yet. (defun iedit-add-region-as-occurrence (beg end) "Add region as an occurrence. The length of the region must the same as other occurrences if there are." (or (= beg end) (error "No region")) (if (null iedit-occurrences-overlays) (push (iedit-make-occurrence-overlay beg end) iedit-occurrences-overlays) (or (= (- end beg) (iedit-occurrence-string-length)) (error "Wrong region")) (if (or (iedit-find-overlay-at-point beg 'iedit-occurrence-overlay-name) (iedit-find-overlay-at-point end 'iedit-occurrence-overlay-name)) (error "Conflict region")) (push (iedit-make-occurrence-overlay beg end) iedit-occurrences-overlays) (iedit-update-index) )) ;; todo test this function (defun iedit-lib-start (mode-exit-func) "Initialize the hooks." (when iedit-auto-buffering (iedit-start-buffering)) (setq iedit-aborting nil) ;; Enforce skip modification once, errors may happen to cause this to be ;; unset. (setq iedit-skip-modification-once t) (setq iedit-lib-quit-func mode-exit-func) (add-hook 'post-command-hook 'iedit-update-occurrences nil t) (add-hook 'before-revert-hook iedit-lib-quit-func nil t) ;; (add-hook 'kbd-macro-termination-hook iedit-lib-quit-func nil t) (add-hook 'change-major-mode-hook iedit-lib-quit-func nil t) (setq iedit-after-change-list nil)) (defun iedit-lib-cleanup () "Clean up occurrence overlay, invisible overlay and local variables." (when iedit-buffering (if defining-kbd-macro (progn (kmacro-end-macro nil) (setq iedit-buffering nil) (iedit--apply-kmacro)) (iedit-stop-buffering))) (iedit-cleanup-occurrences-overlays) (remove-hook 'post-command-hook 'iedit-update-occurrences t) (remove-hook 'before-revert-hook iedit-lib-quit-func t) ;; (remove-hook 'kbd-macro-termination-hook iedit-lib-quit-func t) (remove-hook 'change-major-mode-hook iedit-lib-quit-func t) (setq iedit-lib-quit-func nil) (setq iedit-occurrences-overlays nil) (setq iedit-read-only-occurrences-overlays nil) (setq iedit-aborting nil) (setq iedit-before-modification-string "") (setq iedit-before-buffering-undo-list nil) (setq iedit-hiding nil)) (defun iedit-make-occurrence-overlay (begin end) "Create an overlay for an occurrence in Iedit mode. Add the properties for the overlay: a face used to display a occurrence's default value, and modification hooks to update occurrences if the user starts typing." (let ((occurrence (make-overlay begin end (current-buffer) nil t))) (overlay-put occurrence iedit-occurrence-overlay-name t) (overlay-put occurrence 'face 'iedit-occurrence) (overlay-put occurrence 'keymap iedit-occurrence-keymap) (overlay-put occurrence 'insert-in-front-hooks '(iedit-record-changes)) (overlay-put occurrence 'insert-behind-hooks '(iedit-record-changes)) (overlay-put occurrence 'modification-hooks '(iedit-record-changes)) (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-pattern begin end) 'no-change)) occurrence)) (defun iedit-make-read-only-occurrence-overlay (begin end) "Create an overlay for an read-only occurrence in Iedit mode." (let ((occurrence (make-overlay begin end (current-buffer) nil t))) (overlay-put occurrence iedit-occurrence-overlay-name t) (overlay-put occurrence 'face 'iedit-read-only-occurrence) occurrence)) (defun iedit-make-invisible-overlay (begin end) "Create an invisible overlay from `begin` to `end`." (let ((invisible-overlay (make-overlay begin end (current-buffer) nil t))) (overlay-put invisible-overlay iedit-invisible-overlay-name t) (overlay-put invisible-overlay 'invisible 'iedit-invisible-overlay-name) ;; (overlay-put invisible-overlay 'intangible t) invisible-overlay)) (defun iedit-post-undo () "Check if it is time to abort iedit after undo command is executed. This is added to `post-command-hook' when undo command is executed in occurrences." (if (iedit-same-length) nil (iedit--quit)) (remove-hook 'post-command-hook 'iedit-post-undo t) (setq iedit-post-undo-hook-installed nil)) (defun iedit-reset-aborting () "Turning Iedit mode off and reset `iedit-aborting'. This is added to `post-command-hook' when aborting Iedit mode is decided. `iedit-lib-quit-func' is postponed after the current command is executed for avoiding `iedit-record-changes' is called for a removed overlay." (iedit--quit) (remove-hook 'post-command-hook 'iedit-reset-aborting t) (setq iedit-aborting nil)) ;; There are two ways to update all occurrences. One is to redefine all key ;; stroke map for overlay, the other is to figure out three basic modifications ;; in the modification hook. This function chooses the latter. (defun iedit-record-changes (occurrence after beg end &optional change) "Record the changes to the current occurrence. This modification hook is triggered when a user edits any occurrence and is responsible for recording all the changes to the current occurrence. Refer to `modification-hooks' for more details. Current supported edits are insertion, yank, deletion and replacement. If this modification is going out of the occurrence, it will abort Iedit mode." (if (and undo-in-progress (null iedit-after-change-list)) ;; If the "undo" change (not part of another command) make occurrences ;; different, it is going to mess up occurrences. So a length check will ;; be done after undo command is executed. (when (not iedit-post-undo-hook-installed) (add-hook 'post-command-hook 'iedit-post-undo nil t) (setq iedit-post-undo-hook-installed t)) (when (and (not iedit-updating) (not iedit-aborting)) ;; before modification (if (null after) (if (or (< beg (overlay-start occurrence)) (> end (overlay-end occurrence))) (progn (setq iedit-aborting t) ; abort iedit-mode (add-hook 'post-command-hook 'iedit-reset-aborting nil t)) (setq iedit-before-modification-string (buffer-substring-no-properties beg end)) ;; Check if this is called twice before modification. When inserting ;; into zero-width occurrence or between two conjoined occurrences, ;; both insert-in-front-hooks and insert-behind-hooks will be ;; called. Two calls will make `iedit-skip-modification-once' true. (setq iedit-skip-modification-once (not iedit-skip-modification-once))) ;; after modification (if iedit-skip-modification-once ;; Skip the first hook (setq iedit-skip-modification-once nil) (setq iedit-skip-modification-once t) (when (and (not iedit-buffering) (not iedit-updating)) (when (or (eq 0 change) ;; insertion (eq beg end) ;; deletion (not (string= iedit-before-modification-string ;; replacement (buffer-substring-no-properties beg end)))) (let* ((inslen (- end beg)) (dellen change)) (push (list occurrence (- beg (overlay-start occurrence)) ; From 1 to beg (- (overlay-end occurrence) end) ; From end to point-max (- inslen dellen)) ; changed number iedit-after-change-list))))))))) (defun iedit-update-occurrences () "Updating other occurrences. This part is running in `post-command-hook'. It combines `iedit-after-change-list' into one change and apply it to all the other occurrences." (when (and (not iedit-updating) iedit-after-change-list) (let ((occurrence (caar iedit-after-change-list)) (beg (buffer-size)) (end (buffer-size)) (change 0)) (dolist (mod iedit-after-change-list) (setq beg (min beg (nth 1 mod))) (setq end (min end (nth 2 mod))) (setq change (+ change (nth 3 mod)))) (let* ((begpos (+ (overlay-start occurrence) beg)) (endpos (- (overlay-end occurrence) end)) (inslen (- endpos begpos)) (dellen (- inslen change)) (endpos (+ begpos inslen))) (iedit-apply-change occurrence begpos endpos dellen) (setq iedit-after-change-list nil))))) (defun iedit-apply-change (occurrence beg end &optional change) "Apply the change to all the other occurrences. " (let ((iedit-updating t) (offset (- beg (overlay-start occurrence))) (value (buffer-substring-no-properties beg end))) (save-excursion (iedit-move-conjoined-overlays occurrence) (when (/= beg end) ;; apply the case pattern on the current occurrence (cl-case (overlay-get occurrence 'category) (all-caps (upcase-region beg end)) (cap-initial (when (= 0 offset) (capitalize-region beg end ))))) (dolist (another-occurrence iedit-occurrences-overlays) (when (not (eq another-occurrence occurrence)) (let* ((beginning (+ (overlay-start another-occurrence) offset)) (ending (+ beginning (- end beg)))) (when (/= 0 change) (delete-region beginning (+ beginning change))) ;; delete (when (/= beg end) ;; insert (goto-char beginning) (insert-and-inherit ;; preserve the case pattern of each occurrence (cl-case (overlay-get another-occurrence 'category) (no-change value) (all-caps (upcase value)) (cap-initial (if (= 0 offset) (capitalize value) value)))))) (iedit-move-conjoined-overlays another-occurrence)))))) (defun iedit-next-occurrence (&optional arg) "Move forward to the next occurrence in the `iedit'. Move ARG occurrences forward (backward if ARG is negative). Interactively, ARG is the numeric prefix argument. If ARG is omitted or nil, move 1 occurrences forward. If point reaches the last occurrences, you are asked to type another `iedit-next-occurrence', it starts again from the beginning of the buffer. If used with prefix argument, wrapping from last to first occurrence will cost one repetition." (interactive "p") (cond ((< arg 0) (iedit-prev-occurrence (abs arg))) ((> arg 0) (dotimes (i arg) (let* ((pos (point)) (ov (iedit-find-current-occurrence-overlay))) (if ov (if (iedit-find-overlay-at-point (overlay-end ov) 'iedit-occurrence-overlay-name) (setq pos (overlay-end ov)) ; conjoined overlay ;; from inside (setq pos (next-single-char-property-change pos 'iedit-occurrence-overlay-name)) (setq pos (next-single-char-property-change pos 'iedit-occurrence-overlay-name))) ;; from outside (setq pos (next-single-char-property-change pos 'iedit-occurrence-overlay-name))) (if (/= pos (point-max)) (setq iedit-forward-success t) (if (and iedit-forward-success ov) (progn (message "This is the last occurrence.") (setq iedit-forward-success nil)) (progn (if (get-char-property (point-min) 'iedit-occurrence-overlay-name) (setq pos (point-min)) (setq pos (next-single-char-property-change (point-min) 'iedit-occurrence-overlay-name))) (setq iedit-forward-success t) (message "Located the first occurrence.")))) (when iedit-forward-success (iedit-update-index pos) (goto-char pos))))))) (defun iedit-prev-occurrence (&optional arg) "Move backward to the previous occurrence in the `iedit'. Move ARG occurrences backward (forward if ARG is negative). Interactively, ARG is the numeric prefix argument. If ARG is omitted or nil, move 1 occurrences back. If point reaches the first occurrences, you are asked to type another `iedit-prev-occurrence', it starts again from the end of the buffer. If used with prefix argument, wrapping from first to last occurrence will cost one repetition." (interactive "p") (cond ((< arg 0) (iedit-next-occurrence (abs arg))) ((> arg 0) (dotimes (i arg) (let ((pos (point)) (ov (iedit-find-current-occurrence-overlay)) (previous-overlay)) (when (/= pos (point-min)) (when ov (setq pos (overlay-start ov))) (if (and ov (setq previous-overlay (iedit-find-overlay-at-point (1- pos) 'iedit-occurrence-overlay-name))) (setq pos (overlay-start previous-overlay)) ;conjoined (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 (if (or (and (eq pos (point-min)) (not (get-char-property (point-min) 'iedit-occurrence-overlay-name))) (and (eq (point) (point-min)) ov)) (if (and iedit-forward-success ov) (progn (message "This is the first occurrence.") (setq iedit-forward-success nil)) (progn (setq pos (iedit-last-occurrence)) (setq iedit-forward-success t) (message "Located the last occurrence."))) (setq iedit-forward-success t)) (when iedit-forward-success (iedit-update-index pos) (goto-char pos))))))) (defun iedit-first-occurrence () "return the position of the first occurrence." (if (get-char-property (point-min) 'iedit-occurrence-overlay-name) (point-min) (next-single-char-property-change (point-min) 'iedit-occurrence-overlay-name))) (defun iedit-goto-first-occurrence () "Move to the first occurrence." (interactive) (goto-char (iedit-first-occurrence)) (setq iedit-forward-success t) (setq iedit-occurrence-index 1) (message "Located the first occurrence.")) (defun iedit-goto-last-occurrence () "Move to the last occurrence." (interactive) (goto-char (iedit-last-occurrence)) (setq iedit-forward-success t) (setq iedit-occurrence-index (length iedit-occurrences-overlays)) (message "Located the last occurrence.")) (defun iedit-last-occurrence () "return the position of the last occurrence." (let ((ov (iedit-find-overlay-at-point (1- (point-max)) 'iedit-occurrence-overlay-name)) (pos (point-max))) (if ov (overlay-start ov) (setq pos (previous-single-char-property-change pos 'iedit-occurrence-overlay-name)) (overlay-start (iedit-find-overlay-at-point (1- pos) 'iedit-occurrence-overlay-name))))) (defun iedit-show/hide-context-lines (&optional arg) "Show or hide context lines. A prefix ARG specifies how many lines before and after the occurrences are not hidden; negative is treated the same as zero. If no prefix argument, the prefix argument last time or default value of `iedit-occurrence-context-lines' is used for this time." (interactive "P") (if (null arg) ;; toggle visible (progn (setq iedit-hiding (not iedit-hiding)) (if iedit-hiding (iedit-hide-context-lines iedit-occurrence-context-lines) (iedit-show-all))) ;; reset invisible lines (setq arg (prefix-numeric-value arg)) (if (< arg 0) (setq arg 0)) (unless (and iedit-hiding (= arg iedit-occurrence-context-lines)) (when iedit-hiding (remove-overlays nil nil iedit-invisible-overlay-name t)) (setq iedit-occurrence-context-lines arg) (setq iedit-hiding t) (iedit-hide-context-lines iedit-occurrence-context-lines)))) (defun iedit-show-all() "Show hidden lines." (setq-local line-move-ignore-invisible iedit-line-move-ignore-invisible-value) (remove-from-invisibility-spec '(iedit-invisible-overlay-name . t)) (remove-overlays nil nil iedit-invisible-overlay-name t)) (defun iedit-hide-context-lines (visible-context-lines) "Hide context lines using invisible overlay." (let ((prev-occurrence-end 1) (hidden-regions nil)) (save-excursion (goto-char (iedit-first-occurrence)) (while (/= (point) (point-max)) ;; Now at the beginning of an occurrence (let ((current-start (point))) (forward-line (- visible-context-lines)) (let ((line-beginning (line-beginning-position))) (if (> line-beginning prev-occurrence-end) (push (list prev-occurrence-end (1- line-beginning)) hidden-regions))) ;; goto the end of the occurrence (goto-char (next-single-char-property-change current-start 'iedit-occurrence-overlay-name))) (let ((current-end (point))) (forward-line visible-context-lines) (setq prev-occurrence-end (1+ (line-end-position))) ;; goto the beginning of next occurrence (goto-char (next-single-char-property-change current-end 'iedit-occurrence-overlay-name)))) (if (< prev-occurrence-end (point-max)) (push (list prev-occurrence-end (point-max)) hidden-regions)) (when hidden-regions (setq iedit-line-move-ignore-invisible-value (buffer-local-value 'line-move-ignore-invisible (current-buffer))) (setq-local line-move-ignore-invisible t) (add-to-invisibility-spec '(iedit-invisible-overlay-name . t)) (dolist (region hidden-regions) (iedit-make-invisible-overlay (car region) (cadr region))))) hidden-regions)) ;;;; functions for overlay keymap (defun iedit-hide-occurrence-lines () "Hide occurrence lines using invisible overlay." (let ((hidden-regions nil) (beginning nil) (end nil)) (save-excursion (goto-char (iedit-first-occurrence)) ;; Now at the beginning of an occurrence (setq beginning (line-beginning-position)) (while (/= (point) (point-max)) ;; goto the end of the occurrence (goto-char (next-single-char-property-change (point) 'iedit-occurrence-overlay-name)) (setq end (line-end-position)) ;; goto the next beginning of the occurrence (goto-char (next-single-char-property-change (point) 'iedit-occurrence-overlay-name)) (when (or (> (line-beginning-position) (1+ end)) (= (line-end-position) (point-max))) (push (list beginning end) hidden-regions) (setq beginning (line-beginning-position))))) (when hidden-regions (setq iedit-line-move-ignore-invisible-value (buffer-local-value 'line-move-ignore-invisible (current-buffer))) (setq-local line-move-ignore-invisible t) (dolist (region hidden-regions) (iedit-make-invisible-overlay (car region) (cadr region)))) ;; Value returned is for ert hidden-regions)) (defun iedit-show/hide-occurrence-lines () "Show or hide occurrence lines using invisible overlay." (interactive "*") (setq iedit-hiding (not iedit-hiding)) (if (not iedit-hiding) (iedit-show-all) (iedit-hide-occurrence-lines))) (defun iedit-apply-on-occurrences (function &rest args) "Call function for each occurrence." (let ((iedit-updating t)) (save-excursion (dolist (occurrence iedit-occurrences-overlays) (apply function (overlay-start occurrence) (overlay-end occurrence) args))))) (defun iedit-upcase-occurrences () "Convert occurrences to upper case." (interactive "*") (iedit-barf-if-buffering) (iedit-apply-on-occurrences 'upcase-region)) (defun iedit-downcase-occurrences() "Convert occurrences to lower case." (interactive "*") (iedit-barf-if-buffering) (iedit-apply-on-occurrences 'downcase-region)) (defun iedit-number-occurrences (start-at &optional format-string) "Insert numbers in front of the occurrences. START-AT, if non-nil, should be a number from which to begin counting. FORMAT, if non-nil, should be a format string to pass to `format-string' along with the line count. When called interactively with a prefix argument, prompt for START-AT and FORMAT." (interactive (if current-prefix-arg (let* ((start-at (read-number "Number to count from: " 1))) (list start-at (read-string (format "Format incremented numbers (default '%s'): " iedit-increment-format-string) nil nil iedit-increment-format-string))) (list 1 iedit-increment-format-string))) (iedit-barf-if-buffering) (let ((number start-at) (iedit-updating t)) (save-excursion (goto-char (iedit-first-occurrence)) (cl-loop for counter from number for ov = (iedit-find-current-occurrence-overlay) while (/= (point) (point-max)) do (progn (if (re-search-forward "\\\\#" (overlay-end ov) t) (replace-match (format format-string counter) t) (insert (format format-string counter))) (iedit-move-conjoined-overlays ov) ;; goto the beginning of the next occurrence overlay (if (iedit-find-overlay-at-point (overlay-end ov) 'iedit-occurrence-overlay-name) (goto-char (overlay-end ov)) ; conjoined overlay (when (< (point) (overlay-end ov)) (goto-char (next-single-char-property-change (point) 'iedit-occurrence-overlay-name))) (goto-char (next-single-char-property-change (point) 'iedit-occurrence-overlay-name)))))))) ;;; Don't downcase from-string to allow case freedom! (defun iedit-replace-occurrences(&optional to-string) "Replace occurrences with STRING." (interactive "*") (iedit-barf-if-buffering) (let* ((ov (iedit-find-current-occurrence-overlay)) (offset (- (point) (overlay-start ov))) (from-string (buffer-substring-no-properties (overlay-start ov) (overlay-end ov))) (to-string (if (not to-string) (read-string "Replace with: " nil nil from-string nil) to-string))) (iedit-apply-on-occurrences (lambda (beg end from-string to-string) (goto-char beg) (search-forward from-string end) (replace-match to-string (not (and (not iedit-case-sensitive) case-replace)))) from-string to-string) (goto-char (+ (overlay-start ov) offset)))) (defun iedit-blank-occurrences() "Replace occurrences with blank spaces." (interactive "*") (iedit-barf-if-buffering) (let* ((ov (car iedit-occurrences-overlays)) (offset (- (point) (overlay-start ov))) (count (- (overlay-end ov) (overlay-start ov)))) (iedit-apply-on-occurrences (lambda (beg end ) (delete-region beg end) (goto-char beg) (insert-and-inherit (make-string count 32)))) (goto-char (+ (overlay-start ov) offset)))) (defun iedit-delete-occurrences() "Delete occurrences." (interactive "*") (iedit-barf-if-buffering) (iedit-apply-on-occurrences 'delete-region)) (defun iedit-toggle-buffering () "Toggle buffering. This is intended to improve iedit's response time. If the number of occurrences are huge, it might be slow to update all the occurrences for each key stoke. When buffering is on, modification is only applied to the current occurrence and will be applied to other occurrences when buffering is off." (interactive "*") (if iedit-buffering (iedit-stop-buffering) (iedit-start-buffering))) (defun iedit-start-buffering () "Start buffering." (setq iedit-buffering t) (setq iedit-before-buffering-string (iedit-current-occurrence-string)) (setq iedit-before-buffering-undo-list buffer-undo-list) (setq iedit-before-buffering-point (point)) (setq iedit-buffering-overlay (iedit-find-current-occurrence-overlay)) (message "Start buffering editing...")) (defun iedit-start-kmacro () "Start recording subsequent keyboard input, defining a keyboard macro. The relative position of the current occurrence is remembered." (interactive) (iedit-barf-if-buffering) (setq iedit-buffering t) (setq iedit-buffering-overlay (iedit-find-current-occurrence-overlay)) (setq iedit-start-kmacro-offset (- (point) (overlay-start iedit-buffering-overlay))) (let ((map (make-sparse-keymap))) (define-key map [remap kmacro-end-or-call-macro] 'iedit-end-and-call-kmacro) (set-transient-map map (lambda () iedit-buffering))) (kmacro-start-macro nil) (message "Start recording keyboard input...")) (defun iedit-end-and-call-kmacro (arg &optional no-repeat) "Call last keyboard macro, ending it first if currently being defined, apply it on all the occurrences. If iedit is buffering, call it only once. If the defining macro was not started from `iedit-start-macro', end it only. This command is intended to eliminate a restriction of other commands - modifications allowed only inside of occurrences. The recorded modifications can be outside of the occurrences. The cursor is moved to the relative position of every occurrence before calling the last keyboard macro." (interactive "P") (cond ((and iedit-buffering (not defining-kbd-macro)) (kmacro-call-macro arg no-repeat)) ((and defining-kbd-macro (null iedit-buffering-overlay)) (kmacro-end-macro arg)) (t (if (and (not defining-kbd-macro) (null iedit-buffering-overlay)) (setq iedit-start-kmacro-offset (- (point) (overlay-start (iedit-find-current-occurrence-overlay)))) ;; (and defining-kbd-macro iedit-buffering-overlay) iedit-start-kmacro was called (kmacro-end-macro nil) (setq iedit-buffering nil)) (iedit--apply-kmacro) (setq iedit-buffering-overlay nil) (if (iedit-same-length) nil (iedit--quit) (message "Abort Iedit mode due to different change made to occurrences."))))) (defun iedit--apply-kmacro () "Apply last keyboard macro on all the occurrences." (let ((iedit-updating t)) (save-excursion (when iedit-buffering-overlay (iedit-move-conjoined-overlays iedit-buffering-overlay)) (dolist (another-occurrence iedit-occurrences-overlays) (when (not (eq another-occurrence iedit-buffering-overlay)) (goto-char (+ (overlay-start another-occurrence) iedit-start-kmacro-offset)) (kmacro-call-macro nil t) (iedit-move-conjoined-overlays another-occurrence))) ) (message "Keyboard macro applied to the occurrences."))) (defun iedit-case-pattern (beg end) "Distinguish the case pattern of the text between `beg' and `end'. These case patterns are the same as the ones Emacs replace commands can recognized - three alternatives - all caps, capitalized, the others. If the text has only capital letters and has at least one multi letter word, it is 'all caps'. If all words are capitalized, it is capitalized.'" (let ((some-word nil) (some-lowercase nil) (some-uppercase nil) (some-non-uppercase-init nil) (previous-char ?\n) (char nil) (index 0) (text (buffer-substring beg end))) (while (< index (- end beg)) (setq char (elt text index)) (if (and (= char (downcase char)) (/= char (upcase char))) (progn (setq some-lowercase t) (if (/= ?w (char-syntax previous-char)) (setq some-non-uppercase-init t) (setq some-word t))) (if (/= char (downcase char)) (progn (setq some-uppercase t) (when (= ?w (char-syntax previous-char)) (setq some-word t))) (when (/= ?w (char-syntax previous-char)) (setq some-non-uppercase-init t)))) (setq previous-char char) (setq index (1+ index))) (if (and (null some-lowercase) some-word) 'all-caps (if (and (null some-non-uppercase-init) some-word) 'cap-initial (if (and (null some-non-uppercase-init) some-uppercase) 'all-caps 'no-change))))) (defun iedit-stop-buffering () "Stop buffering and apply the modification to other occurrences." (let ((ov iedit-buffering-overlay)) (let* ((beg (overlay-start ov)) (end (overlay-end ov)) (modified-string (buffer-substring-no-properties beg end)) (offset (- (point) beg)) ;; delete-region moves cursor (iedit-updating t)) (when (not (string= iedit-before-buffering-string modified-string)) (save-excursion ;; Rollback the current modification and buffer-undo-list. This is ;; to avoid the inconsistency if user undoes modifications (delete-region beg end) (goto-char beg) (insert-and-inherit iedit-before-buffering-string) (goto-char iedit-before-buffering-point) ;; (buffer-enable-undo) (setq buffer-undo-list iedit-before-buffering-undo-list) ;; go back here if undo (push (point) buffer-undo-list) (dolist (occurrence iedit-occurrences-overlays) ; todo:extract as a function (let ((beginning (overlay-start occurrence)) (ending (overlay-end occurrence))) (delete-region beginning ending) (unless (eq beg end) ;; replacement (goto-char beginning) (insert-and-inherit (cl-case (overlay-get occurrence 'category) (all-caps (upcase modified-string)) (cap-initial (if (= 0 offset) (capitalize modified-string) modified-string)) (t modified-string)))) (iedit-move-conjoined-overlays occurrence)))) (goto-char (+ (overlay-start ov) offset)) (message "Buffered modification applied.")))) (setq iedit-buffering nil) (setq iedit-before-buffering-undo-list nil) (setq iedit-buffering-overlay nil)) (defun iedit-move-conjoined-overlays (occurrence) "This function keeps overlays conjoined after modification. After modification, conjoined overlays may be overlapped." (let ((beginning (overlay-start occurrence)) (ending (overlay-end occurrence))) (unless (= beginning (point-min)) (let ((previous-overlay (iedit-find-overlay-at-point (1- beginning) 'iedit-occurrence-overlay-name))) (if previous-overlay ; two conjoined occurrences (move-overlay previous-overlay (overlay-start previous-overlay) beginning)))) (unless (= ending (point-max)) (let ((next-overlay (iedit-find-overlay-at-point ending 'iedit-occurrence-overlay-name))) (if next-overlay ; two conjoined occurrences (move-overlay next-overlay ending (overlay-end next-overlay))))))) ;;; help functions (defun iedit-find-current-occurrence-overlay () "Return the current occurrence overlay at point or point - 1. This function is supposed to be called in overlay keymap." (or (iedit-find-overlay-at-point (point) 'iedit-occurrence-overlay-name) (iedit-find-overlay-at-point (1- (point)) 'iedit-occurrence-overlay-name))) (defun iedit-find-overlay-at-point (point property) "Return the overlay with PROPERTY at POINT." (let ((overlays (overlays-at point)) found) (while (and overlays (not found)) (let ((overlay (car overlays))) (if (overlay-get overlay property) (setq found overlay) (setq overlays (cdr overlays))))) found)) (defun iedit-same-column () "Return t if all occurrences are at the same column." (save-excursion (let ((column (progn (goto-char (overlay-start (car iedit-occurrences-overlays))) (current-column))) (overlays (cdr iedit-occurrences-overlays)) (same t)) (while (and overlays same) (let ((overlay (car overlays))) (if (/= (progn (goto-char (overlay-start overlay)) (current-column)) column) (setq same nil) (setq overlays (cdr overlays))))) same))) (defun iedit-same-length () "Return t if all occurrences are the same length." (save-excursion (let ((length (iedit-occurrence-string-length)) (overlays (cdr iedit-occurrences-overlays)) (same t)) (while (and overlays same) (let ((ov (car overlays))) (if (/= (- (overlay-end ov) (overlay-start ov)) length) (setq same nil) (setq overlays (cdr overlays))))) same))) ;; This function might be called out of any occurrence (defun iedit-current-occurrence-string () "Return current occurrence string. Return nil if occurrence string is empty string." (let ((ov (or (iedit-find-current-occurrence-overlay) (car iedit-occurrences-overlays)))) (if ov (let ((beg (overlay-start ov)) (end (overlay-end ov))) (if (/= beg end) (buffer-substring-no-properties beg end) nil)) nil))) (defun iedit-occurrence-string-length () "Return the length of current occurrence string." (let ((ov (car iedit-occurrences-overlays))) (- (overlay-end ov) (overlay-start ov)))) (defun iedit-find-overlay (beg end property &optional exclusive) "Return a overlay with property in region, or out of the region if EXCLUSIVE is not nil." (if exclusive (or (iedit-find-overlay-in-region (point-min) beg property) (iedit-find-overlay-in-region end (point-max) property)) (iedit-find-overlay-in-region beg end property))) (defun iedit-find-overlay-in-region (beg end property) "Return a overlay with property in region." (let ((overlays (overlays-in beg end)) found) (while (and overlays (not found)) (let ((overlay (car overlays))) (if (and (overlay-get overlay property) (>= (overlay-start overlay) beg) (<= (overlay-end overlay) end)) (setq found overlay) (setq overlays (cdr overlays))))) found)) (defun iedit-cleanup-occurrences-overlays (&optional beg end inclusive) "Remove overlays from list `iedit-occurrences-overlays'." ;; Close overlays opened by `isearch-range-invisible' (isearch-clean-overlays) (when iedit-hiding (iedit-show-all)) (if (null beg) (remove-overlays nil nil iedit-occurrence-overlay-name t) (if inclusive (remove-overlays beg end iedit-occurrence-overlay-name t) (remove-overlays (point-min) beg iedit-occurrence-overlay-name t) (remove-overlays end (point-max) iedit-occurrence-overlay-name t)) (let (overlays) (dolist (overlay iedit-occurrences-overlays) (if (overlay-buffer overlay) (push overlay overlays))) (setq iedit-occurrences-overlays overlays) (iedit-update-index)))) (defun iedit-printable (string) "Return a omitted substring that is not longer than 50. STRING is already `regexp-quote'ed" (let ((first-newline-index (string-match "$" string)) (length (length string))) (if (and first-newline-index (/= first-newline-index length)) (if (< first-newline-index 50) (concat (substring string 0 first-newline-index) "...") (concat (substring string 0 50) "...")) (if (> length 50) (concat (substring string 0 50) "...") string)))) (defun iedit-char-at-bol (&optional N) "Get char position of the beginning of the current line. If `N' is given, move forward (or backward) that many lines (using `forward-line') and get the char position at the beginning of that line." (save-excursion (forward-line (if N N 0)) (point))) (defun iedit-char-at-eol (&optional N) "Get char position of the end of the current line. If `N' is given, move forward (or backward) that many lines (using `forward-line') and get the char position at the end of that line." (save-excursion (forward-line (if N N 0)) (end-of-line) (point))) (defun iedit-region-active () "Return t if region is active and not empty. If variable `iedit-transient-mark-sensitive' is t, active region means `transient-mark-mode' is on and mark is active. Otherwise, it just means mark is active." (and (if iedit-transient-mark-sensitive transient-mark-mode t) mark-active (not (equal (mark) (point))))) (defun iedit-barf-if-lib-active() "Signal error if Iedit lib is active." (or (and (null iedit-occurrences-overlays) (null iedit-read-only-occurrences-overlays)) (error "Iedit lib is active"))) (defun iedit-barf-if-buffering() "Signal error if Iedit lib is buffering." (or (null iedit-buffering) (error "Iedit is buffering"))) (provide 'iedit-lib) ;;; iedit-lib.el ends here ;; LocalWords: iedit el MERCHANTABILITY kbd isearch todo ert Lindberg Tassilo ;; LocalWords: eval rect defgroup defcustom boolean defvar assq alist nconc ;; LocalWords: substring cadr keymap defconst purecopy bkm defun princ prev ;; LocalWords: iso lefttab backtab upcase downcase concat setq autoload arg ;; LocalWords: refactoring propertize cond goto nreverse progn rotatef eq elp ;; LocalWords: dolist pos unmatch args ov sReplace iedit's cdr quote'ed yas ;; LocalWords: defface alists SPC mc cmds iedit-0.9.9.9.9/iedit.el0000755000175000017500000010203114170176532014425 0ustar dogslegdogsleg;;; iedit.el --- Edit multiple regions in the same way simultaneously. ;; Copyright (C) 2010 - 2019, 2020, 2021 Victor Ren ;; Time-stamp: <2022-01-14 12:33:25 Victor Ren> ;; Author: Victor Ren ;; Keywords: occurrence region simultaneous refactoring ;; Version: 0.9.9.9.9 ;; X-URL: https://github.com/victorhge/iedit ;; https://www.emacswiki.org/emacs/Iedit ;; Compatibility: GNU Emacs: 22.x, 23.x, 24.x, 25.x ;; This file is not part of GNU Emacs, but it is distributed under ;; the same terms as GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . ;;; Commentary: ;; 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 point to a target by `isearch' or other moving commands ;; ;; - Press C-;(The default key binding) to enable Iedit mode. The thing under ;; the point is recognized as an occurrence, and all the occurrences in the ;; buffer are highlighted ;; - Edit one of the occurrences ;; The change is applied to other occurrences simultaneously. ;; - Finish - by pressing C-; again ;; Many other work flows to highlight occurrences are possible, for example, ;; rectangle selection, incremental selection and markup tag pair selection. ;; You can also use Iedit mode as a quick way to temporarily show only the ;; 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. ;; `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 ;; - With digit prefix argument 0, only occurrences in current function are matched ;; - Last renaming refactoring is remembered and can be applied to other buffers ;; later ;; - Once in iedit mode, you can select a region and hit C-; again to restrict ;; the search area to the region ;; - Restricting the search area to just the current line can be done by ;; pressing M-I. ;; - 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 ;; argument to go the opposite direction. ;; Iedit-rectangle-mode provides rectangle support with *visible rectangle* ;; highlighting, which is similar with cua mode rectangle support. But it's ;; lighter weight and uses iedit mechanisms. ;; There are also some other facilities you may never think about. Refer to the ;; document of function `iedit-mode' (C-h f iedit-mode RET) for more details. ;;; Contributors ;; Adam Lindberg added a case sensitivity option that can be toggled. ;; Tassilo Horn added an option to match only complete ;; words, not inside words ;; Le Wang proposed to match only complete symbols, not ;; inside symbols, contributed rectangle support ;;; Code: (eval-when-compile (require 'cl-lib) (require 'sgml-mode)) (require 'iedit-lib) (defcustom iedit-toggle-key-default (kbd "C-;") "If no-nil, the key is inserted into global-map, isearch-mode-map, esc-map and help-map." :type 'vector :group 'iedit) (defvar iedit-mode-hook nil "Function(s) to call after starting up an iedit.") (defvar iedit-mode-end-hook nil "Function(s) to call after terminating an iedit.") (defvar iedit-mode nil) ;; Name of the minor mode (defcustom iedit-auto-narrow nil "If no-nil, the buffer is narrowed temporarily if iedit-mode is enabled on current defun." :type 'boolean :group 'iedit) (defcustom iedit-auto-save-occurrence-in-kill-ring t "If no-nil, save the occurrence in the kill ring when exiting from iedit mode." :type 'boolean :group 'iedit) (defvar iedit-is-narrowed nil "This is buffer local variable which indicates if the buffer is narrowed by iedit temporarily.") (defvar iedit-use-symbol-boundaries t "If no-nil, matches have to start and end at symbol boundaries. Otherwise, matches starts and end at word boundaries.") (defvar iedit-occurrence-type-local 'symbol "This is buffer local variable which indicates the occurrence type. It might be (symbol word email url markup-tag regexp selection other).") (defvar iedit-occurrence-type-global 'symbol "This is global variable which indicates the last global occurrence type. It might be (symbol word email url markup-tag regexp selection other).") (defvar iedit-last-occurrence-local nil "This is buffer local variable which is the occurrence when Iedit mode is turned off last time.") (defvar iedit-last-occurrence-global nil "This is global variable which is the occurrence when Iedit mode is turned off last time.") (defvar iedit-last-initial-string-global nil "This is a global variable which is the last initial occurrence string.") (defvar iedit-initial-string-local nil "This is buffer local variable which is the initial string to start Iedit mode.") (defvar iedit-initial-region nil "This is buffer local variable which is the initial region where Iedit mode is started from.") (defvar iedit-num-lines-to-expand-up 0 "This is a global variable indicating how many lines up from point should be included in the replacement region.") (defvar iedit-num-lines-to-expand-down 0 "This is a global variable indicating how many lines down from point should be included in the replacement region.") (defvar iedit-default-occurrence-local nil "This is a function which returns a string as occurrence candidate. It is called in `iedit-default-occurrence'. This buffer local variable can be configured in some modes. An example of how to use this variable: (add-hook 'perl-mode-hook '(lambda () (setq iedit-default-occurrence-local '(lambda () (let* ((bound (bounds-of-thing-at-point 'symbol)) (prefix-char (char-after (1- (car bound))))) (if (memq prefix-char '(?$ ?% ?@ ?*)) (progn (setq iedit-occurrence-type-local 'regexp) (concat (regexp-quote (buffer-substring-no-properties (1- (car bound)) (cdr bound))) \"\\\\_>\")) (buffer-substring-no-properties (car bound) (cdr bound)))))))) '$%@*' will be included in the occurrences in perl mode.") (defcustom iedit-mode-line `(" Iedit:" (:eval (format ,(propertize "%d/%d" 'face 'font-lock-warning-face) iedit-occurrence-index (iedit-counter)))) "Mode-line format for Iedit. This should be set before Iedit is loaded." :type 'string :group 'iedit) (put 'iedit-mode-line 'risky-local-variable t) (make-variable-buffer-local 'iedit-mode) (make-variable-buffer-local 'iedit-use-symbol-boundaries) (make-variable-buffer-local 'iedit-occurrence-type-local) (make-variable-buffer-local 'iedit-last-occurrence-local) (make-variable-buffer-local 'iedit-initial-string-local) (make-variable-buffer-local 'iedit-initial-region) (make-variable-buffer-local 'iedit-default-occurrence-local) (make-variable-buffer-local 'iedit-is-narrowed) (or (assq 'iedit-mode minor-mode-alist) (nconc minor-mode-alist (list `(iedit-mode ,iedit-mode-line)))) ;;; Define iedit help map. (eval-when-compile (require 'help-macro)) (defvar iedit-help-map (let ((map (make-sparse-keymap))) (define-key map (vector (event-convert-list `(,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-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 (keymap (substitute-command-keys "\\{iedit-mode-keymap}\\{iedit-mode-occurrence-keymap}"))) (with-help-window "*Help*" (with-current-buffer standard-output (princ "Iedit Mode Bindings: ") (princ keymap))))) (defun iedit-describe-key () "Display documentation of the function invoked by Iedit mode 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))) (defun iedit-counter () "Return the number of active occurrences." (length iedit-occurrences-overlays)) ;;; Default key bindings: (defun iedit-update-key-bindings (key) "Update default key bindings." (when (and key (not (eq key (car (where-is-internal 'iedit-mode))))) (let ((key-def (lookup-key (current-global-map) key))) (if key-def (display-warning 'iedit (format "Iedit default key %S is occupied by %s." (key-description key) key-def) :warning) (define-key global-map key 'iedit-mode) (define-key isearch-mode-map key 'iedit-mode-from-isearch) (define-key esc-map key 'iedit-execute-last-modification) (define-key help-map key 'iedit-mode-toggle-on-function) (message "Iedit default key binding is %s" (key-description key)))))) (when (and iedit-toggle-key-default (null (where-is-internal 'iedit-mode))) (iedit-update-key-bindings iedit-toggle-key-default)) ;; Avoid to restore Iedit mode when restoring desktop (add-to-list 'desktop-minor-mode-handlers '(iedit-mode . ignore)) ;;; Define iedit help map. (eval-when-compile (require 'help-macro)) (defvar iedit-mode-occurrence-keymap (let ((map (make-sparse-keymap))) (set-keymap-parent map iedit-occurrence-keymap-default) (define-key map (kbd "M-H") 'iedit-restrict-function) (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-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) (define-key map (kbd "M-S") 'iedit-toggle-search-invisible) map) "Keymap used within overlays in Iedit mode.") (defvar iedit-mode-keymap (let ((map (make-sparse-keymap))) (set-keymap-parent map iedit-lib-keymap) (define-key map (vector (event-convert-list `(,help-char))) iedit-help-map) (define-key map [help] iedit-help-map) (define-key map [f1] iedit-help-map) (define-key map (kbd "M-;") 'iedit-toggle-selection) map) "Keymap used while Iedit mode is enabled.") ;;; Define Iedit mode map (or (assq 'iedit-mode minor-mode-map-alist) (setq minor-mode-map-alist (cons (cons 'iedit-mode iedit-mode-keymap) minor-mode-map-alist))) ;;;###autoload (defun iedit-mode (&optional arg) "Toggle Iedit mode. This command behaves differently, depending on the mark, point, prefix argument and variable `iedit-transient-mark-sensitive'. If Iedit mode is off, turn Iedit mode on. When Iedit mode is turned on, all the occurrences of the current region in the buffer (possibly narrowed) or a region are highlighted. If one occurrence is modified, the change are propagated to all other occurrences simultaneously. If region is not active, `iedit-default-occurrence' is called to get an occurrence candidate, according to the thing at point. It might be url, email address, markup tag or current symbol(or word). In the above two situations, with digit prefix argument 0, only occurrences in current function are matched. This is good for renaming refactoring in programming. You can also switch to Iedit mode from isearch mode directly. The current search string is used as occurrence. All occurrences of the current search string are highlighted. With an universal prefix argument, the occurrence when Iedit mode is turned off last time in current buffer is used as occurrence. This is intended to recover last Iedit mode which is turned off. If region active, Iedit mode is limited within the current region. With repeated universal prefix argument, the occurrence when Iedit mode is turned off last time (might be in other buffer) is used as occurrence. If region active, Iedit mode is limited within the current region. With digital prefix argument 1, Iedit mode is limited on the current symbol or the active region, which means just one instance is highlighted. This behavior serves as a start point of incremental selection work flow. If Iedit mode is on and region is active, Iedit mode is restricted in the region, e.g. the occurrences outside of the region is excluded. If Iedit mode is on and region is active, with an universal prefix argument, Iedit mode is restricted outside of the region, e.g. the occurrences in the region is excluded. Turn off Iedit mode in other situations. Commands: \\{iedit-mode-keymap} Keymap used within overlays: \\{iedit-mode-occurrence-keymap}" (interactive "P") (if iedit-mode (iedit-mode-on-action arg) (iedit-barf-if-lib-active) (let (occurrence beg end) ;; Get the occurrence and iedit-occurrence-type-local (cond ((and arg (= 4 (prefix-numeric-value arg)) iedit-last-occurrence-local) (setq occurrence iedit-last-occurrence-local)) ((and arg (= 16 (prefix-numeric-value arg)) iedit-last-initial-string-global) (setq occurrence iedit-last-initial-string-global) (setq iedit-occurrence-type-local iedit-occurrence-type-global)) ((iedit-region-active) (setq occurrence (buffer-substring-no-properties (mark) (point))) (setq iedit-occurrence-type-local 'selection)) (t (setq occurrence (iedit-default-occurrence)) (unless occurrence (error "No candidate of the occurrence, cannot enable Iedit mode")))) ;; Get the scope (cl-multiple-value-setq (beg end) (iedit--get-scope arg)) (setq mark-active nil) (run-hooks 'deactivate-mark-hook) (setq iedit-initial-string-local occurrence) (iedit-start (iedit-regexp-quote occurrence) beg end) (unless iedit-occurrences-overlays ;; (message "No matches found for %s" (iedit-regexp-quote occurrence)) (iedit-done))))) (unless (boundp 'isearch-regexp-function) (defvaralias 'isearch-regexp-function 'isearch-word)) ;;;###autoload (defun iedit-mode-from-isearch (&optional arg) "Start Iedit mode using last search string as the regexp." (interactive "P") (or isearch-success (error "No match" )) (let ((regexp (cond ((functionp isearch-regexp-function) (funcall isearch-regexp-function isearch-string)) (isearch-regexp-function (word-search-regexp isearch-string)) (isearch-regexp isearch-string) (t (regexp-quote isearch-string)))) (iedit-case-sensitive (not isearch-case-fold-search)) result beg end) (if (or isearch-regexp isearch-regexp-function) nil (setq iedit-initial-string-local isearch-string)) (isearch-exit) (cl-multiple-value-setq (beg end) (iedit--get-scope arg)) (setq mark-active nil) (run-hooks 'deactivate-mark-hook) (when iedit-mode (iedit-lib-cleanup)) (setq result (catch 'not-same-length (iedit-start regexp beg end))) (cond ((not iedit-occurrences-overlays) (message "No matches found for %s" regexp) (iedit-done)) ((equal result 'not-same-length) (message "Matches are not the same length.") (iedit-done))))) (defun iedit--get-scope (arg) "Return a region according to the prefix argument." (let ((beg (if (eq major-mode 'occur-edit-mode) ; skip the first occurrence (next-single-char-property-change 1 'read-only) (point-min))) (end (point-max))) (when arg (cond ((= 0 (prefix-numeric-value arg)) (save-excursion ;; Since Emacs 26.1, `mark-defun' marks the next defun if the ;; mark is active. (deactivate-mark t) (mark-defun) (setq beg (region-beginning)) (setq end (region-end))) (when (and iedit-auto-narrow (not (buffer-narrowed-p))) (narrow-to-region beg end) (setq iedit-is-narrowed t))) ((and (= 1 (prefix-numeric-value arg)) (not (iedit-region-active))) (let ((region (bounds-of-thing-at-point 'symbol))) (setq beg (car region)) (setq end (cdr region)))) ((iedit-region-active) (setq beg (region-beginning)) (setq end (region-end))))) (list beg end))) (defun iedit-start (occurrence-regexp beg end) "Start Iedit mode for the `occurrence-regexp' in the current buffer." (setq iedit-initial-region (list beg end)) (let ((counter 0)) (if (eq iedit-occurrence-type-local 'markup-tag) (progn (setq iedit-occurrence-keymap iedit-occurrence-keymap-default) (iedit-make-markers-overlays iedit-occurrences-overlays) (setq counter 2)) (setq iedit-occurrence-keymap iedit-mode-occurrence-keymap) (setq counter (iedit-make-occurrences-overlays occurrence-regexp beg end))) (message "%d matches for \"%s\"" counter (iedit-printable occurrence-regexp)) (setq iedit-mode t)) (iedit-lib-start 'iedit-done) (run-hooks 'iedit-mode-hook)) (defun iedit-default-occurrence() "This function returns a string as occurrence candidate. The candidate depends on the thing at point." (let (occurrence-str) (cond ((thing-at-point 'url) (setq occurrence-str (thing-at-point 'url)) (setq iedit-occurrence-type-local 'url)) ((thing-at-point 'email) (setq occurrence-str (thing-at-point 'email)) (setq iedit-occurrence-type-local 'email)) (iedit-default-occurrence-local (setq occurrence-str (funcall iedit-default-occurrence-local))) ;; Try to mark sgml pair anyway ((and (not (bound-and-true-p sgml-electric-tag-pair-mode)) (setq occurrence-str (iedit-mark-sgml-pair))) (setq iedit-occurrence-type-local 'markup-tag)) ((and iedit-use-symbol-boundaries ;option (thing-at-point 'symbol)) (setq occurrence-str (thing-at-point 'symbol)) (setq iedit-occurrence-type-local 'symbol)) ((thing-at-point 'word) (setq occurrence-str (thing-at-point 'word)) (setq iedit-occurrence-type-local 'word))) occurrence-str)) (defun iedit-regexp-quote (exp) "Return a regexp string." (cl-case iedit-occurrence-type-local ('symbol (concat "\\_<" (regexp-quote exp) "\\_>")) ('word (concat "\\<" (regexp-quote exp) "\\>")) ('regexp exp) ( t (regexp-quote exp)))) (defun iedit-mark-sgml-pair () "Check if the cursor is on a markup tag. If the cursor is on a markup tag, the position of the opening and closing markup tags are saved in `iedit-occurrences-overlays' temporarily. The code is adapted from `sgml-electric-tag-pair-before-change-function'. Return the tag if succeeded, nil if failed." (condition-case err (save-excursion (skip-chars-backward "[:alnum:]-_.:") (if (or (eq (char-before) ?<) (and (eq (char-before) ?/) (eq (char-before (1- (point))) ?<))) (let* ((endp (eq (char-before) ?/)) (cl-start (point)) (cl-end (progn (skip-chars-forward "[:alnum:]-_.:") (point))) (match (if endp (with-no-warnings (when (sgml-skip-tag-backward 1) (forward-char 1) t)) (with-syntax-table sgml-tag-syntax-table (up-list -1) (with-no-warnings (when (sgml-skip-tag-forward 1)) (backward-sexp 1) (forward-char 2) t))))) (when (and match (/= cl-end cl-start) (equal (buffer-substring cl-start cl-end) (buffer-substring (point) (save-excursion (skip-chars-forward "[:alnum:]-_.:") (point)))) (or (not endp) (eq (char-after cl-end) ?>))) (push (cons cl-start cl-end) iedit-occurrences-overlays) (push (cons (point) (+ (point) (- cl-end cl-start))) iedit-occurrences-overlays) (buffer-substring cl-start cl-end))))) (error nil))) (defun iedit-done () "Exit Iedit mode. Save the current occurrence string locally and globally. Save the initial string globally." (setq iedit-last-occurrence-local (iedit-current-occurrence-string)) (setq iedit-occurrence-type-global iedit-occurrence-type-local) (setq iedit-last-occurrence-global iedit-last-occurrence-local) (setq iedit-last-initial-string-global iedit-initial-string-local) (if (and iedit-auto-save-occurrence-in-kill-ring iedit-last-occurrence-local) (kill-new iedit-last-occurrence-local)) ; Make occurrence the latest kill in the kill ring. (setq iedit-num-lines-to-expand-up 0) (setq iedit-num-lines-to-expand-down 0) (iedit-lib-cleanup) (when iedit-is-narrowed (widen) (setq iedit-is-narrowed nil)) (setq iedit-initial-string-local nil) (setq iedit-mode nil) (force-mode-line-update) (run-hooks 'iedit-mode-end-hook)) (defun iedit-mode-on-action (&optional arg) "Turn off Iedit mode or restrict it in a region if region is active." (cond ((iedit-region-active) (iedit-restrict-region (region-beginning) (region-end) arg)) ((and arg (= 0 (prefix-numeric-value arg))) (iedit-restrict-function nil)) (t (iedit-done)))) ;;;###autoload (defun iedit-mode-toggle-on-function () "Toggle Iedit mode on current function." (interactive) (if iedit-mode (iedit-done) (iedit-mode 0))) ;;;###autoload (defun iedit-execute-last-modification (&optional arg) "Apply last modification in Iedit mode to the current buffer or an active region." (interactive "*P") (or (and iedit-last-initial-string-global (not (string= iedit-last-initial-string-global iedit-last-occurrence-global))) (error "No modification available")) (let ((occurrence-exp (regexp-quote iedit-last-initial-string-global)) (replacement iedit-last-occurrence-global) (case-fold-search (not iedit-case-sensitive)) beg end) (when case-fold-search (setq occurrence-exp (downcase occurrence-exp)) (setq replacement (downcase replacement))) ;; `iedit-regexp-quote' depends on iedit-occurrence-type-local (setq iedit-occurrence-type-local iedit-occurrence-type-global) (setq occurrence-exp (iedit-regexp-quote occurrence-exp)) (when (iedit-region-active) (setq beg (region-beginning)) (setq end (region-end))) (perform-replace occurrence-exp replacement t t nil nil nil beg end))) (defun iedit-apply-global-modification () "Apply last global modification." (interactive "*") (if (and iedit-last-initial-string-global (string= iedit-initial-string-local iedit-last-initial-string-global) (not (string= iedit-last-initial-string-global iedit-last-occurrence-global))) (iedit-replace-occurrences iedit-last-occurrence-global) (message "No global modification available."))) (defun iedit-toggle-selection () "Select or deselect the occurrence under point." (interactive) (iedit-barf-if-buffering) (let ((ov (iedit-find-current-occurrence-overlay))) (if ov (iedit-restrict-region (overlay-start ov) (overlay-end ov) t) (let ((current-occurrence-string (iedit-current-occurrence-string))) (when (not (null current-occurrence-string)) (save-excursion (goto-char (if (> (point) (length current-occurrence-string)) ( - (point) (length current-occurrence-string)) (point-min))) (iedit-add-next-occurrence-overlay (iedit-regexp-quote current-occurrence-string))) (force-mode-line-update)))))) (defun iedit-restrict-function(&optional arg) "Restricting Iedit mode in current function." (interactive "P") (let (beg end) (save-excursion (deactivate-mark t) (mark-defun) (setq beg (region-beginning)) (setq end (region-end))) (iedit-restrict-region beg end arg) (when (and (not arg) iedit-auto-narrow (not (buffer-narrowed-p))) (narrow-to-region beg end) (setq iedit-is-narrowed t))) (message "Restricted in current function, %d matches." (length iedit-occurrences-overlays))) (defun iedit-restrict-current-line () "Restrict Iedit mode to current line." (interactive) (iedit-restrict-region (iedit-char-at-bol) (iedit-char-at-eol)) (setq iedit-num-lines-to-expand-up 0 iedit-num-lines-to-expand-down 0) (message "Restricted to current line, %d match%s." (length iedit-occurrences-overlays) (if (= 1 (length iedit-occurrences-overlays)) "" "es"))) (defun iedit-expand-by-a-line (where amount) "Expands the top or bottom of the search region upwards or downwards by `amount' lines. The region being acted upon is controlled with `where' ('top to act on the top, anything else for the bottom). If amount is negative, collapses the top or bottom of the search region by `-amount' lines." (let ((occurrence (iedit-current-occurrence-string))) (iedit-lib-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-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 (length iedit-occurrences-overlays) (if (= 1 (length iedit-occurrences-overlays)) "" "es")))) (defun iedit-expand-up-a-line (&optional N) "After start iedit-mode only on current symbol or the active region, this function expands the search region upwards by N line. N defaults to 1. If N is negative, collapses the top of the search region by `-N' lines." (interactive "p") (iedit-expand-by-a-line 'top N)) (defun iedit-expand-down-a-line (&optional N) "After start iedit-mode only on current symbol or the active region, this function expands the search region downwards by N line. N defaults to 1. If N is negative, collapses the bottom of the search region by `-N' lines." (interactive "p") (iedit-expand-by-a-line 'bottom N)) (defun iedit-expand-down-to-occurrence (&optional arg) "Expand the search region downwards until reaching a new occurrence. If no such occurrence can be found, throw an error. With a prefix, bring the bottom of the region back up one occurrence." (interactive "P") (if arg (progn (iedit-restrict-region (iedit-first-occurrence) (1- (iedit-last-occurrence))) (when iedit-mode (goto-char (iedit-last-occurrence)))) (iedit-expand-to-occurrence t))) (defun iedit-expand-up-to-occurrence (&optional arg) "Expand the search region upwards until reaching a new occurrence. If no such occurrence can be found, throw an error. With a prefix, bring the top of the region back down one occurrence." (interactive "P") (if arg (progn (iedit-restrict-region (+ (iedit-occurrence-string-length) (iedit-first-occurrence)) (+ (iedit-occurrence-string-length) (iedit-last-occurrence))) (when iedit-mode (goto-char (iedit-first-occurrence)))) (iedit-expand-to-occurrence nil))) (defun iedit-expand-to-occurrence (forward) "Expand to next or previous occurrence." (let ((pos (iedit-add-occurrence-overlay (iedit-regexp-quote (iedit-current-occurrence-string)) (if forward (1+ (iedit-last-occurrence)) (iedit-first-occurrence)) forward))) (when pos (goto-char pos) (force-mode-line-update)))) (defun iedit-restrict-region (beg end &optional exclusive) "Restricting Iedit mode in a region." (if (null (iedit-find-overlay beg end 'iedit-occurrence-overlay-name exclusive)) (iedit-done) (setq mark-active nil) (run-hooks 'deactivate-mark-hook) (iedit-cleanup-occurrences-overlays beg end exclusive) (setq iedit-initial-region (list beg end exclusive)) (if iedit-hiding (iedit-hide-context-lines iedit-occurrence-context-lines)) (force-mode-line-update))) (defun iedit-toggle-case-sensitive () "Toggle case-sensitive matching occurrences. " (interactive) (setq iedit-case-sensitive (not iedit-case-sensitive)) (let ((occurrence-string (iedit-current-occurrence-string))) (when occurrence-string (iedit-cleanup-occurrences-overlays) (let* ((occurrence-regexp (iedit-regexp-quote occurrence-string)) (begin (car iedit-initial-region)) (end (cadr iedit-initial-region)) (counter (iedit-make-occurrences-overlays occurrence-regexp begin end))) (message "iedit %s. %d matches for \"%s\"" (if iedit-case-sensitive "is case sensitive" "ignores case") counter (iedit-printable occurrence-regexp)) (force-mode-line-update))))) (defun iedit-toggle-search-invisible () "Toggle search-invisible matching occurrences. " (interactive) (setq iedit-search-invisible (if iedit-search-invisible nil (or search-invisible 'open))) (let ((occurrence-string (iedit-current-occurrence-string))) (when occurrence-string (iedit-cleanup-occurrences-overlays) (let* ((occurrence-regexp (iedit-regexp-quote occurrence-string)) (begin (car iedit-initial-region)) (end (cadr iedit-initial-region)) (counter (iedit-make-occurrences-overlays occurrence-regexp begin end))) (message "iedit %s. %d matches for \"%s\"" (if iedit-search-invisible "matching invisible" "matching visible") counter (iedit-printable occurrence-regexp)) (force-mode-line-update))))) (provide 'iedit) ;;; iedit.el ends here ;; LocalWords: iedit el MERCHANTABILITY kbd isearch todo ert Lindberg Tassilo ;; LocalWords: eval defgroup defcustom boolean defvar assq alist nconc Ren ;; LocalWords: substring cadr keymap defconst purecopy bkm defun princ prev ;; LocalWords: iso lefttab backtab upcase downcase concat setq autoload arg ;; LocalWords: refactoring propertize cond goto nreverse progn rotatef eq elp ;; LocalWords: dolist pos unmatch args ov sReplace iedit's cdr quote'ed RET ;; LocalWords: sgml esc num perl memq url functionp funcall str alnum endp ;; LocalWords: sexp bol eol