From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.devel Subject: Re: HIST to read-from-minibuffer Date: Mon, 31 May 2010 12:52:17 +0100 Message-ID: References: <8739xgta9l.fsf@mail.jurta.org> <87ljb7q33m.fsf@mail.jurta.org> <87bpbx6wyd.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1275306761 19561 80.91.229.12 (31 May 2010 11:52:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 31 May 2010 11:52:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 31 13:52:34 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OJ3Xl-0004RP-Jo for ged-emacs-devel@m.gmane.org; Mon, 31 May 2010 13:52:33 +0200 Original-Received: from localhost ([127.0.0.1]:37184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJ3Xk-0006Md-Pe for ged-emacs-devel@m.gmane.org; Mon, 31 May 2010 07:52:32 -0400 Original-Received: from [140.186.70.92] (port=41593 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJ3Xb-0006Jj-Oa for emacs-devel@gnu.org; Mon, 31 May 2010 07:52:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJ3XX-000800-OG for emacs-devel@gnu.org; Mon, 31 May 2010 07:52:23 -0400 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:48183) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJ3XX-0007zq-KI for emacs-devel@gnu.org; Mon, 31 May 2010 07:52:19 -0400 Original-Received: by wyb39 with SMTP id 39so993348wyb.0 for ; Mon, 31 May 2010 04:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=TA8Znx19sogcyAaerwn+x5xyUzTXOj3fpUOsfNyjVwc=; b=UAzJDbt657YohadMjJD2iL88Lrcyk+w392vkYzyiE7wfIYqZkNEMxcy5hSGK5cOosi ujUaKQLNBhbiX3fXjDu8LqrruafJ+cPxVCFfhIqCT62YHFvQHYiQmi1jiowAfzjmlxIZ /JHvxhSxiuYsd/yRvaYmDXcG5NcTYCp2DkV6Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=YvJwI/7vRFXuZpi3QRitKIoKeUQf1Or6fDzg2G6RHSYs7fRQ/FC+DwD1/JLPekGmjH 7r4cJRAfokCC4kflodOns62NvUZTX4tUYmFJ8JK1bb8I6ic/2wFlYKZDBjjoZ4lAJrSY XIsrssXUB66QpDUfJAKZ/cExloVNRuU2OiG0I= Original-Received: by 10.216.172.134 with SMTP id t6mr4225638wel.23.1275306737609; Mon, 31 May 2010 04:52:17 -0700 (PDT) Original-Received: by 10.216.188.139 with HTTP; Mon, 31 May 2010 04:52:17 -0700 (PDT) In-Reply-To: <87bpbx6wyd.fsf@mail.jurta.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:125393 Archived-At: >> This bit is what confuses me: >> >> (hist . 0) >> =A0 =A0 =A0 =A0 ^ >> =A0 =A0 =A0 =A0 +----- why '0' here to mean first element? > > '(hist . 0) is the same as 'hist and means no history is used by default. > '(hist . 1) means the history is moved to the first history element. > > Please pay attention to this text in the docstring of `read-from-minibuff= er': > > =A0For consistency, you should also specify that > =A0element of the history as the value of INITIAL-CONTENTS. > > This means you have to insert the selected history element > as initial contents: > > =A0(let ((hist '("a" "b" "c"))) > =A0 =A0(read-from-minibuffer "Prompt: " (nth 1 hist) nil nil '(hist . 2))= ) > > Here you can see the difference - the same history element is > first in INITIAL-CONTENTS, but second in HIST. The elisp info is very clear on explaining the HIST argument. The doc string intends to say if you specify a cons cell you'd better have a HISTPOS >=3D 1; but then it uses "Positions are counted starting from 1 at the beginning of the list". When I first looked at it, I thought the HIST has a special index scheme than normal lists which it doesn't. This is where I am confused. But if others understand it fine, just ignore this. Best, Leo