Created
January 20, 2013 03:56
-
-
Save ajvargo/4576587 to your computer and use it in GitHub Desktop.
An example of getting user input for an Elisp function with a default value divined from context.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun input-example (text) | |
"Gets user input and prints it back. Defaults to word at point" | |
(interactive | |
(list | |
(read-string | |
(format "Text (%s): " (word-at-point)) ; prompt. It's nice to show the default value | |
nil ; initial input. This value is prefilled in the mini-buffer. Available but considered deprecated. | |
nil ; history list if you have a specific one for this | |
(word-at-point) ; Whatever this evaluates to will be the default value | |
))) | |
(message (format "You said '%s'" text))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment