From 4fe8369dae93ca0010d5350ea3a81edabe79050e Mon Sep 17 00:00:00 2001 From: David Maus Date: Wed, 10 Aug 2011 07:28:41 +0200 Subject: [PATCH] New macro: Wrap let-binding of uninterned SYMBOLS around BODY * org-macs.el (org-with-gensyms): New macro. Wrap let-binding of SYMBOLS to new uninterned symbols around BODY. Use this macro to compose macros that need to bind their own symbols in expansion. It expands into a let-binding of all symbols in SYMBOLS to new uninterned symbols that cannot collide with symbols used in the target macro's expansion. --- lisp/org-macs.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 906be613a..d5c93da4a 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -47,6 +47,12 @@ (declare-function org-add-props "org-compat" (string plist &rest props)) (declare-function org-string-match-p "org-compat" (&rest args)) +(defmacro org-with-gensyms (symbols &rest body) + `(let ,(mapcar (lambda (s) + `(,s (make-symbol (concat "--" (symbol-name ',s))))) symbols) + ,@body)) +(put 'org-with-gensyms 'lisp-indent-function 1) + (defmacro org-called-interactively-p (&optional kind) (if (featurep 'xemacs) `(interactive-p) -- 2.11.4.GIT