[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/embark b1aee4b72e 1/3: Add embark--unmark-target pre-ac
From: |
ELPA Syncer |
Subject: |
[elpa] externals/embark b1aee4b72e 1/3: Add embark--unmark-target pre-action hook |
Date: |
Thu, 30 Dec 2021 16:57:38 -0500 (EST) |
branch: externals/embark
commit b1aee4b72ed855837de63d16eb604ba2ec73b132
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
Add embark--unmark-target pre-action hook
This is for commands that you want to act on the region *contents* but
that require *not* having the region active.
---
embark.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/embark.el b/embark.el
index bef2378fa0..839cb88f11 100644
--- a/embark.el
+++ b/embark.el
@@ -473,7 +473,12 @@ the key :always are executed always."
(delete-file embark--confirm)
(delete-directory embark--confirm)
(kill-buffer embark--confirm)
- (embark-kill-buffer-and-window embark--confirm))
+ (embark-kill-buffer-and-window embark--confirm)
+ ;; search for region contents outside said region
+ (embark-isearch embark--unmark-target)
+ (occur embark--unmark-target)
+ (query-replace embark--unmark-target)
+ (query-replace-regexp embark--unmark-target))
"Alist associating commands with pre-action hooks.
The hooks are run right before an action is embarked upon. See
`embark-target-injection-hooks' for information about the hook
@@ -3699,6 +3704,10 @@ and leaves the point to the left of it."
(set-mark (cdr bounds))
(goto-char (car bounds))))
+(cl-defun embark--unmark-target (&key bounds &allow-other-keys)
+ "Deactivate the region target."
+ (deactivate-mark t))
+
(defun embark--allow-edit (&rest _)
"Allow editing the target."
(remove-hook 'post-command-hook 'exit-minibuffer t)