From 7f92f0df6a90a00184f8f1097962adab6da0f7b6 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 10 Feb 2005 22:36:19 +0000 Subject: [PATCH] fix prettyprinter bug --- TODO.FACTOR.txt | 2 -- factor/jedit/FactorShell.java | 6 +++++- factor/jedit/WordPreview.java | 3 +++ library/syntax/prettyprint.factor | 8 ++++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 0ebe2d393a..1c8bd03257 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,7 +1,5 @@ 72/73: -- keep a list of getter/setter words -- default constructor - move tuple to generic vocab - update plugin docs - extract word keeps indent diff --git a/factor/jedit/FactorShell.java b/factor/jedit/FactorShell.java index b1f8d6306c..7eaaea3a1c 100644 --- a/factor/jedit/FactorShell.java +++ b/factor/jedit/FactorShell.java @@ -203,7 +203,11 @@ public class FactorShell extends Shell output.print(console.getInfoColor(), jEdit.getProperty("factor.shell.opening")); - stream = FactorPlugin.getExternalInstance().openStream(); + stream = null; + ExternalFactor external = FactorPlugin.getExternalInstance(); + if(external != null) + stream = external.openStream(); + if(stream == null) { output.print(console.getInfoColor(), diff --git a/factor/jedit/WordPreview.java b/factor/jedit/WordPreview.java index 6e33284617..53ecca3e5f 100644 --- a/factor/jedit/WordPreview.java +++ b/factor/jedit/WordPreview.java @@ -134,6 +134,9 @@ public class WordPreview implements ActionListener, CaretListener if(SideKickPlugin.isParsingBuffer(view.getBuffer())) return; + if(!view.getBuffer().isLoaded()) + return; + FactorParsedData data = FactorPlugin.getParsedData(view); if(data != null) { diff --git a/library/syntax/prettyprint.factor b/library/syntax/prettyprint.factor index dacf88bb18..8c6a069d9d 100644 --- a/library/syntax/prettyprint.factor +++ b/library/syntax/prettyprint.factor @@ -108,8 +108,12 @@ M: word prettyprint* ( indent word -- indent ) M: list prettyprint* ( indent list -- indent ) [ - \ [ swap \ ] prettyprint-sequence - ] check-recursion ; + [ + \ [ swap \ ] prettyprint-sequence + ] check-recursion + ] [ + f unparse write + ] ifte* ; M: cons prettyprint* ( indent cons -- indent ) #! Here we turn the cons into a list of two elements.