emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/geiser-chicken 2127c37 097/102: Fix error when compiling d


From: Philip Kaludercic
Subject: [nongnu] elpa/geiser-chicken 2127c37 097/102: Fix error when compiling define-library form in Chicken
Date: Sun, 1 Aug 2021 18:27:03 -0400 (EDT)

branch: elpa/geiser-chicken
commit 2127c378fe3a5b75fbd19116204d603b5d3ee997
Author: Ricardo G. Herdt <r.herdt@posteo.de>
Commit: Ricardo G. Herdt <r.herdt@posteo.de>

    Fix error when compiling define-library form in Chicken
    
    Problem: when running geiser-compile-current-buffer (C-c C-k) on a file
    using R7RS's define-library form, geiser-chicken--get-module starts an
    infinite recursion. This happens because the original regular expression
    contains two groups, but the code only tries to fetch the library name
    from the first one with "(match-string-no-properties 1)".
    
    Solution: we use the same strategy as in geiser-guile.el, namely we split 
the
    regular expression into two separate ones, and check them one by one.
    
    Note: this code also removes "looking-at", since it seems to be an 
unnecesary
    micro-optimisation.
---
 geiser-chicken.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/geiser-chicken.el b/geiser-chicken.el
index cac9211..9624085 100644
--- a/geiser-chicken.el
+++ b/geiser-chicken.el
@@ -162,15 +162,19 @@ This function uses `geiser-chicken-init-file' if it 
exists."
        (format "(geiser#geiser-%s %s)" proc form)))))
 
 (defconst geiser-chicken--module-re
-  "( *module +\\(([^)]+)\\|[^ ]+\\)\\|( *define-library +\\(([^)]+)\\|[^ 
]+\\)")
+  "( *module +\\(([^)]+)\\|[^ ]+\\)")
+
+(defconst geiser-chicken--define-library-re
+  "( *define-library +\\(([^)]+)\\)")
 
 (defun geiser-chicken--get-module (&optional module)
   (cond ((null module)
          (save-excursion
            (geiser-syntax--pop-to-top)
            (if (or (re-search-backward geiser-chicken--module-re nil t)
-                   (looking-at geiser-chicken--module-re)
-                   (re-search-forward geiser-chicken--module-re nil t))
+                   (re-search-backward geiser-chicken--define-library-re nil t)
+                   (re-search-forward geiser-chicken--module-re nil t)
+                   (re-search-forward geiser-chicken--define-library-re nil t))
                (geiser-chicken--get-module (match-string-no-properties 1))
              :f)))
         ((listp module) module)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]