Questions tagged [elisp-macros]

Emacs Lisp macros enable you to define new control constructs and other language features. A macro is defined much like a function, but instead of telling how to compute a value, it tells how to compute another Lisp expression, which in turn is evaluated to compute the value. We call this expression the "expansion" of the macro call. The macro call is first expanded and then evaluated, returning the value of that evaluation.

9 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
72 views

Evaluate some arguments to macro immediately

I am trying to call a macro (defined somewhere else; I can't change it), but I want to evaluate some of the arguments before the macro is expanded. Is this possible? For example: (defmacro foo (&...
3
votes
0answers
310 views

Byte-compiling a file loads macros with `(eval-and-compile)` but not `(eval-when-compile)`

I created a buffer, test1.el: (eval-when-compile (defmacro dummy-macro (_) nil) (dummy-macro s)) Trying to compile this file, I get the following errors: In toplevel form: test1.el:3:16:Warning:...
2
votes
0answers
142 views

On using Elisp macros for partial application

I want to improve my Elisp, but despite reading about the differences between functions and macros (including discussions here in Emacs SE and on Reddit), I still find examples where the distinction ...
1
vote
0answers
39 views

Autodocument function for C Code

Suppose i have this line of code presenting a C function prototype: int sum_Func(int a, int *b) I want an Emacs lisp function that adds the function description (initialization) according to its ...
1
vote
0answers
34 views

does this routine exist? until (while until true)

I found myself needing this control loop and was very surprised not to find it in the standard library. Does it exist by some other name? (defmacro until (form &optional guard) "Runs `while' on ...
1
vote
0answers
51 views

Macro expansion inside quail-define-rules

Why can't I expand a macro inside (quail-define-rules)? (defmacro quail-test () `("c" ["success!"])) (quail-define-package "experiment" "Experiment" "X" t ...
1
vote
0answers
697 views

Understanding Emacs macro and org mode tikz behavior

I found this discussion, and the last response gives this code: #+TITLE: Test #+AUTHOR: Blah #+LATEX_CLASS: article #+LATEX_CLASS_OPTIONS: [american] # # Setup tikz package for both LaTeX and HTML ...
1
vote
0answers
78 views

How do I teach edebug to only evaluate some macro arguments?

Currently, edebug doesn't understand the ->> macro in dash.el. (defun foo () (->> (+ 1 1) (+ 2) (* 3) (format "%s"))) C-u M-x edebug-eval-defun followed by M-: (...
0
votes
0answers
73 views

with-accessors for all accessors?

common lisp has a with-accessors macro which is pretty useful but it is still prone to lots of code duplication. Is there a convenient let/binding macro that makes all accessors from a defclass ...