I want / (slash) to perform F4,F7 combo in Help.
The concept: F4 handled in Help by HlfTools opens Editor, F7 handled by Far opens Search dialog.
My initial attempt did not work.
Code: Select all
Macro {
description="Search in given help page (requires HlfTools)";
area="Help"; key="/";
flags="";
code="Keys(\"F4 F7\")";
}I found thread, which pointed me in the right direction - use eval with mode=2, which runs the macro assigned to the keyboard shortcut.
But my second attempt also failed.
Code: Select all
Macro {
description="Search in given help page (requires HlfTools)";
area="Help"; key="/";
flags="";
code="if eval(\"./F4\", 2) == 0 then Keys(\"F7\") end";
}I was starting to think that perhaps
eval returns non-0 error code, which would be strange, so I wrapped eval into far.Message(tostring(...), ...).I did not get the message upon entering to editor via my slash macro, I got it only after exiting from editor (one Esc) and exiting from help (second Esc).
It looks like editor continues running in macro's context and
eval does not return until help is closed.I admit I started playing a bit with macros in Far only last year, so my assessment of the situation may be incomplete and inaccurate.
What would be the proper and idiomatic way to build Macro in Far upon other existing HlfTools F4 macro?
I feel like extending HlfTools.lua or copy-pasting its F4 macro to separate file and modifying wouldn't be clean solutions.