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

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

Re: [External] : Re: Why is defun not executed during load-file?


From: Jean Louis
Subject: Re: [External] : Re: Why is defun not executed during load-file?
Date: Mon, 7 Jun 2021 09:27:58 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* Emanuel Berg via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> [2021-06-07 05:20]:
> OK so the hierarchy is:
> 
> 1. `defun' (best)
> 2. `defmacro' (at least better than `eval')
> 3. eval (worse)

No need for panic. There is nothing so special that can take place
with `eval' that cannot take place with `defun' or any bad
programming. We already said Org is eval-ing so much. Every Babel
source block in Org mode is eval-ed.

8 matches for "(eval " in buffer: org.el
   8421:    (eval `(let ,binds
   9329:                               (or (eval checklist)
  12473:              (setq scope (eval scope)))
  14231:    (eval form)
  14645:         (result (if calendar-debug-sexp (eval sexp)
  14647:                       (eval sexp)
  16525:      (eval org-speed-command))
  18337:                        (not (equal (symbol-value v) (eval (car (get v 
'standard-value)))))))

Org from Org babel:

(defun org-babel-execute:emacs-lisp (body params)
  "Execute a block of emacs-lisp code with Babel."
  (let* ((lexical (cdr (assq :lexical params)))
         (result-params (cdr (assq :result-params params)))
         (body (format (if (member "output" result-params)
                           "(with-output-to-string %s\n)"
                         "(progn %s\n)")
                       (org-babel-expand-body:emacs-lisp body params)))
         (result (eval (read (if (or (member "code" result-params)


I have been `eval'-ing for years by using Perl, by using Common Lisp
and now Emacs Lisp especially when it comes to replacement of text,
variables, or keeping some program code in the database.

Each time you press C-x C-e you are `eval'-ing

Some data has to be eval-ed and some data arrives from other places
but program file, or is generated in some way and there is nothing
wrong with using `eval' wherever it is required.


-- 
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]