unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Vasilij Schneidermann <mail@vasilij.de>
To: 47550@debbugs.gnu.org
Subject: bug#47550: [PATCH] elisp mode doesn't support non-list argument lists
Date: Thu, 1 Apr 2021 18:18:21 +0200	[thread overview]
Message-ID: <YGXyTbCPwuGSwTnP@odonien.localdomain> (raw)


[-- 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 --]

             reply	other threads:[~2021-04-01 16:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01 16:18 Vasilij Schneidermann [this message]
2021-04-01 18:58 ` bug#47550: [PATCH] elisp mode doesn't support non-list argument lists Mikael Djurfeldt
2021-04-02 16:11   ` Mikael Djurfeldt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YGXyTbCPwuGSwTnP@odonien.localdomain \
    --to=mail@vasilij.de \
    --cc=47550@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).