patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf

Problem:  Filetype may be undetected when a SwapExists autocommand sets
          filetype in another buffer.
Solution: Make filetype detection state buffer-specific.  Also fix a
          similar problem for 'modified' (zeertzjq).

closes: #14344

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/quickfix.c b/src/quickfix.c
index 0bf4cfe..2e5b693 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4964,12 +4964,12 @@
 						0L, (char_u *)"qf", OPT_LOCAL);
 	curbuf->b_p_ma = FALSE;
 
-	keep_filetype = TRUE;		// don't detect 'filetype'
+	curbuf->b_keep_filetype = TRUE;	// don't detect 'filetype'
 	apply_autocmds(EVENT_BUFREADPOST, (char_u *)"quickfix", NULL,
 							       FALSE, curbuf);
 	apply_autocmds(EVENT_BUFWINENTER, (char_u *)"quickfix", NULL,
 							       FALSE, curbuf);
-	keep_filetype = FALSE;
+	curbuf->b_keep_filetype = FALSE;
 	--curbuf_lock;
 
 	// make sure it will be redrawn