From 1a68f34a511841986710cc0012417a8633ab7241 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Tue, 8 Jun 2004 11:38:41 +0000 Subject: [PATCH] 0.8.11.2: Make ED customizeable, similar to REQUIRE ... ED functions should attempt to implement the standard for ED where practical; ... point to documentation when ED or REQUIRE fail. --- NEWS | 3 +++ doc/manual/beyond-ansi.texinfo | 7 +++++++ package-data-list.lisp-expr | 3 ++- src/code/condition.lisp | 7 ++++++- src/code/module.lisp | 8 ++++++-- src/code/target-misc.lisp | 18 ++++++++++++++++++ src/compiler/fndb.lisp | 2 +- version.lisp-expr | 2 +- 8 files changed, 44 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 56a74b6..e3abb05 100644 --- a/NEWS +++ b/NEWS @@ -2519,6 +2519,9 @@ changes in sbcl-0.8.11 relative to sbcl-0.8.10: print using #P"..." syntax. changes in sbcl-0.8.12 relative to sbcl-0.8.11: + * the behaviour of the standard function ED is now customizeable by + third parties through a hook variable: see ED's documentation + string for information on the protocol. * fixed bug 335: ATANH now computes the inverse hyperbolic tangent even for difficult arguments. (reported by Peter Graves) diff --git a/doc/manual/beyond-ansi.texinfo b/doc/manual/beyond-ansi.texinfo index a8c8a28..3a60c57 100644 --- a/doc/manual/beyond-ansi.texinfo +++ b/doc/manual/beyond-ansi.texinfo @@ -319,6 +319,13 @@ following way: @include fun-common-lisp-require.texinfo @include var-sb-ext-star-module-provider-functions-star.texinfo +Although SBCL does not provide a resident editor, the @code{ed} +function can be customized to hook into user-provided editing +mechanisms as follows: + +@include fun-common-lisp-ed.texinfo +@include var-sb-ext-star-ed-functions-star.texinfo + @node Tools To Help Developers @comment node-name, next, previous, up @subsection Tools To Help Developers diff --git a/package-data-list.lisp-expr b/package-data-list.lisp-expr index 3c64ce4..713f5da 100644 --- a/package-data-list.lisp-expr +++ b/package-data-list.lisp-expr @@ -647,6 +647,7 @@ like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*." ;; miscellaneous useful supported extensions "QUIT" + "*ED-FUNCTIONS*" "*MODULE-PROVIDER-FUNCTIONS*" "WITH-TIMEOUT" "TIMEOUT" @@ -811,7 +812,7 @@ retained, possibly temporariliy, because it might be used internally." "PACKAGE-AT-VARIANCE" "ARRAY-INITIAL-ELEMENT-MISMATCH" "TYPE-WARNING" "LOCAL-ARGUMENT-MISMATCH" "FORMAT-ARGS-MISMATCH" "FORMAT-TOO-FEW-ARGS-WARNING" - "FORMAT-TOO-MANY-ARGS-WARNING" + "FORMAT-TOO-MANY-ARGS-WARNING" "EXTENSION-FAILURE" ;; ..and DEFTYPEs.. "INDEX" "LOAD/STORE-INDEX" diff --git a/src/code/condition.lisp b/src/code/condition.lisp index 0ab79c7..f8e70f3 100644 --- a/src/code/condition.lisp +++ b/src/code/condition.lisp @@ -908,6 +908,7 @@ ;;; (:ansi-cl :glossary "similar") ;;; ;;; (:sbcl :node "...") +;;; (:sbcl :variable *ed-functions*) ;;; ;;; FIXME: this is not the right place for this. (defun print-reference (reference stream) @@ -927,7 +928,8 @@ (format stream ", ") (destructuring-bind (type data) (cdr reference) (ecase type - (:node (format stream "Node ~S" data))))) + (:node (format stream "Node ~S" data)) + (:variable (format stream "Variable ~S" data))))) ;; FIXME: other documents (e.g. AMOP, Franz documentation :-) )) (define-condition reference-condition () @@ -1003,6 +1005,9 @@ (define-condition format-too-many-args-warning (format-args-mismatch simple-style-warning) ()) + +(define-condition extension-failure (reference-condition simple-error) + ()) ;;;; restart definitions diff --git a/src/code/module.lisp b/src/code/module.lisp index c9f1861..866b7b3 100644 --- a/src/code/module.lisp +++ b/src/code/module.lisp @@ -24,7 +24,6 @@ (defvar *module-provider-functions* '(module-provide-contrib) "See function documentation for REQUIRE") - ;;;; PROVIDE and REQUIRE @@ -55,7 +54,12 @@ (t (unless (some (lambda (p) (funcall p module-name)) *module-provider-functions*) - (error "Don't know how to load ~A" module-name))))) + (error 'extension-failure + :format-control "Don't know how to ~S ~A" + :format-arguments (list 'require module-name) + :references + (list + '(:sbcl :variable *module-provider-functions*))))))) (set-difference *modules* saved-modules))) ;;;; miscellany diff --git a/src/code/target-misc.lisp b/src/code/target-misc.lisp index 8c798e2..7b07e83 100644 --- a/src/code/target-misc.lisp +++ b/src/code/target-misc.lisp @@ -151,6 +151,24 @@ are running on, or NIL if we can't find any useful information." "Return a string with the long form of the site name, or NIL if not known." *long-site-name*) +;;;; ED +(defvar *ed-functions* nil + "See function documentation for ED.") + +(defun ed (&optional x) + "Starts the editor (on a file or a function if named). Functions +from the list *ED-FUNCTIONS* are called in order with X as an argument +until one of them returns non-NIL; these functions are responsible for +signalling a FILE-ERROR to indicate failure to perform an operation on +the file system." + (dolist (fun *ed-functions* + (error 'extension-failure + :format-control "Don't know how to ~S ~A" + :format-arguments (list 'ed x) + :references (list '(:sbcl :variable *ed-functions*)))) + (when (funcall fun x) + (return t)))) + ;;;; dribble stuff ;;; Each time we start dribbling to a new stream, we put it in diff --git a/src/compiler/fndb.lisp b/src/compiler/fndb.lisp index a4a2661..d0f3312 100644 --- a/src/compiler/fndb.lisp +++ b/src/compiler/fndb.lisp @@ -1287,7 +1287,7 @@ (defknown describe (t &optional (or stream (member t nil))) (values)) (defknown inspect (t) (values)) (defknown room (&optional (member t nil :default)) (values)) -(defknown ed (&optional (or symbol cons filename) &key (:init t) (:display t)) +(defknown ed (&optional (or symbol cons filename)) t) (defknown dribble (&optional filename &key (:if-exists t)) (values)) diff --git a/version.lisp-expr b/version.lisp-expr index e1f2b9f..fc137e7 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.11.1" +"0.8.11.2" -- 1.7.10.4