summaryrefslogtreecommitdiffstats
path: root/site/blog/Another_way_to_get_a_selection.org
blob: 29df13bd27ad5c4215cdb0963bf87be6d469af65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#+TITLE: Another way to get a selection
#+DATE: 2012-05-03 10:04:00
#+TAGS: emacs elisp org-mode coding

When I was first looking into improving my mailbox selection function
I was looking at how to just ask the user for input with completions.
Though now that I came across ~tmm-prompt~ I really prefer this way of
working, at least in this case.

However, today another function was mentioned, in response to someone
pointing out ~org-completing-read~: ~completing-read~.  Wow that's a far
leap.

Anyway:

#+BEGIN_SRC emacs-lisp
  (completing-read "Your favorite color: "
                   '("red" "green" "blue" "yellow"))
#+END_SRC

This will ask for user input and provide these options as completions,
but it won't show a list of options, of provide shortcuts, like
~tmm-prompt~ does.

It's good to know these things, and I really should read both the
emacs manual and the emacs lisp reference manual at some point.