From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: One-off history for read-string Date: Sat, 26 Sep 2015 09:46:28 +0200 Message-ID: <87io6xbp2j.fsf@mbork.pl> References: <87y4fwt3vq.fsf@mbork.pl> <87twqjpc9h.fsf@debian.uxu> <87oagrt1d0.fsf@mbork.pl> <87zj0arl88.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1443253629 1960 80.91.229.3 (26 Sep 2015 07:47:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Sep 2015 07:47:09 +0000 (UTC) To: "help-gnu-emacs\@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 26 09:47:04 2015 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 1ZfkCB-0001x5-3g for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Sep 2015 09:46:59 +0200 Original-Received: from localhost ([::1]:52298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfkCA-0000Na-LO for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Sep 2015 03:46:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfkC0-0000NN-Kv for help-gnu-emacs@gnu.org; Sat, 26 Sep 2015 03:46:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfkBv-0001GH-VM for help-gnu-emacs@gnu.org; Sat, 26 Sep 2015 03:46:48 -0400 Original-Received: from mail.mojserwer.eu ([2a01:5e00:2:52::8]:36906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfkBv-0001Eq-OC for help-gnu-emacs@gnu.org; Sat, 26 Sep 2015 03:46:43 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id D43496F2009 for ; Sat, 26 Sep 2015 09:46:39 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5PNAByR920sA for ; Sat, 26 Sep 2015 09:46:37 +0200 (CEST) Original-Received: from localhost (103-115.echostar.pl [213.156.103.115]) by mail.mojserwer.eu (Postfix) with ESMTPSA id B16166F2008 for ; Sat, 26 Sep 2015 09:46:37 +0200 (CEST) In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a01:5e00:2:52::8 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:107365 Archived-At: On 2015-09-26, at 04:33, John Mastro wrote: > Emanuel Berg wrote: > >> > However, I don't care about /writing/ it to some >> > variable in Emacs, since the new entry will be >> > uploaded to the server anyway, and taken from there >> > the next time, together with the rest of >> > the history. >> >> So then, what does it matter? > > He wants history to be available to the user (e.g. `M-p'), but he wants > that history to come from a server rather than be accumulated in the > usual way. So the history on the server is likely changing over time, > but from the Lisp code's perspective it's conceptually a new list each > time. Yes. > Something like this, if I understand him correctly: Yes, you do. > (defvar readonly-history) > > (defun get-history-list-from-server () > ;; Imagine we fetch this list of HTTP > (list "foo" "bar" "baz" "quux")) > > (defun my-read-string (prompt) > (let ((readonly-history (get-history-list-from-server))) > (read-string prompt nil 'readonly-history))) And this is exactly what I'm doing now, modulo variable names (and get-history-list-from-server, which is really (mapcar #'get-piece-of-history a-big-datastructure-got-from-the-server) or really (mapcar #'get-piece-of-history (cdr (assoc 'datastructure-key an-even-bigger-alist-of-similar-but-unrelated-datastructures-got-from-the-server) Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University