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: Thu, 10 Jun 2021 03:10:53 +0100

I just want to say a couple of things about this.

I think you should read the Emacs lisp manual more.  Or maybe even
another book on Lisp.  Understanding of scope is important.  So are
macros and quoting if you're using them.

For the snippet of code that Tomas gives I get the same result:
>  (let ()
>    (let ((x 42))
>      (eval '(progn (setq x 43) (message "in eval: x is %S" x)))
>      (message "inner let: x is %S" x))
>    (message "outer let: x is %S" x))

Gives:

> in eval: x is 43
> inner let: x is 42
> outer let: x is 43
> "outer let: x is 43"

I don't get any errors.

However, I think that your problem doesn't really require any of that
complexity.  I think it can be done with an Alist.

Why not save all of your histories into one alist?  Instead of an alist
you could use a hash.  I don't see why you have to create a set of new
global variables to solve the problem.

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.

BR,
Robert Thorpe



reply via email to

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