summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2022-12-16 16:41:23 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-16 16:41:23 +0000
commit9aee8ec400fe617f6d82441c46a22d0cef6fa3e6 (patch)
treed8ef22c2177d59f1196dc7d82c540612eff3813c /src/ex_cmds2.c
parent4ab1f4a32f7e0fcafa8f542429f1f6c47dcd5d2c (diff)
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeatedv9.0.1064
Problem: Code for making 'shortmess' temporarily empty is repeated. Solution: Add functions for making 'shortmess' empty and restoring it. (Christian Brabandt, closes #11709)
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 9c00b80b7a..3bdbede138 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -460,7 +460,6 @@ ex_listdo(exarg_T *eap)
#if defined(FEAT_SYN_HL)
char_u *save_ei = NULL;
#endif
- char_u *p_shm_save;
#ifdef FEAT_QUICKFIX
int qf_size = 0;
int qf_idx;
@@ -541,7 +540,9 @@ ex_listdo(exarg_T *eap)
buf = NULL;
else
{
+ save_clear_shm_value();
ex_cc(eap);
+ restore_shm_value();
buf = curbuf;
i = eap->line1 - 1;
@@ -568,13 +569,9 @@ ex_listdo(exarg_T *eap)
{
// Clear 'shm' to avoid that the file message overwrites
// any output from the command.
- p_shm_save = vim_strsave(p_shm);
- set_option_value_give_err((char_u *)"shm",
- 0L, (char_u *)"", 0);
+ save_clear_shm_value();
do_argfile(eap, i);
- set_option_value_give_err((char_u *)"shm",
- 0L, p_shm_save, 0);
- vim_free(p_shm_save);
+ restore_shm_value();
}
if (curwin->w_arg_idx != i)
break;
@@ -630,11 +627,9 @@ ex_listdo(exarg_T *eap)
// Go to the next buffer. Clear 'shm' to avoid that the file
// message overwrites any output from the command.
- p_shm_save = vim_strsave(p_shm);
- set_option_value_give_err((char_u *)"shm", 0L, (char_u *)"", 0);
+ save_clear_shm_value();
goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum);
- set_option_value_give_err((char_u *)"shm", 0L, p_shm_save, 0);
- vim_free(p_shm_save);
+ restore_shm_value();
// If autocommands took us elsewhere, quit here.
if (curbuf->b_fnum != next_fnum)
@@ -650,13 +645,9 @@ ex_listdo(exarg_T *eap)
qf_idx = qf_get_cur_idx(eap);
- // Clear 'shm' to avoid that the file message overwrites
- // any output from the command.
- p_shm_save = vim_strsave(p_shm);
- set_option_value_give_err((char_u *)"shm", 0L, (char_u *)"", 0);
+ save_clear_shm_value();
ex_cnext(eap);
- set_option_value_give_err((char_u *)"shm", 0L, p_shm_save, 0);
- vim_free(p_shm_save);
+ restore_shm_value();
// If jumping to the next quickfix entry fails, quit here
if (qf_get_cur_idx(eap) == qf_idx)