I am trying to have a dynamic prompt from my elisp function. I want something like replace-regexp where it will show you the last regexp entered. I tried (interactive (concat ‘sab’ ‘bab’))) that doesnt work!
I also tried message like format (interactive ‘s %s’ last-used-regexp)
and that doesn’t work! Anyone know how to do this?
Thank you!
M-x find-functionis your friend. It will tell you how anything in emacs works by showing you the source code. Using it, I find thatquery-regexp-replacecallsquery-replace-read-argswhich callsquery-replace-read-fromwhich callsread-from-minibufferusing a prompt created from the last used regexp, which is saved in the dotted pairquery-replace-defaults.So:
is a command that throws up a prompt with the last entered regexp as the default.