RE: [code] [textadept] Run both Python 2 and 3

From: Mitchell <m.att.foicica.com>
Date: Mon, 20 Jul 2015 10:16:20 -0400 (EDT)

Hi Jay,

On Sun, 19 Jul 2015, Jay Young wrote:

> Hi Robert and Mitchell,
> I really appreciate your replies, and like all these options you both have shared! I'd like to try adding Mitchell's code in the init.lua file, but admit I don't know much Lua. I'm not sure how to read the first line out of Textadept's active window (buffer?), but assuming this might be heading in the right direction?
> textadept.run.run_commands.python = function() line1 = <getting line 1 from active window?> if string.find(line1, 'python3') then return '/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4' else return '/System/Library/Frameworks/Python.framework/Versions/Current/bin/python' end end
> Thank you both again for your incredible help!

Something like this should work:

   textadept.run.run_commands.python = function()
     if buffer:get_line(0):find('python3') then
       return '/path/to/python3'
     else
       return '/path/to/python2'
     end
   end

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Mon 20 Jul 2015 - 10:16:20 EDT

This archive was generated by hypermail 2.2.0 : Tue 21 Jul 2015 - 06:34:44 EDT