~protesilaos/substitute

c6fb22fe78017c0cb84ac522512b9a891a4e5751 — Protesilaos Stavrou 1 year, 10 months ago cc09df1
Enable empty string substitution

We could not do that with 'read-string' as the empty input is
automatically interpreted as the value of the DEFAULT-VALUE argument.
This is standard for most Emacs minibuffer interactions, though in our
case it makes sense to accept an empty string, as we may, e.g., want
to remove a prefix from a target.

Thanks to Kostas Andreadis for discussing this with me in issue 2 on
the GitHub mirror as well as pull request 3:

- <https://github.com/protesilaos/substitute/issues/2>
- <https://github.com/protesilaos/substitute/pull/3>
1 files changed, 2 insertions(+), 2 deletions(-)

M substitute.el
M substitute.el => substitute.el +2 -2
@@ 113,11 113,11 @@ and related."
  "Prompt for string while referencing TARGET and SCOPE."
  (let ((pretty-target (substitute--prettify-target-description target)))
    (substitute--collect-targets target scope)
    (read-string
    (read-from-minibuffer
     (format "Substitute `%s' %s with: "
             (propertize pretty-target 'face 'error)
             (substitute--scope-description scope))
     nil
     nil nil nil
     'substitute--history
     pretty-target)))