From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: florian@fsavigny.de (Florian v. Savigny) Newsgroups: gmane.emacs.help Subject: Re: Fwd: Choosing interactively from a list (starting off at any position) Date: Mon, 08 Dec 2014 23:51:33 +0100 Message-ID: <87oardah6y.fsf@bertrandrussell.Speedport_W_723V_1_36_000> 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 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1418079138 21660 80.91.229.3 (8 Dec 2014 22:52:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Dec 2014 22:52:18 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: John Mastro Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 08 23:52:11 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 1Xy7A2-0003Qc-81 for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Dec 2014 23:52:10 +0100 Original-Received: from localhost ([::1]:36498 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy7A1-0003XE-G7 for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Dec 2014 17:52:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy79j-0003X2-9B for help-gnu-emacs@gnu.org; Mon, 08 Dec 2014 17:51:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xy79V-0008FR-Cl for help-gnu-emacs@gnu.org; Mon, 08 Dec 2014 17:51:51 -0500 Original-Received: from srv4.ns-domain-hosting.de ([178.63.89.203]:58621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy79V-0008F5-3p for help-gnu-emacs@gnu.org; Mon, 08 Dec 2014 17:51:37 -0500 X-No-Relay: not in my network X-No-Relay: not in my network Original-Received: from bertrandrussell.Speedport_W_723V_1_36_000 (p548BE8C7.dip0.t-ipconnect.de [84.139.232.199]) by srv4.ns-domain-hosting.de (Postfix) with ESMTPSA id 7C62318687F; Mon, 8 Dec 2014 23:51:36 +0100 (CET) In-reply-to: (message from John Mastro on Mon, 8 Dec 2014 11:19:09 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 178.63.89.203 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:101479 Archived-At: Hi John, > Indeed, the history needs to be something it can modify. But it won't > modify the list of choices. So, how about this? >=20 > (defvar choose-from-list-history nil) >=20 > (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))) This comes indeed closer, although - can you explain why? Did it have to do with the history variable???? (I actually had not made any such connection myself.) I changed two aspects: (defun choose-from-list-cmplr (list &optional index) (setq choose-from-list-history (reverse list)) ;; ^^^^^^^^ (completing-read "Choose: " list nil t (nth index list) (cons 'choose-from-list-history (1- index)))) ;; ^^^ because without the reverse, M-n and M-p work counter-intuitively, and the 1- because the index that completing-read uses in the history is 1-based, not 0-based, like in lists. (But then, why did I subtract 1, rather than add 1?) > Have you tried `ido' and the related packages out there? I'm using > `ido', `ido-ubiquitous', `flx-ido', and `ido-vertical-mode'. I find i= t > quite helpful even in situations like you describe, since you can typ= e > just the part(s) that are likely to matter. No, I haven't, but I use icicles, which provides a gazillion methods of doing completion with less keystrokes. (I have understood one or two of them so far.) I am not sure if ido is basically different. But my point is that I do not want to type ANY part of the date I am looking for; rather, I want to choose according to a logic of "it's before the date offered" and "it's after the date offered". Or perhaps, "I want the first date" or "I want the last date". The parts of dates are not like the strings you usually look for, but, apart from numbers you can easily get wrong, weekdays which occur in many of the dates. Thus, although each date is unique, this uniqueness is very difficult to spot for a human because identical parts are only mixed differently. (Spelled-out months would make choosing easier, but the usual German date format uses the numbers 1 to 12 for them.) And a helpful feature they DO have, in contrast, is a strict (chronlogical) ORDER. But your solution works perfectly - thanks a lot for your ideas!! I would still like to understand why it works, though. ;-) --=20 Florian von Savigny Melanchthonstr. 41 33615 Bielefeld