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>
This commit is contained in:
glepnir
2025-05-16 19:49:23 +02:00
committed by Christian Brabandt
parent 670d0c1468
commit 7b9eb6389d
11 changed files with 46 additions and 11 deletions

View File

@ -6429,6 +6429,9 @@ unset_global_local_option(char_u *name, void *from)
case PV_EFM:
clear_string_option(&buf->b_p_efm);
break;
case PV_GEFM:
clear_string_option(&buf->b_p_gefm);
break;
case PV_GP:
clear_string_option(&buf->b_p_gp);
break;
@ -6508,6 +6511,7 @@ get_varp_scope(struct vimoption *p, int scope)
#endif
#ifdef FEAT_QUICKFIX
case PV_EFM: return (char_u *)&(curbuf->b_p_efm);
case PV_GEFM: return (char_u *)&(curbuf->b_p_gefm);
case PV_GP: return (char_u *)&(curbuf->b_p_gp);
case PV_MP: return (char_u *)&(curbuf->b_p_mp);
#endif
@ -6626,6 +6630,8 @@ get_varp(struct vimoption *p)
#ifdef FEAT_QUICKFIX
case PV_EFM: return *curbuf->b_p_efm != NUL
? (char_u *)&(curbuf->b_p_efm) : p->var;
case PV_GEFM: return *curbuf->b_p_gefm != NUL
? (char_u *)&(curbuf->b_p_gefm) : p->var;
case PV_GP: return *curbuf->b_p_gp != NUL
? (char_u *)&(curbuf->b_p_gp) : p->var;
case PV_MP: return *curbuf->b_p_mp != NUL
@ -7415,6 +7421,7 @@ buf_copy_options(buf_T *buf, int flags)
buf->b_p_bkc = empty_option;
buf->b_bkc_flags = 0;
#ifdef FEAT_QUICKFIX
buf->b_p_gefm = empty_option;
buf->b_p_gp = empty_option;
buf->b_p_mp = empty_option;
buf->b_p_efm = empty_option;