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