help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SOLVED with `eval']: Why I cannot use this variable in macro call f


From: Robert Thorpe
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

Jean Louis <bugs@gnu.support> 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
>   ‘t’, 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]