From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Thorpe Newsgroups: gmane.emacs.help Subject: Re: [SOLVED with `eval']: Why I cannot use this variable in macro call from function? Date: Fri, 11 Jun 2021 07:33:10 +0100 Message-ID: <87lf7g9ahl.fsf@robertthorpeconsulting.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26769"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 11 08:34:29 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrakO-0006kM-SX for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 11 Jun 2021 08:34:28 +0200 Original-Received: from localhost ([::1]:34576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrakN-0005em-VS for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 11 Jun 2021 02:34:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrajw-0005eY-Oj for help-gnu-emacs@gnu.org; Fri, 11 Jun 2021 02:34:01 -0400 Original-Received: from outbound-smtp07.blacknight.com ([46.22.139.12]:39999) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrajs-0002yc-Ta for help-gnu-emacs@gnu.org; Fri, 11 Jun 2021 02:34:00 -0400 Original-Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp07.blacknight.com (Postfix) with ESMTPS id 4CD231C373C for ; Fri, 11 Jun 2021 07:33:52 +0100 (IST) Original-Received: (qmail 24836 invoked from network); 11 Jun 2021 06:33:52 -0000 Original-Received: from unknown (HELO rt-inspiron-3480) (rt@robertthorpeconsulting.com@[109.76.69.158]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 11 Jun 2021 06:33:52 -0000 In-Reply-To: (message from Jean Louis on Thu, 10 Jun 2021 09:56:04 +0300) Received-SPF: pass client-ip=46.22.139.12; envelope-from=rt@robertthorpeconsulting.com; helo=outbound-smtp07.blacknight.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:130749 Archived-At: Jean Louis writes: > Definitely good idea and now I was thinking there is some description > pointing to it and have looked into `completing-read' and > `read-from-minibuffer' and found nothing, I have to provide a variable > or cons with variable to those functions. It is good idea definitely, > but show me the practical way how to use alist or hash in those > functions. AFAICT, What you need to do is to populate a variable from the alist. Then= pass that variable to to `completing-read' or `read-from-minibuffer'. >> You have a function that creates one of those variables. Why not >> replace it with a function that enters the information in a global >> alist? Then you only need one global variable. Then when you need to >> call "completing-read" use an assoc to find the sub-list to use.o > > Your ideas go to the root or to depth of the problem. But how > practically to do that? I don't want to change those functions, I > want to pass something to them which will have dynamic names or > arguments. I could assign a single global buffer-local variable > that keeps the name of the edited column, and the function passed > could then find that variable and fetch from alist. > > But how? I'm not sure what you mean here. In one global alist you could put lots and lots of information. There could be an entry for each history list that you need. I don't see why you need to pass around functions here. > (read-from-minibuffer PROMPT &optional INITIAL-CONTENTS KEYMAP READ > HIST DEFAULT-VALUE INHERIT-INPUT-METHOD) > > Fifth arg HIST, if non-nil, specifies a history list and optionally > the initial position in the list. It can be a symbol, which is the > history list variable to use, or a cons cell (HISTVAR . HISTPOS). > In that case, HISTVAR is the history list variable to use, and > HISTPOS is the initial position for use by the minibuffer history > commands. For consistency, you should also specify that element of > the history as the value of INITIAL-CONTENTS. Positions are counted > starting from 1 at the beginning of the list. If HIST is the symbol > =E2=80=98t=E2=80=99, history is not recorded. > > It works this way: > > (let ((history '("One" "Two" "Three"))) > (read-from-minibuffer "Tell me: " nil nil nil 'history)) > > Not this way: > > (let ((history (lambda () '("One" "Two" "Three")))) > (read-from-minibuffer "Tell me: " nil nil nil 'history)) > > Or this way: > > (let ((history '("One" "Two" "Three"))) > (read-from-minibuffer "Tell me: " nil nil nil '(history . 1))) None of those three work for me. That is, none give a history list. BR, Robert Thorpe