* bug#47550: [PATCH] elisp mode doesn't support non-list argument lists
@ 2021-04-01 16:18 Vasilij Schneidermann
2021-04-01 18:58 ` Mikael Djurfeldt
0 siblings, 1 reply; 3+ messages in thread
From: Vasilij Schneidermann @ 2021-04-01 16:18 UTC (permalink / raw)
To: 47550
[-- Attachment #1.1: Type: text/plain, Size: 245 bytes --]
When I've tried porting existing elisp code, I've found that `(defun foo
nil 1)` errors out (on Guile 3 and master) , but `(defun foo () 1)`
doesn't. The following patch rectifies this by treating `nil` the same
as `()` when compiling a lambda.
[-- Attachment #1.2: 0001-elisp-Handle-nil-argument-list.patch --]
[-- Type: text/plain, Size: 918 bytes --]
From f3a7bd452e476f5769972ab2cac6da1cf4997c4f Mon Sep 17 00:00:00 2001
From: Vasilij Schneidermann <mail@vasilij.de>
Date: Thu, 1 Apr 2021 18:05:07 +0200
Subject: [PATCH] elisp: Handle nil argument list
* module/language/elisp/compile-tree.scm (parse-lambda-list): Handle nil
the same as ().
---
module/language/elisp/compile-tree-il.scm | 1 +
1 file changed, 1 insertion(+)
diff --git a/module/language/elisp/compile-tree-il.scm b/module/language/elisp/compile-tree-il.scm
index 0334e6f33..adbeb2005 100644
--- a/module/language/elisp/compile-tree-il.scm
+++ b/module/language/elisp/compile-tree-il.scm
@@ -259,6 +259,7 @@
(define (%match lst null optional rest symbol)
(pmatch lst
(() (null))
+ (nil (null))
((&optional . ,tail) (optional tail))
((&rest . ,tail) (rest tail))
((,arg . ,tail) (guard (symbol? arg)) (symbol arg tail))
--
2.31.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-02 16:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-01 16:18 bug#47550: [PATCH] elisp mode doesn't support non-list argument lists Vasilij Schneidermann
2021-04-01 18:58 ` Mikael Djurfeldt
2021-04-02 16:11 ` Mikael Djurfeldt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).