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

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

[elpa] externals/objed 23f5c6e 28/34: Add isearch to keeper commands


From: Stefan Monnier
Subject: [elpa] externals/objed 23f5c6e 28/34: Add isearch to keeper commands
Date: Mon, 15 Mar 2021 22:21:12 -0400 (EDT)

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

    Add isearch to keeper commands
---
 objed.el | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/objed.el b/objed.el
index 1411733..3b77313 100644
--- a/objed.el
+++ b/objed.el
@@ -315,6 +315,11 @@ be used to restore previous states."
     kmacro-start-macro-or-insert-counter
     kmacro-end-or-call-macro
     kmacro-call-macro
+    isearch-forward
+    isearch-forward-regexp
+    isearch-forward-symbol
+    isearch-backward
+    isearch-backward-regexp
     )
   "Regular Emacs commands which should not exit modal edit state.
 
@@ -1500,6 +1505,12 @@ one of `objed-keeper-commands'."
     (or (commandp ocmd)
         objed--with-allow-input
         (and this-command
+             ;; those are handled on exit in objed--reset--objed-buffer
+             (not (memq this-command '(isearch-forward
+                                       isearch-forward-regexp
+                                       isearch-forward-symbol
+                                       isearch-backward
+                                       isearch-backward-regexp)))
              (or (memq this-command objed-keeper-commands)
                  (assq this-command objed-cmd-alist))
              (prog1 #'ignore
@@ -3964,8 +3975,22 @@ Reset and reinitilize objed if appropriate."
               (set (car setting) (cdr setting))
             (kill-local-variable setting))))
       (remove-hook 'pre-command-hook 'objed--push-state t)
+
+      (when (and (memq this-command '(isearch-forward
+                                      isearch-forward-regexp
+                                      isearch-forward-symbol
+                                      isearch-backward
+                                      isearch-backward-regexp))
+                 (memq this-command objed-keeper-commands))
+        (add-hook 'isearch-mode-end-hook #'objed-reactivate-after-isearch))
+
       (run-hooks 'objed-exit-hook))))
 
+(defun objed-reactivate-after-isearch ()
+  "Reactivate objed after isearch."
+  (remove-hook 'isearch-mode-end-hook #'objed-reactivate-after-isearch)
+  (run-at-time 0 nil #'objed-activate))
+
 (defun objed--reset ()
   "Reset variables and state information."
   (if (eq (cadr overriding-terminal-local-map)



reply via email to

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