unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Robert Thorpe <rt@robertthorpeconsulting.com>
To: Jean Louis <bugs@gnu.support>
Cc: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <87lf7g9ahl.fsf@robertthorpeconsulting.com> (raw)
In-Reply-To: <YMG3hEIiEzhII/bP@protected.localdomain> (message from Jean Louis on Thu, 10 Jun 2021 09:56:04 +0300)

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	other threads:[~2021-06-11  6:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 13:10 Why I cannot use this variable in macro call from function? Jean Louis
2021-06-08 13:41 ` [External] : " Drew Adams
2021-06-08 14:47   ` Jean Louis
2021-06-08 17:14   ` Jean Louis
2021-06-08 18:31     ` tomas
2021-06-08 18:37       ` Oops function? tomas
2021-06-08 19:27       ` [SOLVED with `eval']: Why I cannot use this variable in macro call from function? Jean Louis
2021-06-08 20:03         ` tomas
2021-06-08 20:06           ` Sorry again tomas
2021-06-08 20:12           ` [SOLVED with `eval']: Why I cannot use this variable in macro call from function? Jean Louis
2021-06-08 20:23             ` tomas
2021-06-08 20:38               ` Jean Louis
2021-06-08 20:47               ` Jean Louis
2021-06-09  6:09                 ` tomas
2021-06-09  6:42                   ` Jean Louis
2021-06-09  6:51                     ` tomas
2021-06-09  7:03                       ` Jean Louis
2021-06-09  7:39                         ` tomas
2021-06-09  8:22                           ` Jean Louis
2021-06-09  8:54                             ` tomas
2021-06-09 10:56                               ` Jean Louis
2021-06-09 11:33                                 ` tomas
2021-06-09 14:39                                   ` Jean Louis
2021-06-09 16:41                                     ` tomas
2021-06-10  2:10                                     ` Robert Thorpe
2021-06-10  6:56                                       ` Jean Louis
2021-06-11  6:33                                         ` Robert Thorpe [this message]
2021-06-11  7:03                                           ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf7g9ahl.fsf@robertthorpeconsulting.com \
    --to=rt@robertthorpeconsulting.com \
    --cc=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).