Using TeXworks, I can put the following code at the very top of a TeX document:
% !TeX program = LuaLaTeX
% !TEX encoding = UTF-8
When TeXworks sees that, it will automatically use LuaLaTeX as compiler, and utf-8 encoding for this document, even if the program preferences are set to something else.
Alternatively, I can use various commands such as
\ifluatex{no problem}{stop, and inform the user}
My question: For the various TeX-specific editors (not general text editors), would the processing instructions for TeXworks also do the same thing? Or, is there some general way of ensuring the correct processing from the very start, without having to detect and generate an error later?