Re: [code] How to get GCC compiler errors to work

From: Ryan Pusztai <rpusztai.att.gmail.com>
Date: Fri, 19 Apr 2013 15:24:23 -0400

Hi Mitchell,

On Mon, Apr 15, 2013 at 5:02 PM, Mitchell <m.att.foicica.com> wrote:
>
> Technically _M.textadept.run.cwd is not read-only, so you can try setting
> it in your RunMake() function. Let me know if that works.
>

Not quite because GCC/Make doesn't output the full file path. It generates
it relative to the currently running makefile. I have a top level Makefile
that runs "sub-makefiles" in other subdirectories.

When I run the root project Makefile I set the CWD to the project root
because that is what I know at the time. See source below:

local function RunMake()
> local vcs, projectroot = _M.version_control.get_vcs( buffer.filename or ""
> )
> local projectName = projectroot:match("[^/]+$")
> gui.statusbar_text = ("Building %s..."):format( projectName )
> -- Save all buffers
> io.save_all()
> -- Set the run working directory so that you can double-click on the
> error lines in the output
> _M.textadept.run.cwd = projectroot .. ( WIN32 and "\\" or "/" )
> local numCPUs = WIN32 and os.getenv( "NUMBER_OF_PROCESSORS" ) or
> io.popen( "nproc" ):read( "*n" )
> os.spawn( projectroot, { "make", "-j" .. numCPUs }, nil, nil,
> gui.print, gui.print,
> function()
> gui.statusbar_text = "Done building " .. projectName
> gui.print( "Done building " .. projectName )
> end )
> end
> keys.cpp.f7 = RunMake

ex:

Output from makefiles:
    Mobius_Utils/formats/StaticCyclicSequence.cpp:43:63: error: ‘class......

when double-clicking it uses:
    ~/projects/my_project/Mobius_Utils/formats/StaticCyclicSequence.cpp

should actually be:

~/projects/my_project/mobius/Mobius_Utils/formats/StaticCyclicSequence.cpp

Any other ideas?

P.S. I also noticed that I needed to end the CWD with a path separator. Not
sure if that is expected or fixed for you in TA internals.

--
Regards,
Ryan
-- 
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 Fri 19 Apr 2013 - 15:24:23 EDT

This archive was generated by hypermail 2.2.0 : Sat 20 Apr 2013 - 06:41:52 EDT