Questions tagged [macroexpansion]

7 questions
3
votes
2 answers

Why does pp-macroexpand return nonsense for cl-loop?

Consider the following cl-loop: (cl-loop for x across "abc" for y across "123" concat (string x y)) This evaluates to "a1b2c3", i.e. it zips both strings together. However, if I look at the expansion of cl-loop it seems like that…
Zeta
  • 1,045
  • 9
  • 18
3
votes
1 answer

Why does `make-symbol` work in macro expansion, just as `gensym` works?

In the dash library I noticed the use of make-symbol to avoid symbol conflicts during macro expansion. (defmacro --filter (form list) "Anaphoric form of `-filter'. See also: `--remove'." (declare (debug (form form))) (let ((r (make-symbol…
Aquaactress
  • 1,393
  • 8
  • 11
1
vote
1 answer

Why are `defvars` in my macro ignored?

I want to use a macro to define variables. However, evaluating the macro does not define these vars. I seem to be missing something, but I can't find it. Here's the code: (defmacro delve--build-cmp (name desc sort-fn-asc sort-fn-desc slot-fn…
1
vote
0 answers

Navigating to a `defconst` variable defined by a Lisp macro

My goal is to define a const variable within a non-trivial macro that can be navigated to after calling describe-variable. The design goal of my macro works just fine if I define it like so: (defmacro test (symbol) `(defconst ,symbol nil)) (test…
John DeBord
  • 550
  • 3
  • 13
1
vote
1 answer

org-mode text expansion macro in src block

Is it possible to use an org-mode #+MACRO: in an org-babel block? I'm getting this in the #+RESULTS: block when I evaluate the src block with C-c C-c: #+MACRO: COMPILE_FLAGS -std=c99 -Wall -Werror -pedantic #+begin_src shell echo…
Alex Shroyer
  • 627
  • 4
  • 12
0
votes
1 answer

How to use the same variable name with let when calling defmacro?

This is only an example, I understand this can easily be achieved with a function. Don't Work This is what I've come up with based on the elisp manual and a couple of answers/articles that I have read. The suggestion is to use gensym, but I can't…
Rick
  • 25
  • 4
0
votes
1 answer

The call stack result of profile-report doesn't match the real function codes

I'm trying to figure out why my emacs was slow tonight and found: - command-execute 82796 87% - call-interactively 82792 87% - funcall-interactively …
Chen Li
  • 137
  • 1
  • 7