History of 2017-02-18 Using isearch-string on exit from isearch

2017-02-18
16:05 UTC Revision 1 . . . . Marcin BorkowskiRecently, I wanted my function, which asks the user for some string, use the isearch term as the default. That’s easy – the variable isearch-string holds the term searched (note that it may be a plain string or a regex!). The problem was, I wanted that to be the default only when I invoked my command from isearch (sort of what M-% does when called from within isearch). The way M-% does its magic when invoked during isearch is simple: in isearch-mode-map, that key is bound to isearch-query-replace and not the usual query-replace. I didn’t want anything like that, though: I wanted my command to be callable via M-x.