From 6e20ea7b5fab7e3b9f39c118f6eee23a2b33fd81 Mon Sep 17 00:00:00 2001 From: Marije Baalman Date: Sun, 11 Jan 2009 17:03:39 +0000 Subject: [PATCH] fixed postColor (class method) and added some text retrieval functions from document. including a informative message that the result has to be retrieved from .currentString git-svn-id: https://supercollider.svn.sourceforge.net/svnroot/supercollider/trunk@8491 a380766d-ff14-0410-b294-a243070f3f08 --- sc/EmacsDocument.sc | 8 +++++++- sc/ScelDocument.sc | 27 ++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/sc/EmacsDocument.sc b/sc/EmacsDocument.sc index 0914e44..da0b913 100644 --- a/sc/EmacsDocument.sc +++ b/sc/EmacsDocument.sc @@ -152,12 +152,18 @@ EmacsDocument } currentLine { |returnFunc| - Emacs.evalLispExpression(['with-current-buffer', title, ['thing-at-point', '\'line'] ].asLispString, { |result| returnFunc.value( result ) } ) + Emacs.evalLispExpression(['sclang-line-at-point'].asLispString, { |result| returnFunc.value( result ) } ); + // ['with-current-buffer', title, ['thing-at-point', '\'line'] ].asLispString, { |result| returnFunc.value( result ) } ) ^nil; // '(set-text-properties start end nil)' will remove text properties somehow? } + currentBlock { |returnFunc| + Emacs.evalLispExpression(['sclang-defun-at-point'].asLispString, { |result| returnFunc.value( result ) } ); + ^nil; + } + currentWord { |returnFunc| Emacs.evalLispExpression(['with-current-buffer', title, ['current-word'] ].asLispString, { |result| returnFunc.value( result ) } ) ^nil; diff --git a/sc/ScelDocument.sc b/sc/ScelDocument.sc index be58def..9fe8f38 100644 --- a/sc/ScelDocument.sc +++ b/sc/ScelDocument.sc @@ -250,6 +250,7 @@ ScelDocument : Document{ // cond = Condition.new( { currentString.notNil } ); // cond.wait; // while ( { currentString.isNil }, {"wait for string".postln;} ); + "Asynchronous: retrieve the result with .currentString".postln; ^currentString; } @@ -260,9 +261,33 @@ ScelDocument : Document{ // cond = Condition.new( { currentString.notNil } ); // cond.wait; // while ( { currentString.isNil }, {"wait for string".postln;} ); + "Asynchronous: retrieve the result with .currentString".postln; ^currentString; } + currentWord { + // var cond; + currentString = nil; + thisdoc.currentWord( { |v| currentString = v } ); +// cond = Condition.new( { currentString.notNil } ); +// cond.wait; + // while ( { currentString.isNil }, {"wait for string".postln;} ); + "Asynchronous: retrieve the result with .currentString".postln; + ^currentString; + } + + currentBlock { + // var cond; + currentString = nil; + thisdoc.currentBlock( { |v| currentString = v } ); +// cond = Condition.new( { currentString.notNil } ); +// cond.wait; + // while ( { currentString.isNil }, {"wait for string".postln;} ); + "Asynchronous: retrieve the result with .currentString".postln; + ^currentString; + } + + text { ^this.string; } @@ -322,6 +347,6 @@ ScelDocument : Document{ prGetLastIndex { ^this.shouldNotImplement(thisMethod) } - postColor_{ + *postColor_{ } } \ No newline at end of file