summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2024-10-03 21:06:03 +0200
committerJonas Bernoulli <jonas@bernoul.li>2024-10-03 21:06:03 +0200
commit16bb59a03b40030946ed727f03af7f2ea8bfe4ac (patch)
tree696b16db78b235e5b6c9f33693322521f4c698b7
parentad20e98b6b98ccd6dbdd02217a839b61a01fcdde (diff)
Address ##'s identity crisis
When the file was evaluated, the previous code worked, but when the compiled file is loaded instead, then (eq '## X) where X's value is a "runtime '##", returns nil.
-rw-r--r--llama-test.el8
-rw-r--r--llama.el8
2 files changed, 12 insertions, 4 deletions
diff --git a/llama-test.el b/llama-test.el
index 79cbabf..6eed5ca 100644
--- a/llama-test.el
+++ b/llama-test.el
@@ -98,6 +98,14 @@
(list %1 &2 &*))))
)
+(ert-deftest llama-test-104-basic-nested nil
+
+ (should (equal (##list (##list %) %1)
+ (lambda (%1)
+ (list (lambda (%) (list %))
+ %1))))
+ )
+
(ert-deftest llama-test-201-unused-implicit-mandatory nil
(should (equal (##list %2)
diff --git a/llama.el b/llama.el
index 27bf743..a186808 100644
--- a/llama.el
+++ b/llama.el
@@ -178,14 +178,14 @@ to view this docstring.)"
,@(and rest (list '&rest rest)))
(,fn ,@body))))
-(defalias (quote ##) 'llama)
-(defalias (quote \#\#) 'llama)
+(defalias (intern "") 'llama)
+(defalias '\#\# 'llama)
(defconst llama--unused-argument (make-symbol "llama--unused-argument"))
(defun llama--collect (expr args &optional fnpos backquoted)
(cond
- ((memq (car-safe expr) '(## llama quote)) expr)
+ ((memq (car-safe expr) (list (intern "") 'llama 'quote)) expr)
((and backquoted (symbolp expr)) expr)
((and backquoted (eq (car-safe expr) backquote-unquote-symbol))
(cons backquote-unquote-symbol
@@ -395,7 +395,7 @@ expansion, and the looks of this face should hint at that.")
(cond
((eq (car-safe expr) 'quote))
((eq (ignore-errors (bare-symbol (car-safe expr))) 'quote))
- ((and (memq (car-safe expr) '(## llama)) (not top)))
+ ((and (memq (car-safe expr) (list (intern "") 'llama)) (not top)))
((and backquoted (symbol-with-pos-p expr)))
((and backquoted (eq (car-safe expr) backquote-unquote-symbol))
(llama--fontify expr))