updated for version 7.3.963
Problem:    Setting curbuf without curwin causes trouble.
Solution:   Add switch_buffer() and restore_buffer().  Block autocommands to
            avoid trouble.
diff --git a/src/proto/eval.pro b/src/proto/eval.pro
index 7af6cd3..dfea118 100644
--- a/src/proto/eval.pro
+++ b/src/proto/eval.pro
@@ -33,6 +33,8 @@
 void prof_child_exit __ARGS((proftime_T *tm));
 int eval_foldexpr __ARGS((char_u *arg, int *cp));
 void ex_let __ARGS((exarg_T *eap));
+void list_add_watch __ARGS((list_T *l, listwatch_T *lw));
+void list_rem_watch __ARGS((list_T *l, listwatch_T *lwrem));
 void *eval_for_line __ARGS((char_u *arg, int *errp, char_u **nextcmdp, int skip));
 int next_for_item __ARGS((void *fi_void, char_u *arg));
 void free_for_info __ARGS((void *fi_void));
@@ -125,8 +127,4 @@
 void ex_oldfiles __ARGS((exarg_T *eap));
 int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
 char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
-int switch_win __ARGS((win_T **, tabpage_T **, win_T *, tabpage_T *));
-void restore_win __ARGS((win_T *, tabpage_T *));
-void list_add_watch __ARGS((list_T *l, listwatch_T *lw));
-void list_rem_watch __ARGS((list_T *l, listwatch_T *lwrem));
 /* vim: set ft=c : */
diff --git a/src/proto/window.pro b/src/proto/window.pro
index a7fcf0c..83116c9 100644
--- a/src/proto/window.pro
+++ b/src/proto/window.pro
@@ -32,6 +32,7 @@
 void tabpage_move __ARGS((int nr));
 void win_goto __ARGS((win_T *wp));
 win_T *win_find_nr __ARGS((int winnr));
+tabpage_T *win_find_tabpage __ARGS((win_T *win));
 void win_enter __ARGS((win_T *wp, int undo_sync));
 win_T *buf_jump_open_win __ARGS((buf_T *buf));
 win_T *buf_jump_open_tab __ARGS((buf_T *buf));
@@ -69,6 +70,10 @@
 void check_lnums __ARGS((int do_curwin));
 void make_snapshot __ARGS((int idx));
 void restore_snapshot __ARGS((int idx, int close_curwin));
+int switch_win __ARGS((win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp));
+void restore_win __ARGS((win_T *save_curwin, tabpage_T *save_curtab));
+void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
+void restore_buffer __ARGS((buf_T *save_curbuf));
 int win_hasvertsplit __ARGS((void));
 int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id));
 int match_delete __ARGS((win_T *wp, int id, int perr));