While there are org-templates creating entire bullet points with content, what I am looking for is a simple user query (similar to read-string
) where the user can use a pre-defined list of words/phrases to choose from (up/down or left/right arrow keys).
Background:
I am with our IT department and among other things order hardware for our users. Once an order is out I would like to tell them when their hardware is expected to arrive. The general text stays the same, but I would like to choose the week's workdays from a list to complete this text snippet. Plus points, if I can have a second choice based on the first to choose this or next week. This means when I choose "today" or "tomorrow", it shall not ask for the week. Likewise choosing "Monday" or "Tuesday" shall fix the second choice to "next week" (since otherwise I could have chosen "today" or "tomorrow" if it were this week).
Simplified result (with choices highlighted):
I ordered your hardware and it is estimated to arrive Wednesday
next week
.
Currently I realize that snippet with a script inside the aging AutoKey GTK application, but would love to consolidate what I have there into Emacs. I already have my phrase templates as well as full-auto scripts in Emacs, but I am struggling to get the user input stuff to work the way I would like to have it.
read-string
has a history argument, but I am not sure if one can misuse(?) that for what I intend. Being still fairly new to elisp, maybe there are better or more sophisticated ways to do so. Since Emacs' built-in help as well as most online resources are notoriously sparse on examples to demonstrate its capabilities, an example would go a long way.