summary refs log tree commit diff stats
path: root/lisp/+isearch.el
blob: 3516ec4b8745a72d3d49432e00d8474c0e184ae9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;;; +isearch.el --- iseach (and query-replace) extensions  -*- lexical-binding: t; -*-

;;; From https://github.com/astoff/isearch-mb/wiki

(defun +isearch-cancel@add-search-to-history ()
  "Add search string to history also when canceling.
This should be used as `:before' advice on `isearch-cancel'."
  (unless (string-equal "" isearch-string)
    (isearch-update-ring isearch-string isearch-regexp)))

(defun +perform-replace-dont-exit-on-anykey (orig &rest args)
  "Don't exit replace for anykey that's not in `query-replace-map'.
This should be used as `:around' advice for `perform-replace'."
  (save-window-excursion
    (cl-letf* ((lookup-key-orig
		(symbol-function 'lookup-key))
               ((symbol-function 'lookup-key)
		(lambda (map key &optional accept-default)
                  (or (apply lookup-key-orig map key accept-default)
                      (when (eq map query-replace-map) 'help)))))
      (apply orig args))))

(provide '+isearch)
;;; +isearch.el ends here