[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/relint 7dab4f2 4/7: Slight macro safety improvement
From: |
Mattias Engdegård |
Subject: |
[elpa] externals/relint 7dab4f2 4/7: Slight macro safety improvement |
Date: |
Thu, 5 Mar 2020 10:21:26 -0500 (EST) |
branch: externals/relint
commit 7dab4f25800d3c016fc1a9d52ff59cfbad39905a
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Slight macro safety improvement
Use 'macroexpand-1' instead of 'macroexpand' to get better control
over macro expansion. Some of the 'safe' macros are still potential
loose cannons, since they may expand their arguments eagerly.
---
relint.el | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/relint.el b/relint.el
index 612bd73..f231f28 100644
--- a/relint.el
+++ b/relint.el
@@ -711,11 +711,13 @@ not be evaluated safely."
(delete-dups (copy-sequence arg))))
;; Safe macros that expand to pure code, and their auxiliary macros.
+ ;; FIXME: Some of these aren't actually safe at all, since they
+ ;; may expand their arguments eagerly, running arbitrary code!
((memq head '(when unless
\` backquote-list*
pcase pcase-let pcase-let* pcase--flip
- cl-case cl-loop cl-flet cl-flet* cl-labels))
- (relint--eval (macroexpand form)))
+ cl-case cl-loop cl-block cl-flet cl-flet* cl-labels))
+ (relint--eval (macroexpand-1 form)))
;; catch: as long as nobody throws, this naïve code is fine.
((eq head 'catch)
@@ -1003,7 +1005,7 @@ evaluated are nil."
(relint--eval-list (cadr form)))
((memq (car form) '(\` backquote-list*))
- (relint--eval-list (macroexpand form)))
+ (relint--eval-list (macroexpand-1 form)))
((assq (car form) relint--safe-alternatives)
(relint--eval-list (cons (cdr (assq (car form) relint--safe-alternatives))
- [elpa] externals/relint updated (c2d3f3b -> 83e677d), Mattias Engdegård, 2020/03/05
- [elpa] externals/relint fd43a5f 2/7: Permit relint-current-buffer in *scratch*, Mattias Engdegård, 2020/03/05
- [elpa] externals/relint 67f4363 1/7: Don't erase the *relint* buffer from relint-buffer, Mattias Engdegård, 2020/03/05
- [elpa] externals/relint 7dab4f2 4/7: Slight macro safety improvement,
Mattias Engdegård <=
- [elpa] externals/relint 83e677d 7/7: Increment version to 1.15, Mattias Engdegård, 2020/03/05
- [elpa] externals/relint 8956b21 6/7: Check for mistakes in rx 'any' forms, Mattias Engdegård, 2020/03/05
- [elpa] externals/relint feba965 3/7: Add severity field to tuple returned from relint-buffer, Mattias Engdegård, 2020/03/05
- [elpa] externals/relint bc7f295 5/7: Better position accuracy in various lists of regexps, Mattias Engdegård, 2020/03/05