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

Re: [PATCH] (6/?) Python interface improvements: add vim.options, vim.window.options and vim.buffer.options

Expand Messages
  • Bram Moolenaar
    ... Thanks for the documentation. ... There was a return in setwinvar() that now no longer works, because it s in a nested function. ... setwinvar() did return
    Message 1 of 49 , Apr 24, 2013
    • 0 Attachment
      ZyX wrote:

      > > I have not included this patch yet, mainly because the documentation is
      > > missing.

      Thanks for the documentation.

      > > For switch_win() and restore_win(): These have side effects, they
      > > execute autocommands. The docs should mention that, see settabwinvar()
      > > for an example. Also, failures should be handled, currently it will
      > > silently work on the current window. Autocommands can be very nasty!
      >
      > As tabpage being “switched” to is the same as `curtab` no autocommands
      > are launched thus no errors need to be handled in my code. In
      > `getwinvar` though tab pages are not switched in any case; I will
      > change code in option.c/get_option_value_strict to use the same code.

      There was a return in setwinvar() that now no longer works, because it's
      in a nested function.

      > Note: [`setwinvar()` in eval.c][1] I was taking code from is *not*
      > checking for successful switch. It only checks for errors in
      > arguments. What exactly am I supposed to handle in case I add
      > `vim.tabpage` object which is one of the plans?

      setwinvar() did return in the lines you removed:

      - if (!win_valid(win))
      - return;

      > About autocmds:
      >
      > 1. Why `setwinvar()` is not just ignoring autocommands? It is a matter
      > of passing one additional argument to `switch_win()` and then down to
      > `enter_tabpage()` and `win_enter_ext()` as far as I see? Are there
      > some culprits?

      I don't recall why it's done this way. goto_tabpage_tp() even has an
      argument to skip autocommands. Perhaps some side effects further down?
      The goal of the function is to set a variable, side effects are
      unwanted, thus if we can avoid executing autocommands I'm all for it.

      > 2. Why [`enter_tabpage()` in window.c][2] has `trigger_autocmds`
      > marked as UNUSED, but is actually using it in #ifdef FEAT_AUTOCMD?

      UNUSED needs to be added if there is any combination of features that
      makes the argument unused. It's ugly and makes it mostly useless.


      --
      A computer without Windows is like a fish without a bicycle.

      /// 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.
    • ZyX
      ... Because you have problems with encoding somewhere: there were no question marks in the patch, but Russian text. I just was not aware of the strange choice:
      Message 49 of 49 , May 15, 2013
      • 0 Attachment
        > After including this patch the tests were failing. The .ok files had
        > "????" where the test results in "window". I assume those question
        > marks were wrong, so I fixed the .ok files for that. But I wonder why
        > this happened.

        Because you have problems with encoding somewhere: there were no question marks in the patch, but Russian text. I just was not aware of the strange choice: using translated strings in `repr()`. I think translated messages here are just as “good” as translated exceptions; needless to say I have never seen them translated in other projects.

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