Commit 2cf4dc5a authored by Marko Bencun's avatar Marko Bencun

fix query-replace-defaults compatibility with emacs 24

In Emacs 24, this was only a (cons from to). In Emacs 25, it became a
list of (cons from to).

This patch separates the defaults from vr and Emacs' builtin replace, so
search/replacing in one does not affect the defaults display of the

In Emacs 25, the two remain fully compatible.
parent db0aab03
......@@ -198,7 +198,15 @@ If nil, don't limit the number of matches shown in visual feedback."
:type 'symbol
:group 'visual-regexp)
(defcustom vr/query-replace-defaults-variable 'query-replace-defaults
(setq vr--is-emacs24 (version< emacs-version "25"))
(defvar vr--query-replace-defaults nil
"Same as query-replace-defaults from Emacs 25, for compatibility with Emacs 24.")
(defcustom vr/query-replace-defaults-variable
(if vr--is-emacs24
"History of search/replace pairs"
:type 'symbol
:group 'visual-regexp)
......@@ -715,8 +723,7 @@ visible all the time in the minibuffer."
nil vr/minibuffer-keymap
nil vr/query-replace-to-history-variable))
(add-to-history vr/query-replace-to-history-variable vr--replace-string nil t)
(add-to-history vr/query-replace-defaults-variable (cons vr--regexp-string vr--replace-string))
(add-to-history vr/query-replace-defaults-variable (cons vr--regexp-string vr--replace-string)))))))
(defun vr--interactive-get-args (mode calling-func)
"Get interactive args for the vr/replace and vr/query-replace functions."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment