Author Topic: Problem with $(ACTIVE_EDITOR_FILENAME) in Tools  (Read 7315 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2875
Problem with $(ACTIVE_EDITOR_FILENAME) in Tools
« on: November 15, 2006, 09:57:58 pm »
Tools used to substitue $(ACTIVE_EDITOR_FILENAME) in Tools.
I cannot get it to do so since the latest SVN 3222.
Has this been deprecated since %s etc work in abbreviations?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem with $(ACTIVE_EDITOR_FILENAME) in Tools
« Reply #1 on: November 16, 2006, 02:34:52 am »
Not on purpose. Will look at it tomorrow (actually today).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem with $(ACTIVE_EDITOR_FILENAME) in Tools
« Reply #2 on: November 16, 2006, 12:43:34 pm »
Input:




Output:
-------------- Build: default in activeeditorfilename ---------------
mingw32-g++.exe -Wall -O2  -DD:\Desktop\activeeditorfilename\main.cpp  -IC:\MinGW\include  -c main.cpp -o obj\main.o
<command line>:1:2: warning: ISO C requires whitespace after the macro name
mingw32-g++.exe -LC:\MinGW\lib  -o .\activeeditorfilename.exe obj\main.o   -s 
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 1 warnings


Don't see anything unusual? Seems to work just fine for me.


EDIT:
Yes, this is the compiler, not tools, I know ;) That's because I never use tools, so I don't even know where to find the menu entry :lol:

But seriously: Compiler, tools, and everything else call the very same function to expand variables, so it either works for all, or it works for none.
« Last Edit: November 16, 2006, 12:47:07 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem with $(ACTIVE_EDITOR_FILENAME) in Tools
« Reply #3 on: November 16, 2006, 12:55:52 pm »
But... you're right.

I tried tools and configured this:



... and got:

$(ACTIVE_EDITOR_NAME) 15728 2006-11-16 D:\wxWidgets-2.6.3

Process returned 0 (0x0)   execution time : 0.031 s
Press any key to continue.


Everything is expanded correctly, except $(ACTIVE_EDITOR_NAME).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem with $(ACTIVE_EDITOR_FILENAME) in Tools
« Reply #4 on: November 16, 2006, 01:33:34 pm »
I've implemented a partial fix so far. Partial as in "fixes the problem you observed", but it still doesn't work.

The problem that you observed is peculiar insofar as $(ACTIVE_EDITOR_NAME) is not recognised as variable at all. And more, this is true for any other variable being at the beginning of a string, too. That's because the regex matching the variables was too simple (worked fine for the compiler, which I tested with). This is fixed now.

However, now I see another issue. $(ACTIVE_EDITOR_NAME) is recognised as variable, but it seems to be empty.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem with $(ACTIVE_EDITOR_FILENAME) in Tools
« Reply #5 on: November 16, 2006, 02:22:25 pm »
Hmm... are you sure this ever worked? :shock:

ToolsManager::Execute()
contains the lines:
    // hack to force-update macros
    Manager::Get()->GetMacrosManager()->RecalcVars(0, 0, 0);



... but RecalcVars(0, 0, 0) really runs:
    if(!editor)
    {
        m_ActiveEditorFilename = wxEmptyString;
        m_lastEditor = NULL;
    }

RecalcVars(0, 0, 0) does not reload anything. It's been like that for ages (revision 1497, December 2005), so I could not imagine that $(ACTIVE_EDITOR_NAME) ever worked correctly in tools, under that premise...
I'll try what happens if the behaviour of RecalcVars(0, 0, 0) is changed to reload the current editor/project name (if any). Should not do any harm (hopefully).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem with $(ACTIVE_EDITOR_FILENAME) in Tools [resolved]
« Reply #6 on: November 16, 2006, 02:43:43 pm »
Right... it does work. Now I remember, it's that terribly complicated thing with setting everything to zero, so it updates on the next call to ReplaceMacros()... all is fine. No changes necessary.

The reason why it still did not work was because I was using $(ACTIVE_EDITOR_NAME), not $(ACTIVE_EDITOR_FILENAME) to test... of course that one will always be empty. Stupid me :)

So I guess one can consider the issue resolved.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2875
Re: Problem with $(ACTIVE_EDITOR_FILENAME) in Tools
« Reply #7 on: November 16, 2006, 03:13:41 pm »
Again, thank you thomas.
Works fine.