[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/anzu b3d15fba55 283/288: Support non contiguous regions li
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/anzu b3d15fba55 283/288: Support non contiguous regions like rectangle region (#115) |
Date: |
Thu, 6 Jan 2022 03:59:00 -0500 (EST) |
branch: elpa/anzu
commit b3d15fba5590286209424b8c2d6765265076f034
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: GitHub <noreply@github.com>
Support non contiguous regions like rectangle region (#115)
---
anzu.el | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/anzu.el b/anzu.el
index d51727b8a5..5fe49ef2ba 100644
--- a/anzu.el
+++ b/anzu.el
@@ -6,7 +6,7 @@
;; Maintainer: Neil Okamoto <neil.okamoto+melpa@gmail.com>
;; URL: https://github.com/emacsorphanage/anzu
;; Version: 0.62
-;; Package-Requires: ((emacs "24.3"))
+;; Package-Requires: ((emacs "25.1"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -152,6 +152,7 @@
(defvar anzu--outside-point nil)
(defvar anzu--history nil)
(defvar anzu--query-defaults nil)
+(defvar anzu--region-noncontiguous nil)
(defun anzu--validate-regexp (regexp)
(condition-case nil
@@ -274,7 +275,8 @@
anzu--state nil
anzu--last-command nil
anzu--last-isearch-string nil
- anzu--overflow-p nil))
+ anzu--overflow-p nil
+ anzu--region-noncontiguous nil))
(defun anzu--reset-mode-line ()
(anzu--reset-status)
@@ -377,6 +379,14 @@
(mapc (lambda (m) (set-marker m nil)) anzu--replaced-markers)
(setq anzu--replaced-markers nil))
+(defun anzu2--put-overlay-p (beg end overlay-beg overlay-end)
+ (if anzu--region-noncontiguous
+ (cl-loop for (b . e) in (cl-loop for region in anzu--region-noncontiguous
+ when (and (>= (car region) overlay-beg)
(<= (cdr region) overlay-end))
+ collect region)
+ thereis (and (>= beg b overlay-beg) (<= end e overlay-end)))
+ (and (>= beg overlay-beg) (<= end overlay-end))))
+
;; Return highlighted count
(defun anzu--count-and-highlight-matched (buf str replace-beg replace-end
use-regexp overlay-limit
case-sensitive)
@@ -401,7 +411,11 @@
nil
(anzu--case-fold-search))))
(while (and (not finish) (funcall search-func str replace-end t))
- (cl-incf count)
+ (if anzu--region-noncontiguous
+ (when (cl-loop for (b . e) in anzu--region-noncontiguous
+ thereis (and (>= (point) b) (<= (point) e)))
+ (cl-incf count))
+ (cl-incf count))
(let ((beg (match-beginning 0))
(end (match-end 0)))
(when (= beg end)
@@ -410,7 +424,7 @@
(forward-char step)))
(when (and replace-end (funcall cmp-func (point) replace-end))
(setq finish t))
- (when (and (>= beg overlay-beg) (<= end overlay-end) (not
finish))
+ (when (and (not finish) (anzu2--put-overlay-p beg end
overlay-beg overlay-end))
(cl-incf overlayed)
(anzu--add-overlay beg end))))
(setq anzu--cached-count count)
@@ -714,13 +728,13 @@
(defun anzu--construct-perform-replace-arguments (from to delimited beg end
backward query)
(if backward
- (list from to query t delimited nil nil beg end backward)
- (list from to query t delimited nil nil beg end)))
+ (list from to query t delimited nil nil beg end backward
anzu--region-noncontiguous)
+ (list from to query t delimited nil nil beg end nil
anzu--region-noncontiguous)))
(defun anzu--construct-query-replace-arguments (from to delimited beg end
backward)
(if backward
- (list from to delimited beg end backward)
- (list from to delimited beg end)))
+ (list from to delimited beg end backward anzu--region-noncontiguous)
+ (list from to delimited beg end nil anzu--region-noncontiguous)))
(defsubst anzu--current-replaced-index (curpoint)
(cl-loop for m in anzu--replaced-markers
@@ -759,6 +773,8 @@
(cl-defun anzu--query-replace-common (use-regexp
&key at-cursor thing prefix-arg (query
t) isearch-p)
(anzu--cons-mode-line 'replace-query)
+ (when (and (use-region-p) (region-noncontiguous-p))
+ (setq anzu--region-noncontiguous (funcall region-extract-function
'bounds)))
(let* ((use-region (use-region-p))
(orig-point (point))
(backward (anzu--replace-backward-p prefix-arg))
- [nongnu] elpa/anzu a5a22fd537 280/288: release 0.63, (continued)
- [nongnu] elpa/anzu a5a22fd537 280/288: release 0.63, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 9d334a4e37 265/288: replaced string should be compiled at regexp replace, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu ffbe938d60 268/288: perform elisp-lint in circleci, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 7dc4abe0a0 274/288: Merge branch 'master' into fix93, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu e4c2728734 270/288: fix check-declare error by eliminating declare-function, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu ee6a6448df 277/288: Merge pull request #107 from emacsorphanage/revert-104-fix93, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 71a1a88dcd 275/288: Merge pull request #104 from agreselin/fix93, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 2e69955da9 271/288: clean up "make lint" rule in Makefile, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 592f8ee6d0 263/288: Merge pull request #95 from syohex/emacs-27-bug, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 7b8688c84d 282/288: default anzu-search-threshold and anzu-replace-threshold is 1000, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu b3d15fba55 283/288: Support non contiguous regions like rectangle region (#115),
ELPA Syncer <=
- [nongnu] elpa/anzu 5abb37455e 288/288: fix the ci status badge on README.md, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu bdb3da5028 285/288: bump version 0.64, ELPA Syncer, 2022/01/06