-q option generates error message twice

50 views
Skip to first unread message

Gary Johnson

unread,
Feb 16, 2014, 6:53:54 PM2/16/14
to vim...@googlegroups.com
I created a quickfix error file containing one error and opened it
like this:

$ vim -N -u NONE -i NONE -q make.out

At the bottom of the screen I see the message:

(3 of 3): warning: incompatible imlicit declaration of built-in function 'exit'

So far, so good. But if I look at all messages, I see that it was
generated twice:

:messages
Messages maintainer: Bram Moolenaar <Br...@vim.org>
"main.c" 6L, 66C
(3 of 3): warning: incompatible implicit declaration of built-in function ‘exit’
(3 of 3): warning: incompatible implicit declaration of built-in function ‘exit’
Press ENTER or type command to continue

This would not be a big deal except that in some cases when using
the -q option, both messages are displayed at the bottom of the
screen and stay there until I press ENTER. One would be sufficient
and might not require that I press ENTER to proceed.

Annoyance or not, it looks like unintended behavior.

Regards,
Gary

Christian Brabandt

unread,
Feb 17, 2014, 2:38:11 PM2/17/14
to vim...@googlegroups.com
This actually does not only happen with -q but everywhere where
qf_jump() is called (:cfile, :cbu, :helpgrep to name a few).

Here is a patch, avoiding adding the same message to the message history
twice.

diff --git a/src/quickfix.c b/src/quickfix.c
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -1887,11 +1887,15 @@
* flag is present in 'shortmess'; But when not jumping, print the
* whole message. */
i = msg_scroll;
+ /* avoid adding the message to the twice history, this will happen
+ * later in the main loop in msg_attr_keep */
+ msg_hist_off++;
if (curbuf == old_curbuf && curwin->w_cursor.lnum == old_lnum)
msg_scroll = TRUE;
else if (!msg_scrolled && shortmess(SHM_OVERALL))
msg_scroll = FALSE;
msg_attr_keep(IObuff, 0, TRUE);
+ msg_hist_off--;
msg_scroll = i;
}
}

Best,
Christian
--
Democracy is a government where you can say what you think even if you
don't think.

Bram Moolenaar

unread,
Feb 20, 2014, 9:49:03 PM2/20/14
to Christian Brabandt, vim...@googlegroups.com

Christian Brabandt wrote:

> On So, 16 Feb 2014, Gary Johnson wrote:
>
> > I created a quickfix error file containing one error and opened it
> > like this:
> >
> > $ vim -N -u NONE -i NONE -q make.out
> >
> > At the bottom of the screen I see the message:
> >
> > (3 of 3): warning: incompatible imlicit declaration of built-in function 'exit'
> >
> > So far, so good. But if I look at all messages, I see that it was
> > generated twice:
> >
> > :messages
> > Messages maintainer: Bram Moolenaar <Br...@vim.org>
> > "main.c" 6L, 66C
> > (3 of 3): warning: incompatible implicit declaration of built-in function ‘exit’
> > (3 of 3): warning: incompatible implicit declaration of built-in function ‘exit’
> > Press ENTER or type command to continue
> >
> > This would not be a big deal except that in some cases when using
> > the -q option, both messages are displayed at the bottom of the
> > screen and stay there until I press ENTER. One would be sufficient
> > and might not require that I press ENTER to proceed.
> >
> > Annoyance or not, it looks like unintended behavior.
>
> This actually does not only happen with -q but everywhere where
> qf_jump() is called (:cfile, :cbu, :helpgrep to name a few).
>
> Here is a patch, avoiding adding the same message to the message history
> twice.

Thanks, I'll add it in the todo list.

--
We do not stumble over mountains, but over molehills.
Confucius

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages