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

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

[elpa] externals/objed 2287436 19/34: Include possible active region whe


From: Stefan Monnier
Subject: [elpa] externals/objed 2287436 19/34: Include possible active region when acting on multiple objects
Date: Mon, 15 Mar 2021 22:21:10 -0400 (EDT)

branch: externals/objed
commit 22874369f79bfd810481763481626a5aa4f95d5b
Author: Clemens Radermacher <clemera@posteo.net>
Commit: Clemens Radermacher <clemera@posteo.net>

    Include possible active region when acting on multiple objects
---
 objed.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/objed.el b/objed.el
index 18a803a..4e24b7c 100644
--- a/objed.el
+++ b/objed.el
@@ -4003,7 +4003,11 @@ ON got applied."
 
 (defun objed--do-objects (action exit)
   "Apply ACTION on marked objects and exit with EXIT."
-  (let* ((ovs objed--marked-ovs)
+  (let* ((ovs (if (use-region-p)
+                  (cons (make-overlay (region-beginning)
+                                      (region-end))
+                        (copy-sequence objed--marked-ovs))
+                (copy-sequence objed--marked-ovs)))
          (appendp (memq action '(kill-region copy-region-as-kill)))
          (n 0)
          (mc (and (eq exit 'mc)
@@ -4012,8 +4016,8 @@ ON got applied."
     ;; move to last ov
     (goto-char pos)
     (save-excursion
-      ;; TODO: why not bottom up, was there a reason?
-      (dolist (ov (nreverse (copy-sequence ovs)))
+      ;; Use the order they were "marked".
+      (dolist (ov (nreverse ovs))
         (let ((beg (overlay-start ov))
               (end (overlay-end ov)))
           (when (and beg end)



reply via email to

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