[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why is defun not executed during load-file?
From: |
Stefan Monnier |
Subject: |
Re: Why is defun not executed during load-file? |
Date: |
Sun, 30 May 2021 09:31:18 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Jean Louis [2021-05-30 12:02:25] wrote:
> I have this in the hyperscope.el and upon load-file the last function
> is not executed, it does not generate the functions. But if I evaluate
> it specifically, it generates functions.
>
> Is there any reason for that?
>
> (defun hyperscope-generate-the-add-function-by-hyperdocument-type (type-name
> id function-name)
> (eval `(defun ,(intern (symbol-name function-name)) ()
My crystal ball says it's punishment for using `eval` and recommends
using macro(s) instead. I wouldn't trust its judgment, but the
recommendation sounds useful anyway.
BTW, `intern + symbol-name` ends up a no-op if `function-name` is
already an interned symbol.
Stefan
Re: Why is defun not executed during load-file?, Emanuel Berg, 2021/05/30