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

63998Re: vimgrep fails when 'autochdir' is set

Expand Messages
  • Benjamin Fritz
    Feb 4, 2012
      Thanks, everyone. The curwin->w_localdir variable was exactly what I
      was looking for, and the tertiary operator makes it a little clearer
      what is going on in the directory restore code.

      I took your suggestions and additionally moved the directory restore
      calls into the ((un)?load|wipe)_dummy_buffer functions so that it is
      easier to maintain in the future, if these functions are used
      elsewhere. The root cause of the problem was that many of the
      functions from buffer.c called by these dummy_buffer functions were
      using the DO_AUTOCHDIR macro, though presumably an appropriately
      defined autocmd would do the same thing, so whenever we touch the
      dummy buffer we need to restore the directory. Presumably creating a
      "dummy buffer" should never have lasting effects on the current

      Updated patch attached to fix that 'autochdir' causes :vimgrep to
      fail, based on 7.3.421. I did have one more question: I noticed that
      the pre-existing code dynamically allocates memory of static size
      MAXPATHL for both dirname_start and dirname_now. I have kept this and
      done the same thing for the restore_start_dir function I added, but I
      wonder, is there a reason the path string cannot be stack-allocated
      instead? Is it to limit stack size or something, since MAXPATHL can be
      somewhat large?


      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 9 messages in this topic