From: Matt Birkholz Date: Sun, 12 Mar 2017 17:11:36 +0000 (-0700) Subject: Add a global edit procedure that autoloads Edwin. X-Git-Tag: mit-scheme-pucked-9.2.12~181 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=aefa370;p=mit-scheme.git Add a global edit procedure that autoloads Edwin. --- diff --git a/src/edwin/editor.scm b/src/edwin/editor.scm index e74655e9c..da0db7036 100644 --- a/src/edwin/editor.scm +++ b/src/edwin/editor.scm @@ -87,15 +87,6 @@ USA. ,@operations)) message)))))))) -(define (edwin . args) (apply edit args)) -(simple-command-line-parser "edit" edit - "Causes Edwin to start immediately after Scheme.") - -(define (spawn-edwin . args) - (let ((thread (create-thread #f (lambda () (apply edwin args))))) - (detach-thread thread) - thread)) - (define edwin-editor #f) (define editor-abort) (define current-editor) diff --git a/src/edwin/edwin.pkg b/src/edwin/edwin.pkg index c67639ac6..acb084f6c 100644 --- a/src/edwin/edwin.pkg +++ b/src/edwin/edwin.pkg @@ -135,13 +135,10 @@ USA. (export () create-editor create-editor-args - edit - edwin inhibit-editor-init-file? reset-editor reset-editor-windows - (save-editor-files debug-save-files) - spawn-edwin) + (save-editor-files debug-save-files)) (export (edwin class-macros) class-instance-transforms)) diff --git a/src/runtime/global.scm b/src/runtime/global.scm index bf8adf72e..e25fc767a 100644 --- a/src/runtime/global.scm +++ b/src/runtime/global.scm @@ -152,6 +152,32 @@ USA. (if (or (default-object? max) (not max)) (with-output-to-string (lambda () (write object))) (with-output-to-truncated-string max (lambda () (write object))))) + +(define (edit . args) + (let ((env (let ((package (name->package '(edwin)))) + (and package (package/environment package))))) + (if env + (apply (environment-lookup end 'edit) args) + (begin + (with-notification + (lambda (port) (display "Loading Edwin" port)) + (lambda () + (parameterize* + (list (cons param:suppress-loading-message? #t)) + (lambda () + (load-option 'EDWIN) + (if (let ((DISPLAY (get-environment-variable "DISPLAY"))) + (and (string? DISPLAY) + (not (string-null? DISPLAY)))) + (ignore-errors (lambda () (load-option 'x11-screen)))))))) + (apply (environment-lookup (->environment '(edwin)) 'edit) args))))) + +(define edwin edit) + +(define (spawn-edwin . args) + (let ((thread (create-thread #f (lambda () (apply edwin args))))) + (detach-thread thread) + thread)) (define (pa procedure) (guarantee procedure? procedure 'PA) diff --git a/src/runtime/load.scm b/src/runtime/load.scm index a06749643..d2475b5c6 100644 --- a/src/runtime/load.scm +++ b/src/runtime/load.scm @@ -714,19 +714,8 @@ ADDITIONAL OPTIONS supported by this band:\n") environment repl))))) "Evaluates the argument expressions as if in the REPL.") - (simple-command-line-parser "edit" - (named-lambda (command-line-edit) - (with-notification (lambda (port) (display "Loading Edwin" port)) - (lambda () - (parameterize* (list (cons param:suppress-loading-message? #t)) - (lambda () - (load-option 'EDWIN) - (if (let ((DISPLAY (get-environment-variable "DISPLAY"))) - (and (string? DISPLAY) - (not (string-null? DISPLAY)))) - (ignore-errors (lambda () (load-option 'x11-screen)))))))) - ((environment-lookup #f 'edit))) - "Causes Edwin to start immediately after Scheme.") + (simple-command-line-parser "edit" edit + "Causes Edwin to start immediately after Scheme.") (simple-command-line-parser "help" show-command-line-options #f) (simple-command-line-parser "version" (lambda () (%exit 0)) #f) (set-command-line-parser! diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 0b914f42e..fa194bab4 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -444,6 +444,8 @@ USA. constant-procedure default/exit default/quit + edit + edwin environment-link-name ephemeron-broken? ephemeron-datum @@ -513,6 +515,7 @@ USA. set-interrupt-enables! show-time simple-top-level-environment + spawn-edwin system-hunk3-cons system-hunk3-cxr0 system-hunk3-cxr1