[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/anzu cf07d6a0ec 125/288: Implement specified lines replace
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/anzu cf07d6a0ec 125/288: Implement specified lines replacement |
Date: |
Thu, 6 Jan 2022 03:58:46 -0500 (EST) |
branch: elpa/anzu
commit cf07d6a0ec9df9a43612464631d9da64d464b0ec
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>
Implement specified lines replacement
If user specifies numeric prefix for replacement command,
such as anzu-query-replace, then anzu.el replaces only
specified lines.
For example, C-u 3 M-x anzu-query-replace replaces only 3 lines.
---
anzu.el | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/anzu.el b/anzu.el
index 953a12712d..f6c7977748 100644
--- a/anzu.el
+++ b/anzu.el
@@ -478,20 +478,23 @@
(and bound (cdr bound))))
(defun anzu--region-begin (use-region thing backward)
- (if thing
- (or (anzu--thing-begin thing) (point))
- (if use-region
- (region-beginning)
- (if backward
- (point-min)
- (point)))))
+ (cond (current-prefix-arg (line-beginning-position))
+ (thing (or (anzu--thing-begin thing) (point)))
+ (use-region (region-beginning))
+ (backward (point-min))
+ (t (point))))
+
+(defsubst anzu--line-end-position (num)
+ (save-excursion
+ (forward-line (1- num))
+ (line-end-position)))
(defun anzu--region-end (use-region thing)
- (if thing
- (or (anzu--thing-end thing) (point-max))
- (if use-region
- (region-end)
- (point-max))))
+ (cond (current-prefix-arg
+ (anzu--line-end-position (prefix-numeric-value current-prefix-arg)))
+ (thing (or (anzu--thing-end thing) (point-max)))
+ (use-region (region-end))
+ (t (point-max))))
(defun anzu--begin-thing (at-cursor thing)
(cond ((and at-cursor thing) thing)
- [nongnu] elpa/anzu b6672c9bf2 061/288: Improve overlay replace text, (continued)
- [nongnu] elpa/anzu b6672c9bf2 061/288: Improve overlay replace text, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 0e7873a3e7 075/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 68300bc949 078/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 264c36d135 076/288: Fix overlay is not put if match-string is 0 length, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 8bde8ee114 088/288: Update comment, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 29a07403a6 091/288: Merge pull request #12 from syohex/support-backward-replace, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 368a4ebe8c 096/288: Fix no prefix number case, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu a36458386d 107/288: Don't show default replacement in prompt, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu ef489aadb2 118/288: Fix replacement issue(#22), ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 497864542b 120/288: Bumpup version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu cf07d6a0ec 125/288: Implement specified lines replacement,
ELPA Syncer <=
- [nongnu] elpa/anzu 09cc87ad9b 228/288: Merge pull request #66 from syohex/replace-threshold, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu b3b912013d 225/288: Add custom variable of replacement threshold, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 380f5fd232 198/288: Merge pull request #53 from kosh04/fix-literal-match, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 38d49e3664 276/288: Revert "Fix issue #93", ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 799f26ee0e 260/288: Merge pull request #86 from syohex/no-match-face, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 5bd8f5511d 273/288: Fix backward replace issue, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu abb129c5f8 148/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu c4a440af86 175/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 05eda5f709 191/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu dcd8eac2e5 165/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06