0

How can I read a single input from minibuffer ,
and provide a default value at the same time so he can just enter to accept?

1 Answer 1

1
(string-to-char
  (read-string "Char (or the first char of your input string): "
               nil nil
               ;; Default:
               "👀"))

If you use functions like read-char, it will be difficult to distinguish between the default value and the keystroke of <return>. (You cannot use C-q, because it just issues the char ?\C-q.

1
  • the keystroke of <return>” -- I mean ?\C-m.
    – shynur
    Aug 16 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.