The plug-in creates a temporary buffer with:
:silent! botright
Displays some stuff, and once it's finished, blows away the temporary
buffer with :bwipeout. The plug-in code can be inspected at
http://git.wincent.com/command-t.git
The strange thing is that the "--No files in buffer--" message doesn't
appear the first time the plug-in displays, nor the second time, but
it does on the third, fourth and all other subsequent times.
The other confusing thing is that the plugin actually is
calling :redraw itself, but only a user-initated action will clear the
unwanted message (ie. a key press), from which I deduce that the
message is being printed _after_ the plugin has finished its initial
display logic and has returned control to VIM.
I've looked at the VIM source code to see what kind of situations the
"--No files in buffer--" message gets displayed, but I can only see
three places (ml_delete_int() in memline.c, cursor_pos_info() in
ops.c, fileinfo() in buffer.c). Of those, cursor_pos_info() looks to
be called only in response to user action (<C-g>), ml_delete_int() is
called via ml_delete() from a bunch of places, and fileinfo() likewise
has a few different callsites, so I am not really sure when/why the
message is being generated.
As I mentioned above, I suspect VIM is emitting the message after the
plug-in returns control, and that makes me suspect that fileinfo()
might be the ultimate source seeing as it seems to be tied in with a
global variable "need_fileinfo" which looks to be used as a flag to
request deferred display of the file information.
Can anyone shine a ray of light on what's happening here? And of most
interest to me, how I could modify the plug-in to suppress the
message?
Cheers,
Wincent
On Sa, 27 M�r 2010, Wincent Colaiuta wrote:
> I'm trying to eliminate a little cosmetic glitch in the Command-T
> plugin (http://www.vim.org/scripts/script.php?script_id=3025), wherein
> the status line will show "--No files in buffer--" after a couple of
> files have been opened, and will only go away when the user provokes a
> redraw.
Do you mean --No lines in buffer--?
I noticed that behaviour, whenever I do :%d in a non-empty buffer.
> The strange thing is that the "--No files in buffer--" message doesn't
> appear the first time the plug-in displays, nor the second time, but
> it does on the third, fourth and all other subsequent times.
In one of my plugins I ran into the same problem. The issue was, the
first time, the new buffer was empty, so :%d did not output any spurious
message, only when reloading the buffer, this message appeared. This
drove me crazy. :silent %d_ was my solution eventually.
regards,
Christian
Yes, sorry. Wrote my message late at night.
> I noticed that behaviour, whenever I do :%d in a non-empty buffer.
Yes, I was kind of hoping that that would be the culprit, but it turns
out that the plugin is already doing ":silent %d _".
And in fact, as an experiment, I remove the buffer clearing code
entirely and the "--No lines in buffer--" message persists.
The only thing I could do to eliminate the message was commenting out
the code which eliminates the buffer (using :bwipeout). Obviously
that's not an actual solution, but it at least provided a data point
on how to eliminate the message. Also tried :bdelete and friends, but
to no avail.
The funny thing is that the message appears the plugin sets up a new
buffer and fills it up with stuff. So I'm scratching my head as there
really aren't any buffers at all lying around with no lines in them...
Cheers,
Wincent