branch: externals/objed
commit 22874369f79bfd810481763481626a5aa4f95d5b
Author: Clemens Radermacher <[email protected]>
Commit: Clemens Radermacher <[email protected]>
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)