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: Fwd: Choosing interactively from a list (starting off at any position) Date: Mon, 8 Dec 2014 11:19:09 -0800 Message-ID: References: <87bnng2mkh.fsf@bertrandrussell.Speedport_W_723V_1_36_000> <8761dnhgog.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 1418066397 8679 80.91.229.3 (8 Dec 2014 19:19:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Dec 2014 19:19:57 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 08 20:19:46 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 1Xy3qU-0007Za-DQ for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Dec 2014 20:19:46 +0100 Original-Received: from localhost ([::1]:35647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy3qT-0007hj-MX for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Dec 2014 14:19:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy3qG-0007he-E3 for help-gnu-emacs@gnu.org; Mon, 08 Dec 2014 14:19:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xy3qF-0005WT-AK for help-gnu-emacs@gnu.org; Mon, 08 Dec 2014 14:19:32 -0500 Original-Received: from mail-oi0-x229.google.com ([2607:f8b0:4003:c06::229]:36306) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy3qF-0005WJ-13 for help-gnu-emacs@gnu.org; Mon, 08 Dec 2014 14:19:31 -0500 Original-Received: by mail-oi0-f41.google.com with SMTP id a3so3875951oib.0 for ; Mon, 08 Dec 2014 11:19:30 -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 :content-type; bh=ePReYaMLP2r1xa6mh8v+zj4/ZGPuDL2rJHZEZRKjxu4=; b=KL5bnHNIWNtM92JaGGRB1YEoWeZ8K4Ju2OqioymoAOdur7gxnStXw8Vsz2L7mLOgYa xMuvUPgV09G4onVwOP35mbmi/RcawbMuOb+kPNDhapWFySVNYfFPtF+OHaV2G9cVDaNO KNsxUwptSyeU4VpU66ejvRunQjvMQNqnQkcW/76mLL4JswhFQyGhnOvKYKKB4pKOK/pS wMJGVdSoqmVuuHlFIAPRNDOrm82vgxtY0DjzAvhyQgdOkjBfiKpxlwKbMF2fqAoFt9m4 o8WZoRG3+0bXADu4rCrZtXnvHXvRHCmkc1IUklFKARiE279q1LiIf/ZDNqC98UGp00j6 vhsA== X-Received: by 10.60.177.41 with SMTP id cn9mr8744417oec.63.1418066370031; Mon, 08 Dec 2014 11:19:30 -0800 (PST) Original-Received: by 10.76.125.194 with HTTP; Mon, 8 Dec 2014 11:19:09 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::229 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:101478 Archived-At: Sigh, forgot to include the list when sending the below. Florian v. Savigny wrote: > Yes, this does work, but only forwards, not backwards. I would like to > go forwards with M-n and backwards (i.e. to the (index - 1)th element > of list) with M-p. Ah, indeed. It only appeared to work because of the completion packages I'm using (see below). > (It's interesting, BTW, that completing-read accepts an anonymous list > instead of a list variable name. It cannot possibly modify this > "history", can it?) Indeed, the history needs to be something it can modify. But it won't modify the list of choices. So, how about this? (defvar choose-from-list-history nil) (defun choose-from-list-cmplr (list &optional index) (setq choose-from-list-history list) (completing-read "Choose: " list nil t (nth index list) (cons 'choose-from-list-history index))) > In the problem I am working on, the ever-available completion is very > unhelpful - simply not the natural method of choosing -, because the > dates all start with one of just one, two or three different weekdays, > followed by the day of the month (still not unique). But whether the > date is one, two positions before or after today is almost always > relevant, because I am usually interested in the dates around today. Have you tried `ido' and the related packages out there? I'm using `ido', `ido-ubiquitous', `flx-ido', and `ido-vertical-mode'. I find it quite helpful even in situations like you describe, since you can type just the part(s) that are likely to matter. -- john