From: John Mastro <john.b.mastro@gmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: Choosing interactively from a list
Date: Sat, 6 Dec 2014 19:33:08 -0800 [thread overview]
Message-ID: <CAOj2CQS=e+fRGgLoaON+avkzvhVXfYqb3doEUd=wwES9tUOYJQ@mail.gmail.com> (raw)
In-Reply-To: <87bnng2mkh.fsf@bertrandrussell.Speedport_W_723V_1_36_000>
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
next prev parent reply other threads:[~2014-12-07 3:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-07 2:58 Choosing interactively from a list Florian v. Savigny
2014-12-07 3:33 ` John Mastro [this message]
2014-12-07 10:56 ` Choosing interactively from a list (starting off at any position) Florian v. Savigny
[not found] ` <CAOj2CQQ45gZpmuQUsMNp=iokkbB1Wz2cWpy6ZKfZ=BzyoSY6xg@mail.gmail.com>
2014-12-08 19:19 ` Fwd: " John Mastro
2014-12-08 22:51 ` Florian v. Savigny
[not found] ` <<87oardah6y.fsf@bertrandrussell.Speedport_W_723V_1_36_000>
2014-12-09 2:20 ` Drew Adams
2014-12-09 19:52 ` John Mastro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOj2CQS=e+fRGgLoaON+avkzvhVXfYqb3doEUd=wwES9tUOYJQ@mail.gmail.com' \
--to=john.b.mastro@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).