[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-chicken 935a114 040/102: Allows redefinition of mod
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-chicken 935a114 040/102: Allows redefinition of modules |
Date: |
Sun, 1 Aug 2021 18:26:52 -0400 (EDT) |
branch: elpa/geiser-chicken
commit 935a114d0a42331e25ec5de0de2087128519ad98
Author: Dan Leslie <dan@ironoxide.ca>
Commit: Dan Leslie <dan@ironoxide.ca>
Allows redefinition of modules
If one were to re-evaluate a buffer with a module in it there would be
problems because it would appear as a nested request.
Solution:
- Check if a module definition is a fore-most request, and if so,
evaluate at top level
---
geiser/emacs.scm | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/geiser/emacs.scm b/geiser/emacs.scm
index f31bba9..c5772bd 100644
--- a/geiser/emacs.scm
+++ b/geiser/emacs.scm
@@ -469,10 +469,6 @@
;; Basically all non-core functions pass through geiser-eval
(define (geiser-eval module form . rest)
- ;; We can't allow nested module definitions in Chicken
- (define (form-has-module? form)
- (or (eq? (car form) 'module) (eq? (car form) 'define-library)))
-
(define (form-has-safe-geiser? form)
(any (cut eq? (car form) <>)
'(geiser-no-values geiser-newline geiser-completions
@@ -483,25 +479,35 @@
(define (form-has-any-geiser? form)
(string-has-prefix? (->string (car form)) "geiser-"))
+
+ (define (form-defines-any-module? form)
+ (or
+ ;; Geiser seems to send buffers as (begin ..buffer contents..)
+ (and (eq? (car form) 'begin)
+ (form-defines-any-module? (cadr form)))
+ (any (cut eq? (car form) <>)
+ '(module define-library))))
+
+ (define (module-matches-defined-module? module)
+ (any (cut eq? module <>) (list-modules)))
(when (and module (not (symbol? module)))
(error "Module should be a symbol"))
-
+
;; All calls start at toplevel
- (let* ((is-module? (form-has-module? form))
- (is-geiser? (form-has-any-geiser? form))
- (is-safe-geiser? (form-has-safe-geiser? form))
- (host-module (and (not is-module?)
- (not is-geiser?)
- (any (cut equal? module <>) (list-modules))
+ (let* ((is-safe-geiser? (form-has-safe-geiser? form))
+ (host-module (and (not is-safe-geiser?)
+ (not (form-has-any-geiser? form))
+ (not (form-defines-any-module? form))
+ (module-matches-defined-module? module)
module))
(thunk (lambda () (eval form))))
- (write-to-log `[[REQUEST host-module ,host-module is-safe-geiser?
,is-safe-geiser?]])
+ (write-to-log `[[REQUEST]])
(write-to-log form)
(if is-safe-geiser?
- (call-with-result host-module (lambda () (memoize form thunk)))
+ (call-with-result #f (lambda () (memoize form thunk)))
(begin
(clear-memo)
(call-with-result host-module thunk)))))
- [nongnu] elpa/geiser-chicken 89ffe41 022/102: Add 'geiser-syntax--simple-keywords', (continued)
- [nongnu] elpa/geiser-chicken 89ffe41 022/102: Add 'geiser-syntax--simple-keywords', Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 242d4ae 024/102: Use 'geiser-chicken-extra-keywords', Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken c2dcda3 025/102: Clean up indentation rules, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 7b2e9ce 027/102: Merge remote-tracking branch 'dleslie/master', Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken ce93e6b 028/102: Follow suit and complete quoted symbols in all schemes, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 309c67f 034/102: Minor improvements, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 8bd8b5c 031/102: Converts toplevel methods to prefixed methods, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken a4c49f2 033/102: Turn off debug log, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken bcd1a09 037/102: Use OS-specific quotes when asking for versions, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 9b9b180 039/102: Fixes for Literals, Errors and Modules, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 935a114 040/102: Allows redefinition of modules,
Philip Kaludercic <=
- [nongnu] elpa/geiser-chicken 95d19aa 044/102: Minor changes to help with debugging completions, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 2098767 046/102: Quoting binary on version checks (issue #117), Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 42b18d5 045/102: Minor cleanup, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 1ff0274 048/102: Performance Improvements, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 0bcd595 050/102: Fuzzy matching for Chicken AutoDoc and Completions, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 5cc0dd2 052/102: Fix for #127, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 402e1bc 054/102: Minor typo, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken fc0c8e6 056/102: Disable aggressive prefix assumption, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 1c969ee 058/102: Allows Chicken to limit the number of symbols provided to Geiser, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chicken 26b1f56 059/102: Use (car (process-lines ...)) instead of (shell-command ...), Philip Kaludercic, 2021/08/01