benma / visual-regexp.el

A regexp/replace command for Emacs with interactive visual feedback
392 stars 28 forks source link

Replace with empty string: `Symbol’s value as variable is void: vr/match-separator-string` #42

Closed joostkremers closed 7 years ago

joostkremers commented 7 years ago

Hi,

There seems to be a bug in the way the variable vr/match-separator-string is initialised. Recipe to reproduce:

$ emacs -Q -L /path/to/visual-regexp/

Then in Emacs:

M-: (require 'visual-regexp)
C-x C-f <some-file> RET
M-x vr/query-replace RET
<some regex with matches> RET

Then, when asked for a replacement string, simply hit RET, i.e., leave the replacement string empty.

At this point, I get the error:

vr--perform-query-replace: Symbol’s value as variable is void: vr/match-separator-string

C-h v vr/match-separator-string RET indicates this as well:

vr/match-separator-string is a variable defined in ‘visual-regexp.el’.
It is void as a variable.

Documentation:
This string is used to separate a match from the replacement during feedback.

You can customize this variable.

Notice the It is void as a variable line where the value should appear.

If I call vr/query-replace again and then pick the previous search/replace pair (with the empty replacement string) from the minibuffer history, everything works fine.

This is on Emacs 25.1.2, visual-regexp 20160806.610 installed from Melpa (should be the most recent version, as I just updated my packages a few minutes ago).

benma commented 7 years ago

Thanks for the report. I pushed a fix, please try it out.

joostkremers commented 7 years ago

Yes, it works now. Thanks!