%f macro in mcedit
- From: Sergiy Vovk <sergiyvovk69 gmail com>
- To: mc-devel gnome org
- Subject: %f macro in mcedit
- Date: Tue, 26 Sep 2017 17:19:08 +0300
Hi!
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
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 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.
%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.
Thanks for the mc.
Best regards, Sergiy Vovk.
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]