diff options
Diffstat (limited to 'lisp/+isearch.el')
-rw-r--r-- | lisp/+isearch.el | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/+isearch.el b/lisp/+isearch.el new file mode 100644 index 0000000..3516ec4 --- /dev/null +++ b/lisp/+isearch.el | |||
@@ -0,0 +1,24 @@ | |||
1 | ;;; +isearch.el --- iseach (and query-replace) extensions -*- lexical-binding: t; -*- | ||
2 | |||
3 | ;;; From https://github.com/astoff/isearch-mb/wiki | ||
4 | |||
5 | (defun +isearch-cancel@add-search-to-history () | ||
6 | "Add search string to history also when canceling. | ||
7 | This should be used as `:before' advice on `isearch-cancel'." | ||
8 | (unless (string-equal "" isearch-string) | ||
9 | (isearch-update-ring isearch-string isearch-regexp))) | ||
10 | |||
11 | (defun +perform-replace-dont-exit-on-anykey (orig &rest args) | ||
12 | "Don't exit replace for anykey that's not in `query-replace-map'. | ||
13 | This should be used as `:around' advice for `perform-replace'." | ||
14 | (save-window-excursion | ||
15 | (cl-letf* ((lookup-key-orig | ||
16 | (symbol-function 'lookup-key)) | ||
17 | ((symbol-function 'lookup-key) | ||
18 | (lambda (map key &optional accept-default) | ||
19 | (or (apply lookup-key-orig map key accept-default) | ||
20 | (when (eq map query-replace-map) 'help))))) | ||
21 | (apply orig args)))) | ||
22 | |||
23 | (provide '+isearch) | ||
24 | ;;; +isearch.el ends here | ||