bug#47550: [PATCH] elisp mode doesn't support non-list argument lists

Vasilij Schneidermann <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
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.
0001-elisp-Handle-nil-argument-list.patch (text/plain, 892 B)
From f3a7bd452e476f5769972ab2cac6da1cf4997c4f Mon Sep 17 00:00:00 2001
From: Vasilij Schneidermann <[email protected]>
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
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEE0dAcySl3bqM8O17WFmfJg6zCifoFAmBl8kUACgkQFmfJg6zC
ifrH6Qf7B1r82LgREK4VqfQ6hkWT4O8dWrJ6A36HUoT5diSNS+P1K2vKGyiNl8rw
RXPPbRx4EkD7uAUq8l2OMTqajDTzK5jlfimU6UIseVfrDjRM2B1cZ92zZ39jJsJu
ca0uWC4tH76fVWURJOBPw8/cpeSn2aEa9B5Mf1vCl5pzaWm0DwuGe8Uc7k8mznEp
XmnKrJe4in2vb/jdkJ99BKw5pvyK9AVSLyLpiTcbkuMcPHLELDeE7AxN5wjpejqh
VShbHJ3nXiO8W+MQQ8AbZ07In1EmtIcPWejMDG6SBFB+vdi9Euqzw4bfJxPhciVS
IotR4/4jNjLARbaiR7L8ou74XhgtRA==
=xTpt
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.