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: Jean Louis
Subject: Re: [SOLVED with `eval']: Why I cannot use this variable in macro call from function?
Date: Wed, 9 Jun 2021 13:56:45 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* tomas@tuxteam.de <tomas@tuxteam.de> [2021-06-09 11:54]:
> On Wed, Jun 09, 2021 at 11:22:38AM +0300, Jean Louis wrote:
> > * tomas@tuxteam.de <tomas@tuxteam.de> [2021-06-09 10:40]:
> > > You snipped the (for me) interesting part: did you notice how
> > > `eval' jumps over the local declaration?
> > 
> > Do you mean variables within `let'?
> 
> Yes, it doesn't see them :)

Maybe in theory it does not see, but in reality it does see it as
`list' is evaluated before `eval', so the interned `rcd-symbol' and
variable `description' they get evaluated before `eval'.

(defun rcd-db-completing-table-history (table)
  "Return symbol of history variable for TABLE.

If TABLE is \"businesses\" the symbol will become
`rcd-db-completing-table-history-businesses' and it will be used
for functions `completing-read' and `read-from-minibuffer'
history.

If a dynamically generated variable does not exist, it will be
generated on the fly."
  (let ((rcd-symbol (intern (concat "rcd-db-completing-table-history-" table)))
        (description (format "History for table `%s'" table)))
    (if (boundp rcd-symbol)
        rcd-symbol
      (eval (list 'defvar rcd-symbol nil description)))))

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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