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

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

Re: never use `eval'


From: Emanuel Berg
Subject: Re: never use `eval'
Date: Thu, 16 Jul 2015 03:11:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

"Pascal J. Bourguignon" <pjb@informatimago.com>
writes:

> As mentioned, eval setq can be replaced by (setf
> symbol-value) or even set, if you like
> archaic forms.

Do I? Or do you? What do you mean?

But: which case is "eval setq"? From reading your
post, there are two OK uses, one that should be
a macro, and the rest `apply'?

> For defvar, and in general for operations like this
> set-color-face that _defines_ a symbol to bind it to
> some kind of object, what you should do is to write
> a define macro instead.

OK, thanks to all of you!

*Define* is exactly what I wanted to do, but I didn't
succeed and that is the reason for all those `defvars'
in the original code. The line you mentioned is
probably a leftover from an attempt to not have to
have those. Ironically, instead the macro is exactly
what I needed to not have to have them.

Now it looks ten times better:

    http://user.it.uu.se/~embe8573/conf/emacs-init/faces.el

> Notice:
>
>     command-history is a variable defined in `C source
>     code'. Its value is shown below.
>
>     Documentation: List of recent commands that read
>     arguments from terminal. Each command is represented
>     as a form to evaluate.
>
> So clearly, (eval (first command-history))
> is vetted.

I see: the other `eval' that is also "vetted" also
stems from `command-history'.

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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