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

Re: 'autochdir' causes setbufvar() to change directory

Expand Messages
  • Christian Brabandt
    ... having. ... directory to that of the buffer having its variable set. I think this should not happen. ... Windows (slightly modified) with Vim 7.3.822. ...
    Message 1 of 7 , Jul 31 7:37 AM
    • 0 Attachment
      On Tue, July 16, 2013 16:57, Benjamin Fritz wrote:
      > Eric Van Dewoestine found this while investigating an eclim issue I was
      having.
      > When 'autochdir' is set, calling setbufvar() changes Vim's current
      directory to that of the buffer having its variable set. I think this
      should not happen.
      > Reproduced using the following on Solaris with Vim 7.4a.6, and also on
      Windows (slightly modified) with Vim 7.3.822.
      > mkdir test1
      > mkdir test2
      > touch test1/test1.txt
      > touch test2/test2.txt
      > gvim -N -u NONE -i NONE test1/test1.txt test2/test2.txt
      > :set autochdir
      > :pwd
      > /accts/btfritz/temp/test1
      > :call setbufvar('test2', 'myvar', "foobar")
      > :pwd
      > /accts/btfritz/temp/test2

      Here is a patch.

      regards,
      Christian

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Ben Fritz
      ... A while ago there was a similar problem where :vimgrep was causing directory changes due to autochdir . The fix for :vimgrep also had to deal with
      Message 2 of 7 , Jul 31 8:17 AM
      • 0 Attachment
        On Wednesday, July 31, 2013 9:37:24 AM UTC-5, Christian Brabandt wrote:
        > On Tue, July 16, 2013 16:57, Benjamin Fritz wrote:
        >
        > > Eric Van Dewoestine found this while investigating an eclim issue I was
        >
        > having.
        >
        > > When 'autochdir' is set, calling setbufvar() changes Vim's current
        >
        > directory to that of the buffer having its variable set. I think this
        >
        > should not happen.
        >
        > > Reproduced using the following on Solaris with Vim 7.4a.6, and also on
        >
        > Windows (slightly modified) with Vim 7.3.822.
        >
        > > mkdir test1
        >
        > > mkdir test2
        >
        > > touch test1/test1.txt
        >
        > > touch test2/test2.txt
        >
        > > gvim -N -u NONE -i NONE test1/test1.txt test2/test2.txt
        >
        > > :set autochdir
        >
        > > :pwd
        >
        > > /accts/btfritz/temp/test1
        >
        > > :call setbufvar('test2', 'myvar', "foobar")
        >
        > > :pwd
        >
        > > /accts/btfritz/temp/test2
        >
        >
        >
        > Here is a patch.
        >

        A while ago there was a similar problem where :vimgrep was causing directory changes due to 'autochdir'. The fix for :vimgrep also had to deal with autocmds which might change the directory. Since there is a call to unblock_autocmds() right after your code changes, do I assume correctly that this was not needed in this fix, because autocmd processing is blocked?

        --
        --
        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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Christian Brabandt
        ... Are you talking about issue 72? As far as I know, this issue is still open, but a patch from me available. ... Correct. Basically the buffer is opened in a
        Message 3 of 7 , Jul 31 8:31 AM
        • 0 Attachment
          On Wed, July 31, 2013 17:17, Ben Fritz wrote:
          > A while ago there was a similar problem where :vimgrep was causing
          > directory changes due to 'autochdir'. The fix for :vimgrep also had to
          > deal with autocmds which might change the directory.

          Are you talking about issue 72? As far as I know, this issue is still
          open, but a patch from me available.

          > Since there is a call to unblock_autocmds() right after your code
          > changes, do I assume correctly that this was not needed in this fix,
          > because autocmd processing is blocked?

          Correct. Basically the buffer is opened in a new window before working
          with it and closed afterwards so it doesn't really make sense in that
          case to either respect the autochdir setting or execute Buf-/WinEnter
          autocommands.

          regards,
          Christian

          --
          --
          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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Ben Fritz
          ... Nope, I was talking about the issue fixed by patch 509. I forgot about issue 72. ... Great, thanks! I guess the difference is that :vimgrep must examine
          Message 4 of 7 , Jul 31 9:05 AM
          • 0 Attachment
            On Wednesday, July 31, 2013 10:31:54 AM UTC-5, Christian Brabandt wrote:
            > On Wed, July 31, 2013 17:17, Ben Fritz wrote:
            >
            > > A while ago there was a similar problem where :vimgrep was causing
            >
            > > directory changes due to 'autochdir'. The fix for :vimgrep also had to
            >
            > > deal with autocmds which might change the directory.
            >
            >
            >
            > Are you talking about issue 72? As far as I know, this issue is still
            >
            > open, but a patch from me available.
            >
            >

            Nope, I was talking about the issue fixed by patch 509. I forgot about issue 72.

            >
            > > Since there is a call to unblock_autocmds() right after your code
            >
            > > changes, do I assume correctly that this was not needed in this fix,
            >
            > > because autocmd processing is blocked?
            >
            >
            >
            > Correct. Basically the buffer is opened in a new window before working
            >
            > with it and closed afterwards so it doesn't really make sense in that
            >
            > case to either respect the autochdir setting or execute Buf-/WinEnter
            >
            > autocommands.
            >

            Great, thanks! I guess the difference is that :vimgrep must examine file contents, which might rely on autocmds for doing things like searching through zip files.

            --
            --
            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

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Bram Moolenaar
            ... Thanks! -- Time is an illusion. Lunchtime doubly so. -- Ford Prefect, in Douglas Adams The Hitchhiker s Guide to the Galaxy /// Bram Moolenaar --
            Message 5 of 7 , Jul 31 11:52 AM
            • 0 Attachment
              Christian Brabandt wrote:

              > On Tue, July 16, 2013 16:57, Benjamin Fritz wrote:
              > > Eric Van Dewoestine found this while investigating an eclim issue I was having.
              > > When 'autochdir' is set, calling setbufvar() changes Vim's current
              > > directory to that of the buffer having its variable set. I think this
              > > should not happen.
              > > Reproduced using the following on Solaris with Vim 7.4a.6, and also on
              > > Windows (slightly modified) with Vim 7.3.822.
              > > mkdir test1
              > > mkdir test2
              > > touch test1/test1.txt
              > > touch test2/test2.txt
              > > gvim -N -u NONE -i NONE test1/test1.txt test2/test2.txt
              > > :set autochdir
              > > :pwd
              > > /accts/btfritz/temp/test1
              > > :call setbufvar('test2', 'myvar', "foobar")
              > > :pwd
              > > /accts/btfritz/temp/test2
              >
              > Here is a patch.

              Thanks!

              --
              Time is an illusion. Lunchtime doubly so.
              -- Ford Prefect, in Douglas Adams'
              "The Hitchhiker's Guide to the Galaxy"

              /// Bram Moolenaar -- Bram@... -- 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 ///

              --
              --
              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

              ---
              You received this message because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            Your message has been successfully submitted and would be delivered to recipients shortly.