id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	branch_state	votes
3861	The %f macro for mcedit is incorrect	graywolf	andrew_b	"$ mc --version
GNU Midnight Commander 4.8.19
System: Fedora 24

The %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
    clear
    app_path=/tmp/$(uuidgen)
    if g++ -o $app_path ""%f""; then
        $app_path
        rm $app_path
    fi
    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 back to mcedit with a.cpp.
Then I executed my item ""Run"" 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.

%opened_file
- the file name that is opened in current instance of mcedit.

%opened_file_full_path
- 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 %opened_file_full_path.

%opened_file_dir
- full path to directory where %opened_file is.

%save
- 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."	defect	closed	major	4.8.20	mc-core	master	fixed					merged	committed-master
