Xah Lee has a nice post up dealing with getting user input with completion and history in Emacs. I usually just use interactive with “s” or possibly “f” or “F” but Lee shows us a better way.
Did you know that there are functions specifically for reading path names and regular expressions? I didn’t but I can already see how they can be useful especially given the completion functionality. In particular, the read-regexp
function is useful because the user can enter the regular expression without worrying about double escaping everything:
^\(ab*\.xxx\)$ → ^\\(ab*\\.xxx\\)$