%f macro in mcedit

My mc version:
$ mc --version
GNU Midnight Commander 4.8.19
System: Fedora 24

I just want to tell you that %f macro in mcedit is not correct. It
contains the current file name that is selected in the panel but not
the actual file name that is opened in mcedit.

I created the mcedit item to run C++ program:
+= f \.cpp$
r       Run
    if g++ -o $app_path "%f"; then
        rm $app_path
    echo 'Press any key to exit.'
    read -s -n 1

Imagine that I opened the file a.cpp in mcedit.
Then I pressed alt+` and switched to panel.
Then I selected (or even opened in mcedit) the file b.cpp.
Then I pressed alt+` and switched to mcedit with a.cpp.
Then I executed the "Run" item from user menu.
And... The b.cpp will be compiled and run. This is wrong! Why b.cpp???
I executed "Run" from a.cpp!

I propose you to do the new macros for mcedit.

- the file name that is opened in current instance of mcedit.

- as %opened_file but full path to that file.

I think that %opened_file may be not safe because the current
directory may be changed in mc panel. So it is better to use

- full path to directory where %opened_file is.

- save opened file before executing the menu commands. May be useful
in some cases. For example I don't want to press F2 every time before
run changed code.

Thanks for the mc.
Best regards, Sergiy Vovk.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]