runtime(compilers): ensure compiler! sets global options (#14336)

Previously some options were only set locally by
&l:makeprg/errorformat

This suffices for :compiler (without a trailing bang)
but falls short for :compiler! that sets &g:makeprg/errorformat as
well

Also apply kind suggestions by @dkearns and @lifepillar 

Signed-off-by: Konfekt <Konfekt@users.noreply.github.com>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/compiler/tex.vim b/runtime/compiler/tex.vim
index 65e15cf..0925d17 100644
--- a/runtime/compiler/tex.vim
+++ b/runtime/compiler/tex.vim
@@ -1,7 +1,8 @@
 " Vim compiler file
 " Compiler:     TeX
 " Maintainer:   Artem Chuprina <ran@ran.pp.ru>
-" Last Change:  2012 Apr 30
+" Contributors: Enno Nagel
+" Last Change:  2024 Mar 29
 
 if exists("current_compiler")
 	finish
@@ -27,7 +28,8 @@
 	else
 		let current_compiler = "latex"
 	endif
-	let &l:makeprg=current_compiler.' -interaction=nonstopmode'
+	let makeprg=current_compiler .. ' -interaction=nonstopmode'
+	execute 'CompilerSet makeprg=' .. escape(makeprg, ' ')
 else
 	let current_compiler = 'make'
 endif