[TxMt] Re: execute line / selection in shell or python

Charles DiMaggio charles.dimaggio at gmail.com
Sun Feb 26 20:01:25 UTC 2012


Yes, that's the link and the issue.  And your response gives me a clear fix, I'll edit my bundle to use exec, which with print() gives me a unified solution.  I Once again, many thanks for you help with this. Had no expectation of resolving both issues so quickly.

Cheers

Charlie

PS -'m using TM1 for now, but looking forward to the upgrade.




On Feb 26, 2012, at 2:46 PM, David Howden wrote:

> After further investigation, I think that this I have found the link you meant to post:  http://stackoverflow.com/questions/5282567/textmate-execute-line-selection-for-python-broken
> 
> There is indeed a bug in the execute line/selection python code - for a start the error that is shown in TM2 is not helpful, and the error catching code in the script does need fixing to change this (at least!).
> 
> I have played around with the rest of the code, and can't decide how it should work.
> 
> Currently it takes the input (current selection, or the current line), and uses eval() to evaluate it.  Of course, this fails for certain statements, such as
> 
> print "Hello World"
> 
> I changed my python bundle to use exec, but this fails for things like:
> 
> 1+1
> 
> as it doesn't return the output.  Obviously running print 1+1 fixes this
> 
> I am hesitant to change the default behaviour of the bundle, as I don't know what the purpose of the command is in the first place :-).  I suggest that you decide between the two approaches and fork the bundle for your own use.
> 
> Cheers,
> 
> David.
> 
> On Sun, Feb 26, 2012 at 7:22 PM, David Howden <dhowden at gmail.com> wrote:
> Also, I followed that link you gave in relation to the python problem.  I don't see what it has to do with the issue -  I think I'm missing something here?
> 
> Cheers,
> 
> David.
> 
> 
> On Sun, Feb 26, 2012 at 7:16 PM, David Howden <dhowden at gmail.com> wrote:
> On Sun, Feb 26, 2012 at 5:08 PM, Charles DiMaggio <charles.dimaggio at gmail.com> wrote:
> 
> OK, then. That last bit helped sort me out on the shell command issue.  I was trying to use ^R  to reach a location that was not in the path that TM inherited from Finder.  Thanks again, David. One issue down, one to go.
> 
> 
> No worries :-).
> 
> Are you using TM2 alpha or TM1?
> 
> David.
>  
> Charlie
> 
> On Feb 26, 2012, at 10:32 AM, David Howden wrote:
> 
>> 
>> 
>> On Sun, Feb 26, 2012 at 3:20 PM, Charles DiMaggio <charles.dimaggio at gmail.com> wrote:
>> Hi. I have two different, but related, issues.  
>> 
>> First, how does one execute a single line / selection in shell mode?  I've enabled enhanced terminal usage. Script (cmd-R) executes fine, but on the entire document.  The Textmate Manual direction (http://manual.macromates.com/en/shell_commands) to use ^R for a line or selection does not produce any results other than a forward slash.
>> 
>> 
>> Create a new file in TextMate, and enter this text:
>> 
>> echo $PATH
>> 
>> Then hit Ctrl-R.  What do you see?
>> 
>> Cheers,
>> 
>> David.
>> 
>> _______________________________________________
>> textmate mailing list
>> textmate at lists.macromates.com
>> http://lists.macromates.com/listinfo/textmate
> 
> 
> 
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
> 
> 
> 
> 
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20120226/6295b74d/attachment-0001.html>


More information about the textmate mailing list