From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: Choosing interactively from a list Date: Sat, 6 Dec 2014 19:33:08 -0800 Message-ID: References: <87bnng2mkh.fsf@bertrandrussell.Speedport_W_723V_1_36_000> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1417923230 19185 80.91.229.3 (7 Dec 2014 03:33:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Dec 2014 03:33:50 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 07 04:33:44 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XxSbP-0002mQ-9I for geh-help-gnu-emacs@m.gmane.org; Sun, 07 Dec 2014 04:33:43 +0100 Original-Received: from localhost ([::1]:56304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxSbO-0004Rf-Sz for geh-help-gnu-emacs@m.gmane.org; Sat, 06 Dec 2014 22:33:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxSbD-0004RX-7Y for help-gnu-emacs@gnu.org; Sat, 06 Dec 2014 22:33:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XxSbC-0001ux-AO for help-gnu-emacs@gnu.org; Sat, 06 Dec 2014 22:33:31 -0500 Original-Received: from mail-oi0-x230.google.com ([2607:f8b0:4003:c06::230]:51674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxSbC-0001up-5B for help-gnu-emacs@gnu.org; Sat, 06 Dec 2014 22:33:30 -0500 Original-Received: by mail-oi0-f48.google.com with SMTP id u20so2101644oif.21 for ; Sat, 06 Dec 2014 19:33:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=7mCfzAyZT2k6gUhsdVtsxF9IffjXkpaWqZRUlqUOXD0=; b=ak9AK01JX8u1fgAxNTR2HM0rPPn50BaYCUTXRqo1oHdITs5gZGSVVZ1C/T/n3RBEZg D1if8LfXoxiYwmbYLYNlSGYavppysabJbjLGUsQiedPtQtckNp/ZdiAQ6YPO5/ULSkhE eS1Dq+NDJDBVFDwvqJInG9MBXkswD+wBl99CnlOLH1u6K8j7A4gqsL+Y4a5ZlQSiGrel g6OOGOsLbbQU5qXZzwABiucmwa0//1CWD6j5BojDRnXRMUJmk70Igm+Wm2bzBQ0fgzac w+wLpRPfpvXJLF5xvTcF5Q6rgvtbx3xljS9lpV3o4Vz4LTwb5L5yZphr6E8BzrE8LjGL qmfw== X-Received: by 10.182.81.98 with SMTP id z2mr15688317obx.35.1417923208511; Sat, 06 Dec 2014 19:33:28 -0800 (PST) Original-Received: by 10.76.125.194 with HTTP; Sat, 6 Dec 2014 19:33:08 -0800 (PST) In-Reply-To: <87bnng2mkh.fsf@bertrandrussell.Speedport_W_723V_1_36_000> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::230 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101459 Archived-At: Hi, Florian v. Savigny 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