Loading ...
Sorry, an error occurred while loading the content.

Re: using hidden unlisted buffer as transparently as possible

Expand Messages
  • Bram Moolenaar
    ... The :buffer N command doesn t display the name of the target buffer right away, it s postponed until later (after a possible redraw). You can see the
    Message 1 of 12 , Sep 7, 2006
      Marvin Renich wrote:

      > * Bram Moolenaar <Bram@...> [060906 17:07]:
      > >
      > > After you do ":set nohidden" there still is one hidden buffer. Thus the
      > > first TestBuf() after that will work a bit different from the next ones.
      > >
      > > I do see a problem: The info about the current buffer is displayed even
      > > though you edited another buffer. Thus the message should be given for
      > > the un-hidden file but it's given for the other file, for which a
      > > message was already given. I'll fix that.
      > >
      > Okay, I did not get all of the steps to reproduce the problem, though I
      > thought I had followed my own steps carefully to verify them after
      > writing them down. :-(
      > Note that somefile.txt already exists and has some text before starting.
      > In my testing since my last message, testbuf.vim already existed except
      > in the very first test, in which I pasted the text and did :w at the
      > step designated in my last message.
      > It seems that after :set hidden, you must :call TestBuf() twice to
      > see what I believe is wrong (or switch to the second buffer and back,
      > followed by :call TestBuf()). The first time, I see two lines of
      > output, followed by the "Press ENTER" prompt:
      > "testbuf.vim" 9 lines, 208 characters
      > Done with TestBuf (found = 3)
      > Press ENTER or type command to continue
      > I understand this behavior, and it is TTBOMK correct. The second time,
      > I only see one line (and no "Press ENTER" prompt):
      > "somefile.txt" line 1 of 28 --3%-- col 1
      > The behavior that I believe is incorrect is that I see the output from
      > the exec "b" curbuf command, but not the output from my echomsg
      > command.

      The ":buffer N" command doesn't display the name of the target buffer
      right away, it's postponed until later (after a possible redraw).

      You can see the message with ":messages". Check the 'shortmess' option,
      it probably allows overwriting a message. Thus the message for the
      newly edited buffer overwrites your message.

      > The other behavior that I believe is incorrect is that adding silent
      > in front of _both_ exec "b" commands still produces the output from the
      > silent exec "b" curbuf even though it is supposed to be silent; I also
      > do not see the output from my echomsg.

      I'll fix that.

      > Further note, in this last case using silent, that :messages shows the
      > output from my echomsg _before_ the output from silent exec "b" curbuf.

      That's because the file message is postponed until after redrawing.

      WOMAN: King of the who?
      ARTHUR: The Britons.
      WOMAN: Who are the Britons?
      ARTHUR: Well, we all are. we're all Britons and I am your king.
      The Quest for the Holy Grail (Monty Python)

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
    Your message has been successfully submitted and would be delivered to recipients shortly.