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: Choosing interactively from a list (starting off at any position) Date: Sun, 07 Dec 2014 11:56:15 +0100 Message-ID: <8761dnhgog.fsf@bertrandrussell.Speedport_W_723V_1_36_000> References: <87bnng2mkh.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 1417949824 12177 80.91.229.3 (7 Dec 2014 10:57:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Dec 2014 10:57:04 +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 Sun Dec 07 11:56:57 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 1XxZWK-0003mf-6A for geh-help-gnu-emacs@m.gmane.org; Sun, 07 Dec 2014 11:56:56 +0100 Original-Received: from localhost ([::1]:57632 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxZWJ-0001I8-RV for geh-help-gnu-emacs@m.gmane.org; Sun, 07 Dec 2014 05:56:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxZW1-0001I1-OB for help-gnu-emacs@gnu.org; Sun, 07 Dec 2014 05:56:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XxZVu-0004rk-7G for help-gnu-emacs@gnu.org; Sun, 07 Dec 2014 05:56:37 -0500 Original-Received: from srv4.ns-domain-hosting.de ([178.63.89.203]:41768) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxZVt-0004rI-Ul for help-gnu-emacs@gnu.org; Sun, 07 Dec 2014 05:56:30 -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 4DC0918687F; Sun, 7 Dec 2014 11:56:29 +0100 (CET) In-reply-to: (message from John Mastro on Sat, 6 Dec 2014 19:33:08 -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:101464 Archived-At: Hi John, thanks for your ideas! > As an alternative, does this do something like what you're looking fo= r? >=20 > (defun rotate-to-index (list index) > (append (cl-subseq list index) > (cl-subseq list 0 index))) >=20 >=20 > (defun choose-from-list-cmplr (list &optional index) > (completing-read "Choose: " > (if index (rotate-to-index list index) list) > nil > t)) 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. (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?) The practical context is that I have a long, long file which contains a lot of dates in chronological order, some of which are usually past, one perhaps today's date, and the rest is in the future. I would like to devise a convenient and orderly method of jumping to any of these dates, starting off at the most current date, i.e. either today's or next. (It is actually much like moving back and forth in a calendar or diary.) I have written all of that, and with read-from-minibuffer, it works fine, so there is no pressing need to solve it. (That the user can enter non-existant dates is not a practical problem because I am the user, and I know better.) I have just become really curious about why the two functions seem to work differently with respect to the minibuffer history. On a more fundamental note, it has made me start wondering if minibuffer completion and history might be worth supplementing with further kinds of user input methods. (Because the minibuffer stuff is really just a hack; that's not what histories are there for.) 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. As Lisp is a list-processing language, it seems to me that an input method which works like that should come easy to Emacs, and that somebody might already have written something as basic as that. Does anybody know of anything ... ? Best regards! Florian --=20 Florian von Savigny Melanchthonstr. 41 33615 Bielefeld