From 2ef35a5517d170b8acab90ce53dffece979034cf Mon Sep 17 00:00:00 2001 From: York Zhao Date: Wed, 22 Jun 2011 17:57:05 -0400 Subject: [PATCH] Keeps isearch overlays on expiration of `vimpulse-flash-delay' after "n/N" command After a "n/N" command, cleans isearch overlays only upon the execution of a subsequent "non-search" command, not the expiration of the `vimpulse-flash-delay' so that the invisible area opened by the "n/N" command will not automatically become permanently opened as the result of the expiration of `vimpulse-flash-delay', in other words, the opened area can still be closed by a subsequent "n/N" command when the match leaves the area, and the only way to make an opened area "permanently opened" is to execute a "non-search" command after the search (any key press other than 'n' or 'N'). --- vimpulse-compatibility.el | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/vimpulse-compatibility.el b/vimpulse-compatibility.el index 3733af1..61f98d5 100644 --- a/vimpulse-compatibility.el +++ b/vimpulse-compatibility.el @@ -209,11 +209,28 @@ which lists available keys: (and (fboundp 'isearch-lazy-highlight-update) (isearch-lazy-highlight-update)))) (add-hook 'pre-command-hook 'vimpulse-flash-hook) + (add-hook 'pre-command-hook 'vimpulse-clean-isearch-overlays) (setq vimpulse-flash-timer (if (fboundp 'run-at-time) (add-timeout vimpulse-flash-delay disable nil) (run-at-time vimpulse-flash-delay nil disable)))))) +(defun vimpulse-clean-isearch-overlays () + "Cleans isearch overlays if `this-command' is not search." + (remove-hook 'pre-command-hook 'vimpulse-clean-isearch-overlays) + (when (not (memq this-command + '(viper-exec-mapped-kbd-macro + viper-search + viper-search-backward + viper-search-forward + viper-search-next + viper-search-Next + vimpulse-search-backward + vimpulse-search-forward + vimpulse-search-backward-for-symbol-at-point + vimpulse-search-forward-for-symbol-at-point))) + (isearch-clean-overlays))) + (defun vimpulse-flash-hook (&optional force) "Disable hightlighting if `this-command' is not search. Disable anyway if FORCE is t." @@ -237,7 +254,6 @@ Disable anyway if FORCE is t." (isearch-highlight-all-cleanup)) (and (fboundp 'lazy-highlight-cleanup) (lazy-highlight-cleanup t)) - (isearch-clean-overlays) (when vimpulse-flash-timer (cancel-timer vimpulse-flash-timer))) (remove-hook 'pre-command-hook 'vimpulse-flash-hook)) -- 1.7.4