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 -- [email protected] -- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
