branch: elpa/anzu
commit 718d5845d191a34fbd76df32cf725c68c424538d
Merge: 59fec57b13 cf07d6a0ec
Author: Syohei YOSHIDA <[email protected]>
Commit: Syohei YOSHIDA <[email protected]>
Merge pull request #25 from syohex/add-lines-region
Implement specified lines replacement
---
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)