emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/anzu 718d5845d1 126/288: Merge pull request #25 from syohe


From: ELPA Syncer
Subject: [nongnu] elpa/anzu 718d5845d1 126/288: Merge pull request #25 from syohex/add-lines-region
Date: Thu, 6 Jan 2022 03:58:46 -0500 (EST)

branch: elpa/anzu
commit 718d5845d191a34fbd76df32cf725c68c424538d
Merge: 59fec57b13 cf07d6a0ec
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>

    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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]