From 90806c7ab35921fa5a9873ea48432ce6cdf0aea4 Mon Sep 17 00:00:00 2001 From: Marije Baalman Date: Thu, 8 Jan 2009 06:18:51 +0000 Subject: [PATCH] added another shortcut for the sclang-complete-symbol (the old one conflicts with some windowmanagers) and added an entry for the function to the menu git-svn-id: https://supercollider.svn.sourceforge.net/svnroot/supercollider/trunk@8453 a380766d-ff14-0410-b294-a243070f3f08 --- el/sclang-mode.el | 2 ++ sc/EmacsDocument.sc | 16 ++++++++++++---- sc/ScelDocument.sc | 22 +++++++++++++++------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/el/sclang-mode.el b/el/sclang-mode.el index e797ca0..ec8c23b 100644 --- a/el/sclang-mode.el +++ b/el/sclang-mode.el @@ -90,6 +90,7 @@ ["Find References ..." sclang-find-references] ["Pop Mark" sclang-pop-definition-mark] ["Show Method Arguments" sclang-show-method-args] + ["Complete keyword" sclang-complete-symbol] ["Dump Interface" sclang-dump-interface] "-" ["Index Help Topics" sclang-index-help-topics] @@ -115,6 +116,7 @@ (define-key map "\C-\M-x" 'sclang-eval-defun) (define-key map "\C-c\C-e" 'sclang-eval-expression) ;; language information + (define-key map "\C-c\C-n" 'sclang-complete-symbol) (define-key map "\M-\t" 'sclang-complete-symbol) (define-key map "\C-c:" 'sclang-find-definitions) (define-key map "\C-c;" 'sclang-find-references) diff --git a/sc/EmacsDocument.sc b/sc/EmacsDocument.sc index cda3f91..0914e44 100644 --- a/sc/EmacsDocument.sc +++ b/sc/EmacsDocument.sc @@ -147,13 +147,21 @@ EmacsDocument ^nil; } - string_{|string| + string_{|string, rangestart = -1, rangesize = 1| Emacs.sendToLisp(\_documentPutString, [this, string]); } - /* currentLine { - ^"" - }*/ + currentLine { |returnFunc| + Emacs.evalLispExpression(['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? + } + + currentWord { |returnFunc| + Emacs.evalLispExpression(['with-current-buffer', title, ['current-word'] ].asLispString, { |result| returnFunc.value( result ) } ) + ^nil; + } // environment support /* envir_ { | environment | diff --git a/sc/ScelDocument.sc b/sc/ScelDocument.sc index 928cd78..a97fc8e 100644 --- a/sc/ScelDocument.sc +++ b/sc/ScelDocument.sc @@ -64,11 +64,11 @@ ScelDocument : Document{ ^this } - string_ { | argName, completFunc | + string_ { | argName, rangestart = -1, rangesize = 1 | if ( thisdoc.notNil, { - thisdoc.string_( argName, completFunc ) + thisdoc.string_( argName, rangestart, rangesize ) },{ - cFuncs = cFuncs ++ { this.string_( argName, completFunc ) }; + cFuncs = cFuncs ++ { this.string_( argName ) }; }); } @@ -244,7 +244,7 @@ ScelDocument : Document{ } string {arg rangestart, rangesize = 1; - var cond; + // var cond; currentString = nil; thisdoc.string( rangestart, { |v| currentString = v }, rangesize ); // cond = Condition.new( { currentString.notNil } ); @@ -252,6 +252,17 @@ ScelDocument : Document{ // while ( { currentString.isNil }, {"wait for string".postln;} ); ^currentString; } + + currentLine { + // var cond; + currentString = nil; + thisdoc.currentLine( { |v| currentString = v } ); +// cond = Condition.new( { currentString.notNil } ); +// cond.wait; + // while ( { currentString.isNil }, {"wait for string".postln;} ); + ^currentString; + } + text { ^this.string; } @@ -265,9 +276,6 @@ ScelDocument : Document{ } stringColor_ {arg color, rangeStart = -1, rangeSize = 0; } - currentLine { - ^"" - } prGetBounds { | bounds | ^bounds } prSetBounds { }