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

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

Re: Printing code made by a macro


From: Eduardo Ochs
Subject: Re: Printing code made by a macro
Date: Sat, 5 Aug 2023 21:31:09 -0300

On Sat, 5 Aug 2023 at 20:43, Heime <heimeborgia@protonmail.com> wrote:

>
> Is there a proper way to display the code produced by a macro ?  Perhaps
> call
> a function to print it by passing the macro command ?
>
> (print-code (mymacro (* 2 3) (* 5 8) ))
>
> Which would print (+ 3 8)
>
> How would one write print-code ?
>

 Hi Heime,

eev has a function, called "find-eppm", that takes a sexp, expands it
with macro-expand, pretty-prints the expansion, and displays the
pretty-printed code in a temporary buffer. If you'd like to try it,
install eev, run this,

  (require 'eev-load)

and then type `C-x C-e' after the last parenthesis here:

  (find-eppm '

  (define-minor-mode MAIN-mode
    "Help 1"
    :init-value t
    :global t
    :lighter (propertize " MAIN" 'face 'region))

  )

The reason for the "(require 'eev-load)" is explained here:

  http://anggtwu.net/eev-intros/find-eev-quick-intro.html#1
  http://anggtwu.net/eev-current/eev-load.el.html#autoloads

Cheers,
  Edrx


reply via email to

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