[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Choosing interactively from a list
From: |
John Mastro |
Subject: |
Re: Choosing interactively from a list |
Date: |
Sat, 6 Dec 2014 19:33:08 -0800 |
Hi,
Florian v. Savigny <florian@fsavigny.de> wrote:
> I have a list, say ("A" "B" "C" "D" ... "Z" "a" "b" "c" "d"
> ... "z"). I also have an index, say 13. I would like to choose an item
> from this list in the minibuffer, and be able to go forward and
> backwards in this list, starting from the index, i.e. here, 13.
I don't know a way off-hand to do that without constructing a modified
version of the list (though I won't be surprised if someone chimes in
with one).
As an alternative, does this do something like what you're looking for?
(defun rotate-to-index (list index)
(append (cl-subseq list index)
(cl-subseq list 0 index)))
(defun choose-from-list-cmplr (list &optional index)
(completing-read "Choose: "
(if index (rotate-to-index list index) list)
nil
t))
--
john