patch 9.1.1396: 'errorformat' is a global option

Problem:  The 'grepformat' option is global option, but it would be
          useful to have it buffer-local, similar to 'errorformat' and
          other quickfix related options (Dani Dickstein)
Solution: Add the necessary code to support global-local 'grepformat',
          allowing different buffers to parse different grep output
          formats (glepnir)

fixes: #17316
closes: #17315

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/quickfix.c b/src/quickfix.c
index d012ea0..ab595d7 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -5503,7 +5503,7 @@
     incr_quickfix_busy();
 
     if (eap->cmdidx != CMD_make && eap->cmdidx != CMD_lmake)
-	errorformat = p_gefm;
+	errorformat =  *curbuf->b_p_gefm != NUL ? curbuf->b_p_gefm : p_gefm;
     if (eap->cmdidx == CMD_grepadd || eap->cmdidx == CMD_lgrepadd)
 	newlist = FALSE;