updated for version 7.0d
diff --git a/src/GvimExt/GvimExt.reg b/src/GvimExt/GvimExt.reg
index b592345..0169fe1 100644
--- a/src/GvimExt/GvimExt.reg
+++ b/src/GvimExt/GvimExt.reg
@@ -15,6 +15,6 @@
 [HKEY_LOCAL_MACHINE\Software\Vim\Gvim]
    "path"="gvim.exe"
 
-[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 7.0c]
-   "DisplayName"="Vim 7.0c: Edit with Vim popup menu entry"
+[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 7.0d]
+   "DisplayName"="Vim 7.0d: Edit with Vim popup menu entry"
    "UninstallString"="uninstal.exe"
diff --git a/src/Makefile b/src/Makefile
index c79f96d..625271f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -880,7 +880,7 @@
 
 ### Vim version (adjusted by a script)
 VIMMAJOR = 7
-VIMMINOR = 0c
+VIMMINOR = 0d
 
 ### Location of Vim files (should not need to be changed, and  {{{1
 ### some things might not work when they are changed!)
diff --git a/src/buffer.c b/src/buffer.c
index fbad67c..64ed971 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1212,7 +1212,11 @@
     {
 # ifdef FEAT_WINDOWS
 	/* jump to first window containing buf if one exists ("useopen") */
-	if (vim_strchr(p_swb, 'u') && buf_jump_open_win(buf))
+	if (vim_strchr(p_swb, 'o') && buf_jump_open_win(buf))
+	    return OK;
+	/* jump to first window in any tab page containing buf if one exists
+	 * ("usetab") */
+	if (vim_strchr(p_swb, 'a') && buf_jump_open_tab(buf))
 	    return OK;
 	if (win_split(0, 0) == FAIL)
 # endif
@@ -1316,7 +1320,7 @@
 #endif
 	{
 	    if (prevbuf == curbuf)
-		u_sync();
+		u_sync(FALSE);
 	    close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, prevbuf,
 		    unload ? action : (action == DOBUF_GOTO
 			&& !P_HID(prevbuf)
@@ -1833,8 +1837,11 @@
     if (options & GETF_SWITCH)
     {
 	/* use existing open window for buffer if wanted */
-	if (vim_strchr(p_swb, 'u'))     /* useopen */
+	if (vim_strchr(p_swb, 'o'))     /* useopen */
 	    wp = buf_jump_open_win(buf);
+	/* use existing open window in any tab page for buffer if wanted */
+	if (vim_strchr(p_swb, 'a'))     /* usetab */
+	    wp = buf_jump_open_tab(buf);
 	/* split window if wanted ("split") */
 	if (wp == NULL && vim_strchr(p_swb, 't') && !bufempty())
 	{
diff --git a/src/diff.c b/src/diff.c
index f02aa5e..bc0364c 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -2233,7 +2233,7 @@
 	 * another buffer.  Sync undo if the command was typed.  This isn't
 	 * 100% right when ":diffput" is used in a function or mapping. */
 	if (KeyTyped)
-	    u_sync();
+	    u_sync(FALSE);
 	aucmd_restbuf(&aco);
     }
 
diff --git a/src/edit.c b/src/edit.c
index e70a235..08a24d7 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -90,6 +90,10 @@
 static compl_T    *compl_curr_match = NULL;
 static compl_T    *compl_shown_match = NULL;
 
+/* After using a cursor key <Enter> selects a match in the popup menu,
+ * otherwise it inserts a line break. */
+static int	  compl_enter_selects = FALSE;
+
 /* When "compl_leader" is not NULL only matches that start with this string
  * are used. */
 static char_u	  *compl_leader = NULL;
@@ -726,8 +730,10 @@
 		    continue;
 		}
 
-		/* Pressing CTRL-Y selects the current match. */
-		if (c == Ctrl_Y)
+		/* Pressing CTRL-Y selects the current match.  Shen
+		 * compl_enter_selects is set the Enter key does the same. */
+		if (c == Ctrl_Y || (compl_enter_selects
+				   && (c == CAR || c == K_KENTER || c == NL)))
 		{
 		    ins_compl_delete();
 		    ins_compl_insert();
@@ -2915,6 +2921,7 @@
     edit_submode_extra = NULL;
     vim_free(compl_orig_text);
     compl_orig_text = NULL;
+    compl_enter_selects = FALSE;
 }
 
 /*
@@ -2976,6 +2983,7 @@
 	/* Show the popup menu with a different set of matches. */
 	ins_compl_show_pum();
 	compl_used_match = FALSE;
+	compl_enter_selects = FALSE;
 
 	return TRUE;
     }
@@ -3014,6 +3022,7 @@
 	ins_compl_del_pum();
 	ins_compl_show_pum();
 	compl_used_match = FALSE;
+	compl_enter_selects = FALSE;
 	ins_compl_set_original_text(compl_leader);
     }
 }
@@ -3277,8 +3286,11 @@
 	    auto_format(FALSE, TRUE);
 
 	    /* If the popup menu is displayed pressing CTRL-Y means accepting
-	     * the selection without inserting anything. */
-	    if (c == Ctrl_Y && pum_visible())
+	     * the selection without inserting anything.  When
+	     * compl_enter_selects is set the Enter key does the same. */
+	    if ((c == Ctrl_Y || (compl_enter_selects
+				   && (c == CAR || c == K_KENTER || c == NL)))
+		    && pum_visible())
 		retval = TRUE;
 
 	    /* CTRL-E means completion is Ended, go back to the typed text. */
@@ -3298,6 +3310,7 @@
 	    compl_matches = 0;
 	    msg_clr_cmdline();		/* necessary for "noshowmode" */
 	    ctrl_x_mode = 0;
+	    compl_enter_selects = FALSE;
 	    if (edit_submode != NULL)
 	    {
 		edit_submode = NULL;
@@ -4049,6 +4062,10 @@
 	ins_compl_delete();
     }
 
+    /* Enter will select a match when the match wasn't inserted and the popup
+     * menu is visislbe. */
+    compl_enter_selects = !insert_match && compl_match_array != NULL;
+
     /*
      * Show the file name for the match (if any)
      * Truncate the file name to avoid a wait for return.
@@ -7277,7 +7294,7 @@
 		  break;
 
 	/* CTRL-G u: start new undoable edit */
-	case 'u': u_sync();
+	case 'u': u_sync(TRUE);
 		  ins_need_undo = TRUE;
 
 		  /* Need to reset Insstart, esp. because a BS that joins
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 790b30e..9206e02 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3253,7 +3253,7 @@
 		    buf_copy_options(buf, BCO_ENTER);
 
 		/* close the link to the current buffer */
-		u_sync();
+		u_sync(FALSE);
 		close_buffer(curwin, curbuf,
 				      (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD);
 
@@ -4289,7 +4289,7 @@
 
     if (!do_count && !curbuf->b_p_ma)
     {
-	/* Substitusion is not allowed in non-'modifiable' buffer */
+	/* Substitution is not allowed in non-'modifiable' buffer */
 	EMSG(_(e_modifiable));
 	return;
     }
@@ -6919,12 +6919,7 @@
 	    if (wp->w_buffer == buf)
 	    {
 # ifdef FEAT_WINDOWS
-		goto_tabpage_tp(tp);
-		win_enter(wp, TRUE);
-#  ifdef FEAT_GUI_TABLINE
-		if (gui_use_tabline())
-		    gui_mch_set_curtab(tabpage_index(curtab));
-#  endif
+		goto_tabpage_win(tp, wp);
 # endif
 		curwin->w_arg_idx = 0;
 		return;
diff --git a/src/getchar.c b/src/getchar.c
index 60a2a9b..4c38cd7 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1201,8 +1201,8 @@
 may_sync_undo()
 {
     if ((!(State & (INSERT + CMDLINE)) || arrow_used)
-	    && scriptin[curscript] == NULL && no_u_sync == 0)
-	u_sync();
+					       && scriptin[curscript] == NULL)
+	u_sync(FALSE);
 }
 
 /*
diff --git a/src/gui.c b/src/gui.c
index 208b721..3d677db 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -4931,8 +4931,7 @@
 		if (u_save_cursor() == OK)
 		{
 		    /* A button was pressed thus undo should be synced. */
-		    if (no_u_sync == 0)
-			u_sync();
+		    u_sync(FALSE);
 
 		    del_bytes((long)(regmatch.endp[0] - regmatch.startp[0]),
 								FALSE, FALSE);
@@ -4948,8 +4947,7 @@
     if (type == FRD_REPLACEALL)
     {
 	/* A button was pressed, thus undo should be synced. */
-	if (no_u_sync == 0)
-	    u_sync();
+	u_sync(FALSE);
 	do_cmdline_cmd(ga.ga_data);
     }
     else
diff --git a/src/option.c b/src/option.c
index 8ed4f34..0a4d9c7 100644
--- a/src/option.c
+++ b/src/option.c
@@ -2811,7 +2811,7 @@
 #ifdef FEAT_SCROLLBIND
 static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
 #endif
-static char *(p_swb_values[]) = {"useopen", "split", NULL};
+static char *(p_swb_values[]) = {"useopen", "usetab", "split", NULL};
 static char *(p_debug_values[]) = {"msg", "beep", NULL};
 #ifdef FEAT_VERTSPLIT
 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
@@ -7767,7 +7767,7 @@
     {
 	/* use the old value, otherwise u_sync() may not work properly */
 	p_ul = old_value;
-	u_sync();
+	u_sync(TRUE);
 	p_ul = value;
     }
 
diff --git a/src/popupmnu.c b/src/popupmnu.c
index 9f1fae4..a332477 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -427,18 +427,24 @@
 		    while (!bufempty())
 			ml_delete((linenr_T)1, FALSE);
 		}
-		else if ((res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0))
-									== OK)
+		else
 		{
-		    /* Edit a new, empty buffer. Set options for a "wipeout"
-		     * buffer. */
-		    set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
-		    set_option_value((char_u *)"bt", 0L, (char_u *)"nofile",
-								   OPT_LOCAL);
-		    set_option_value((char_u *)"bh", 0L, (char_u *)"wipe",
-								   OPT_LOCAL);
-		    set_option_value((char_u *)"diff", 0L, (char_u *)"",
-								   OPT_LOCAL);
+		    /* Don't want to sync undo in the current buffer. */
+		    ++no_u_sync;
+		    res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0);
+		    --no_u_sync;
+		    if (res == OK)
+		    {
+			/* Edit a new, empty buffer. Set options for a "wipeout"
+			 * buffer. */
+			set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
+			set_option_value((char_u *)"bt", 0L,
+					       (char_u *)"nofile", OPT_LOCAL);
+			set_option_value((char_u *)"bh", 0L,
+						 (char_u *)"wipe", OPT_LOCAL);
+			set_option_value((char_u *)"diff", 0L,
+						     (char_u *)"", OPT_LOCAL);
+		    }
 		}
 		if (res == OK)
 		{
diff --git a/src/proto/ex_cmds.pro b/src/proto/ex_cmds.pro
index 4382e65..7582dff 100644
--- a/src/proto/ex_cmds.pro
+++ b/src/proto/ex_cmds.pro
@@ -1,59 +1,59 @@
 /* ex_cmds.c */
-void do_ascii __ARGS((exarg_T *eap));
-void ex_align __ARGS((exarg_T *eap));
-void ex_sort __ARGS((exarg_T *eap));
-void ex_retab __ARGS((exarg_T *eap));
-int do_move __ARGS((linenr_T line1, linenr_T line2, linenr_T dest));
-void ex_copy __ARGS((linenr_T line1, linenr_T line2, linenr_T n));
-void free_prev_shellcmd __ARGS((void));
-void do_bang __ARGS((int addr_count, exarg_T *eap, int forceit, int do_in, int do_out));
-void do_shell __ARGS((char_u *cmd, int flags));
-char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
-void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
-int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
-int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
-void write_viminfo __ARGS((char_u *file, int forceit));
-int viminfo_readline __ARGS((vir_T *virp));
-char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
-void viminfo_writestring __ARGS((FILE *fd, char_u *p));
-void do_fixdel __ARGS((exarg_T *eap));
-void print_line_no_prefix __ARGS((linenr_T lnum, int use_number, int list));
-void print_line __ARGS((linenr_T lnum, int use_number, int list));
-void ex_file __ARGS((exarg_T *eap));
-void ex_update __ARGS((exarg_T *eap));
-void ex_write __ARGS((exarg_T *eap));
-int do_write __ARGS((exarg_T *eap));
-void ex_wnext __ARGS((exarg_T *eap));
-void do_wqall __ARGS((exarg_T *eap));
-int not_writing __ARGS((void));
-int getfile __ARGS((int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum, int forceit));
-int do_ecmd __ARGS((int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags));
-void ex_append __ARGS((exarg_T *eap));
-void ex_change __ARGS((exarg_T *eap));
-void ex_z __ARGS((exarg_T *eap));
-int check_restricted __ARGS((void));
-int check_secure __ARGS((void));
-void do_sub __ARGS((exarg_T *eap));
-int do_sub_msg __ARGS((int count_only));
-void ex_global __ARGS((exarg_T *eap));
-void global_exe __ARGS((char_u *cmd));
-int read_viminfo_sub_string __ARGS((vir_T *virp, int force));
-void write_viminfo_sub_string __ARGS((FILE *fp));
-void free_old_sub __ARGS((void));
-int prepare_tagpreview __ARGS((int undo_sync));
-void ex_help __ARGS((exarg_T *eap));
-char_u *check_help_lang __ARGS((char_u *arg));
-int help_heuristic __ARGS((char_u *matched_string, int offset, int wrong_case));
-int find_help_tags __ARGS((char_u *arg, int *num_matches, char_u ***matches, int keep_lang));
-void fix_help_buffer __ARGS((void));
-void ex_exusage __ARGS((exarg_T *eap));
-void ex_viusage __ARGS((exarg_T *eap));
-void ex_helptags __ARGS((exarg_T *eap));
-void ex_sign __ARGS((exarg_T *eap));
-void sign_gui_started __ARGS((void));
-int sign_get_attr __ARGS((int typenr, int line));
-char_u *sign_get_text __ARGS((int typenr));
-void *sign_get_image __ARGS((int typenr));
-char_u *sign_typenr2name __ARGS((int typenr));
-void ex_drop __ARGS((exarg_T *eap));
+extern void do_ascii __ARGS((exarg_T *eap));
+extern void ex_align __ARGS((exarg_T *eap));
+extern void ex_sort __ARGS((exarg_T *eap));
+extern void ex_retab __ARGS((exarg_T *eap));
+extern int do_move __ARGS((linenr_T line1, linenr_T line2, linenr_T dest));
+extern void ex_copy __ARGS((linenr_T line1, linenr_T line2, linenr_T n));
+extern void free_prev_shellcmd __ARGS((void));
+extern void do_bang __ARGS((int addr_count, exarg_T *eap, int forceit, int do_in, int do_out));
+extern void do_shell __ARGS((char_u *cmd, int flags));
+extern char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
+extern void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
+extern int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
+extern int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
+extern void write_viminfo __ARGS((char_u *file, int forceit));
+extern int viminfo_readline __ARGS((vir_T *virp));
+extern char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
+extern void viminfo_writestring __ARGS((FILE *fd, char_u *p));
+extern void do_fixdel __ARGS((exarg_T *eap));
+extern void print_line_no_prefix __ARGS((linenr_T lnum, int use_number, int list));
+extern void print_line __ARGS((linenr_T lnum, int use_number, int list));
+extern void ex_file __ARGS((exarg_T *eap));
+extern void ex_update __ARGS((exarg_T *eap));
+extern void ex_write __ARGS((exarg_T *eap));
+extern int do_write __ARGS((exarg_T *eap));
+extern void ex_wnext __ARGS((exarg_T *eap));
+extern void do_wqall __ARGS((exarg_T *eap));
+extern int not_writing __ARGS((void));
+extern int getfile __ARGS((int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum, int forceit));
+extern int do_ecmd __ARGS((int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags));
+extern void ex_append __ARGS((exarg_T *eap));
+extern void ex_change __ARGS((exarg_T *eap));
+extern void ex_z __ARGS((exarg_T *eap));
+extern int check_restricted __ARGS((void));
+extern int check_secure __ARGS((void));
+extern void do_sub __ARGS((exarg_T *eap));
+extern int do_sub_msg __ARGS((int count_only));
+extern void ex_global __ARGS((exarg_T *eap));
+extern void global_exe __ARGS((char_u *cmd));
+extern int read_viminfo_sub_string __ARGS((vir_T *virp, int force));
+extern void write_viminfo_sub_string __ARGS((FILE *fp));
+extern void free_old_sub __ARGS((void));
+extern int prepare_tagpreview __ARGS((int undo_sync));
+extern void ex_help __ARGS((exarg_T *eap));
+extern char_u *check_help_lang __ARGS((char_u *arg));
+extern int help_heuristic __ARGS((char_u *matched_string, int offset, int wrong_case));
+extern int find_help_tags __ARGS((char_u *arg, int *num_matches, char_u ***matches, int keep_lang));
+extern void fix_help_buffer __ARGS((void));
+extern void ex_exusage __ARGS((exarg_T *eap));
+extern void ex_viusage __ARGS((exarg_T *eap));
+extern void ex_helptags __ARGS((exarg_T *eap));
+extern void ex_sign __ARGS((exarg_T *eap));
+extern void sign_gui_started __ARGS((void));
+extern int sign_get_attr __ARGS((int typenr, int line));
+extern char_u *sign_get_text __ARGS((int typenr));
+extern void *sign_get_image __ARGS((int typenr));
+extern char_u *sign_typenr2name __ARGS((int typenr));
+extern void ex_drop __ARGS((exarg_T *eap));
 /* vim: set ft=c : */
diff --git a/src/proto/ex_getln.pro b/src/proto/ex_getln.pro
index 9ccb42f..e6b5b87 100644
--- a/src/proto/ex_getln.pro
+++ b/src/proto/ex_getln.pro
@@ -1,54 +1,54 @@
 /* ex_getln.c */
-char_u *getcmdline __ARGS((int firstc, long count, int indent));
-char_u *getcmdline_prompt __ARGS((int firstc, char_u *prompt, int attr, int xp_context, char_u *xp_arg));
-int text_locked __ARGS((void));
-void text_locked_msg __ARGS((void));
-int curbuf_locked __ARGS((void));
-char_u *getexline __ARGS((int c, void *dummy, int indent));
-char_u *getexmodeline __ARGS((int promptc, void *dummy, int indent));
-int cmdline_overstrike __ARGS((void));
-int cmdline_at_end __ARGS((void));
-colnr_T cmdline_getvcol_cursor __ARGS((void));
-void free_cmdline_buf __ARGS((void));
-void putcmdline __ARGS((int c, int shift));
-void unputcmdline __ARGS((void));
-int put_on_cmdline __ARGS((char_u *str, int len, int redraw));
-void cmdline_paste_str __ARGS((char_u *s, int literally));
-void redrawcmdline __ARGS((void));
-void redrawcmd __ARGS((void));
-void compute_cmdrow __ARGS((void));
-void gotocmdline __ARGS((int clr));
-char_u *ExpandOne __ARGS((expand_T *xp, char_u *str, char_u *orig, int options, int mode));
-void ExpandInit __ARGS((expand_T *xp));
-void ExpandCleanup __ARGS((expand_T *xp));
-void ExpandEscape __ARGS((expand_T *xp, char_u *str, int numfiles, char_u **files, int options));
-void tilde_replace __ARGS((char_u *orig_pat, int num_files, char_u **files));
-char_u *sm_gettail __ARGS((char_u *s));
-char_u *addstar __ARGS((char_u *fname, int len, int context));
-void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
-int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
-int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
-char_u *globpath __ARGS((char_u *path, char_u *file));
-void init_history __ARGS((void));
-int get_histtype __ARGS((char_u *name));
-void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
-int get_history_idx __ARGS((int histype));
-char_u *get_cmdline_str __ARGS((void));
-int get_cmdline_pos __ARGS((void));
-int set_cmdline_pos __ARGS((int pos));
-int get_cmdline_type __ARGS((void));
-char_u *get_history_entry __ARGS((int histype, int idx));
-int clr_history __ARGS((int histype));
-int del_history_entry __ARGS((int histype, char_u *str));
-int del_history_idx __ARGS((int histype, int idx));
-void remove_key_from_history __ARGS((void));
-int get_list_range __ARGS((char_u **str, int *num1, int *num2));
-void ex_history __ARGS((exarg_T *eap));
-void prepare_viminfo_history __ARGS((int asklen));
-int read_viminfo_history __ARGS((vir_T *virp));
-void finish_viminfo_history __ARGS((void));
-void write_viminfo_history __ARGS((FILE *fp));
-void cmd_pchar __ARGS((int c, int offset));
-int cmd_gchar __ARGS((int offset));
-char_u *script_get __ARGS((exarg_T *eap, char_u *cmd));
+extern char_u *getcmdline __ARGS((int firstc, long count, int indent));
+extern char_u *getcmdline_prompt __ARGS((int firstc, char_u *prompt, int attr, int xp_context, char_u *xp_arg));
+extern int text_locked __ARGS((void));
+extern void text_locked_msg __ARGS((void));
+extern int curbuf_locked __ARGS((void));
+extern char_u *getexline __ARGS((int c, void *dummy, int indent));
+extern char_u *getexmodeline __ARGS((int promptc, void *dummy, int indent));
+extern int cmdline_overstrike __ARGS((void));
+extern int cmdline_at_end __ARGS((void));
+extern colnr_T cmdline_getvcol_cursor __ARGS((void));
+extern void free_cmdline_buf __ARGS((void));
+extern void putcmdline __ARGS((int c, int shift));
+extern void unputcmdline __ARGS((void));
+extern int put_on_cmdline __ARGS((char_u *str, int len, int redraw));
+extern void cmdline_paste_str __ARGS((char_u *s, int literally));
+extern void redrawcmdline __ARGS((void));
+extern void redrawcmd __ARGS((void));
+extern void compute_cmdrow __ARGS((void));
+extern void gotocmdline __ARGS((int clr));
+extern char_u *ExpandOne __ARGS((expand_T *xp, char_u *str, char_u *orig, int options, int mode));
+extern void ExpandInit __ARGS((expand_T *xp));
+extern void ExpandCleanup __ARGS((expand_T *xp));
+extern void ExpandEscape __ARGS((expand_T *xp, char_u *str, int numfiles, char_u **files, int options));
+extern void tilde_replace __ARGS((char_u *orig_pat, int num_files, char_u **files));
+extern char_u *sm_gettail __ARGS((char_u *s));
+extern char_u *addstar __ARGS((char_u *fname, int len, int context));
+extern void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
+extern int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
+extern int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
+extern char_u *globpath __ARGS((char_u *path, char_u *file));
+extern void init_history __ARGS((void));
+extern int get_histtype __ARGS((char_u *name));
+extern void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
+extern int get_history_idx __ARGS((int histype));
+extern char_u *get_cmdline_str __ARGS((void));
+extern int get_cmdline_pos __ARGS((void));
+extern int set_cmdline_pos __ARGS((int pos));
+extern int get_cmdline_type __ARGS((void));
+extern char_u *get_history_entry __ARGS((int histype, int idx));
+extern int clr_history __ARGS((int histype));
+extern int del_history_entry __ARGS((int histype, char_u *str));
+extern int del_history_idx __ARGS((int histype, int idx));
+extern void remove_key_from_history __ARGS((void));
+extern int get_list_range __ARGS((char_u **str, int *num1, int *num2));
+extern void ex_history __ARGS((exarg_T *eap));
+extern void prepare_viminfo_history __ARGS((int asklen));
+extern int read_viminfo_history __ARGS((vir_T *virp));
+extern void finish_viminfo_history __ARGS((void));
+extern void write_viminfo_history __ARGS((FILE *fp));
+extern void cmd_pchar __ARGS((int c, int offset));
+extern int cmd_gchar __ARGS((int offset));
+extern char_u *script_get __ARGS((exarg_T *eap, char_u *cmd));
 /* vim: set ft=c : */
diff --git a/src/proto/gui_motif.pro b/src/proto/gui_motif.pro
index 3e08ec9..57717b9 100644
--- a/src/proto/gui_motif.pro
+++ b/src/proto/gui_motif.pro
@@ -1,46 +1,46 @@
 /* gui_motif.c */
-void gui_x11_create_widgets __ARGS((void));
-void gui_x11_destroy_widgets __ARGS((void));
-void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h));
-void gui_x11_set_back_color __ARGS((void));
-void manage_centered __ARGS((Widget dialog_child));
-XmFontList gui_motif_create_fontlist __ARGS((XFontStruct *font));
-XmFontList gui_motif_fontset2fontlist __ARGS((XFontSet *fontset));
-void gui_mch_enable_menu __ARGS((int flag));
-void gui_motif_set_mnemonics __ARGS((int enable));
-void gui_mch_add_menu __ARGS((vimmenu_T *menu, int idx));
-void gui_mch_toggle_tearoffs __ARGS((int enable));
-int gui_mch_text_area_extra_height __ARGS((void));
-void gui_mch_compute_menu_height __ARGS((Widget id));
-void gui_mch_add_menu_item __ARGS((vimmenu_T *menu, int idx));
-void gui_motif_update_mousemodel __ARGS((vimmenu_T *menu));
-void gui_mch_new_menu_colors __ARGS((void));
-void gui_mch_new_menu_font __ARGS((void));
-void gui_mch_new_tooltip_font __ARGS((void));
-void gui_mch_new_tooltip_colors __ARGS((void));
-void gui_mch_destroy_menu __ARGS((vimmenu_T *menu));
-void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu));
-void gui_mch_def_colors __ARGS((void));
-void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max));
-void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int h));
-void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag));
-void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient));
-void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb));
-void gui_mch_set_scrollbar_colors __ARGS((scrollbar_T *sb));
-Window gui_x11_get_wid __ARGS((void));
-char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter));
-int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *button_names, int dfltbutton, char_u *textfield));
-void gui_mch_enable_footer __ARGS((int showit));
-void gui_mch_set_footer __ARGS((char_u *s));
-void gui_mch_show_toolbar __ARGS((int showit));
-int gui_mch_compute_toolbar_height __ARGS((void));
-void motif_get_toolbar_colors __ARGS((Pixel *bgp, Pixel *fgp, Pixel *bsp, Pixel *tsp, Pixel *hsp));
-void gui_mch_show_tabline __ARGS((int showit));
-int gui_mch_showing_tabline __ARGS((void));
-void gui_mch_update_tabline __ARGS((void));
-void gui_mch_set_curtab __ARGS((int nr));
-void gui_motif_menu_fontlist __ARGS((Widget id));
-void gui_mch_find_dialog __ARGS((exarg_T *eap));
-void gui_mch_replace_dialog __ARGS((exarg_T *eap));
-void gui_motif_synch_fonts __ARGS((void));
+extern void gui_x11_create_widgets __ARGS((void));
+extern void gui_x11_destroy_widgets __ARGS((void));
+extern void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h));
+extern void gui_x11_set_back_color __ARGS((void));
+extern void manage_centered __ARGS((Widget dialog_child));
+extern XmFontList gui_motif_create_fontlist __ARGS((XFontStruct *font));
+extern XmFontList gui_motif_fontset2fontlist __ARGS((XFontSet *fontset));
+extern void gui_mch_enable_menu __ARGS((int flag));
+extern void gui_motif_set_mnemonics __ARGS((int enable));
+extern void gui_mch_add_menu __ARGS((vimmenu_T *menu, int idx));
+extern void gui_mch_toggle_tearoffs __ARGS((int enable));
+extern int gui_mch_text_area_extra_height __ARGS((void));
+extern void gui_mch_compute_menu_height __ARGS((Widget id));
+extern void gui_mch_add_menu_item __ARGS((vimmenu_T *menu, int idx));
+extern void gui_motif_update_mousemodel __ARGS((vimmenu_T *menu));
+extern void gui_mch_new_menu_colors __ARGS((void));
+extern void gui_mch_new_menu_font __ARGS((void));
+extern void gui_mch_new_tooltip_font __ARGS((void));
+extern void gui_mch_new_tooltip_colors __ARGS((void));
+extern void gui_mch_destroy_menu __ARGS((vimmenu_T *menu));
+extern void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu));
+extern void gui_mch_def_colors __ARGS((void));
+extern void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max));
+extern void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int h));
+extern void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag));
+extern void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient));
+extern void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb));
+extern void gui_mch_set_scrollbar_colors __ARGS((scrollbar_T *sb));
+extern Window gui_x11_get_wid __ARGS((void));
+extern char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter));
+extern int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *button_names, int dfltbutton, char_u *textfield));
+extern void gui_mch_enable_footer __ARGS((int showit));
+extern void gui_mch_set_footer __ARGS((char_u *s));
+extern void gui_mch_show_toolbar __ARGS((int showit));
+extern int gui_mch_compute_toolbar_height __ARGS((void));
+extern void motif_get_toolbar_colors __ARGS((Pixel *bgp, Pixel *fgp, Pixel *bsp, Pixel *tsp, Pixel *hsp));
+extern void gui_mch_show_tabline __ARGS((int showit));
+extern int gui_mch_showing_tabline __ARGS((void));
+extern void gui_mch_update_tabline __ARGS((void));
+extern void gui_mch_set_curtab __ARGS((int nr));
+extern void gui_motif_menu_fontlist __ARGS((Widget id));
+extern void gui_mch_find_dialog __ARGS((exarg_T *eap));
+extern void gui_mch_replace_dialog __ARGS((exarg_T *eap));
+extern void gui_motif_synch_fonts __ARGS((void));
 /* vim: set ft=c : */
diff --git a/src/proto/misc1.pro b/src/proto/misc1.pro
index e9bc32c..7d804b9 100644
--- a/src/proto/misc1.pro
+++ b/src/proto/misc1.pro
@@ -1,95 +1,95 @@
 /* misc1.c */
-int get_indent __ARGS((void));
-int get_indent_lnum __ARGS((linenr_T lnum));
-int get_indent_buf __ARGS((buf_T *buf, linenr_T lnum));
-int get_indent_str __ARGS((char_u *ptr, int ts));
-int set_indent __ARGS((int size, int flags));
-int get_number_indent __ARGS((linenr_T lnum));
-int open_line __ARGS((int dir, int flags, int old_indent));
-int get_leader_len __ARGS((char_u *line, char_u **flags, int backward));
-int plines __ARGS((linenr_T lnum));
-int plines_win __ARGS((win_T *wp, linenr_T lnum, int winheight));
-int plines_nofill __ARGS((linenr_T lnum));
-int plines_win_nofill __ARGS((win_T *wp, linenr_T lnum, int winheight));
-int plines_win_nofold __ARGS((win_T *wp, linenr_T lnum));
-int plines_win_col __ARGS((win_T *wp, linenr_T lnum, long column));
-int plines_m_win __ARGS((win_T *wp, linenr_T first, linenr_T last));
-void ins_bytes __ARGS((char_u *p));
-void ins_bytes_len __ARGS((char_u *p, int len));
-void ins_char __ARGS((int c));
-void ins_char_bytes __ARGS((char_u *buf, int charlen));
-void ins_str __ARGS((char_u *s));
-int del_char __ARGS((int fixpos));
-int del_chars __ARGS((long count, int fixpos));
-int del_bytes __ARGS((long count, int fixpos_arg, int use_delcombine));
-int truncate_line __ARGS((int fixpos));
-void del_lines __ARGS((long nlines, int undo));
-int gchar_pos __ARGS((pos_T *pos));
-int gchar_cursor __ARGS((void));
-void pchar_cursor __ARGS((int c));
-int inindent __ARGS((int extra));
-char_u *skip_to_option_part __ARGS((char_u *p));
-void changed __ARGS((void));
-void changed_bytes __ARGS((linenr_T lnum, colnr_T col));
-void appended_lines __ARGS((linenr_T lnum, long count));
-void appended_lines_mark __ARGS((linenr_T lnum, long count));
-void deleted_lines __ARGS((linenr_T lnum, long count));
-void deleted_lines_mark __ARGS((linenr_T lnum, long count));
-void changed_lines __ARGS((linenr_T lnum, colnr_T col, linenr_T lnume, long xtra));
-void unchanged __ARGS((buf_T *buf, int ff));
-void check_status __ARGS((buf_T *buf));
-void change_warning __ARGS((int col));
-int ask_yesno __ARGS((char_u *str, int direct));
-int get_keystroke __ARGS((void));
-int get_number __ARGS((int colon, int *mouse_used));
-int prompt_for_number __ARGS((int *mouse_used));
-void msgmore __ARGS((long n));
-void beep_flush __ARGS((void));
-void vim_beep __ARGS((void));
-void init_homedir __ARGS((void));
-void free_homedir __ARGS((void));
-void expand_env __ARGS((char_u *src, char_u *dst, int dstlen));
-void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, char_u *startstr));
-char_u *vim_getenv __ARGS((char_u *name, int *mustfree));
-char_u *expand_env_save __ARGS((char_u *src));
-void vim_setenv __ARGS((char_u *name, char_u *val));
-char_u *get_env_name __ARGS((expand_T *xp, int idx));
-void home_replace __ARGS((buf_T *buf, char_u *src, char_u *dst, int dstlen, int one));
-char_u *home_replace_save __ARGS((buf_T *buf, char_u *src));
-int fullpathcmp __ARGS((char_u *s1, char_u *s2, int checkname));
-char_u *gettail __ARGS((char_u *fname));
-char_u *gettail_sep __ARGS((char_u *fname));
-char_u *getnextcomp __ARGS((char_u *fname));
-char_u *get_past_head __ARGS((char_u *path));
-int vim_ispathsep __ARGS((int c));
-int vim_ispathlistsep __ARGS((int c));
-void shorten_dir __ARGS((char_u *str));
-int dir_of_file_exists __ARGS((char_u *fname));
-int vim_fnamecmp __ARGS((char_u *x, char_u *y));
-int vim_fnamencmp __ARGS((char_u *x, char_u *y, size_t len));
-char_u *concat_fnames __ARGS((char_u *fname1, char_u *fname2, int sep));
-char_u *concat_str __ARGS((char_u *str1, char_u *str2));
-void add_pathsep __ARGS((char_u *p));
-char_u *FullName_save __ARGS((char_u *fname, int force));
-pos_T *find_start_comment __ARGS((int ind_maxcomment));
-void do_c_expr_indent __ARGS((void));
-int cin_islabel __ARGS((int ind_maxcomment));
-int cin_iscase __ARGS((char_u *s));
-int cin_isscopedecl __ARGS((char_u *s));
-int get_c_indent __ARGS((void));
-int get_expr_indent __ARGS((void));
-int get_lisp_indent __ARGS((void));
-void prepare_to_exit __ARGS((void));
-void preserve_exit __ARGS((void));
-int vim_fexists __ARGS((char_u *fname));
-void line_breakcheck __ARGS((void));
-void fast_breakcheck __ARGS((void));
-int expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags));
-int match_suffix __ARGS((char_u *fname));
-int unix_expandpath __ARGS((garray_T *gap, char_u *path, int wildoff, int flags, int didstar));
-int gen_expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags));
-void addfile __ARGS((garray_T *gap, char_u *f, int flags));
-char_u *get_cmd_output __ARGS((char_u *cmd, char_u *infile, int flags));
-void FreeWild __ARGS((int count, char_u **files));
-int goto_im __ARGS((void));
+extern int get_indent __ARGS((void));
+extern int get_indent_lnum __ARGS((linenr_T lnum));
+extern int get_indent_buf __ARGS((buf_T *buf, linenr_T lnum));
+extern int get_indent_str __ARGS((char_u *ptr, int ts));
+extern int set_indent __ARGS((int size, int flags));
+extern int get_number_indent __ARGS((linenr_T lnum));
+extern int open_line __ARGS((int dir, int flags, int old_indent));
+extern int get_leader_len __ARGS((char_u *line, char_u **flags, int backward));
+extern int plines __ARGS((linenr_T lnum));
+extern int plines_win __ARGS((win_T *wp, linenr_T lnum, int winheight));
+extern int plines_nofill __ARGS((linenr_T lnum));
+extern int plines_win_nofill __ARGS((win_T *wp, linenr_T lnum, int winheight));
+extern int plines_win_nofold __ARGS((win_T *wp, linenr_T lnum));
+extern int plines_win_col __ARGS((win_T *wp, linenr_T lnum, long column));
+extern int plines_m_win __ARGS((win_T *wp, linenr_T first, linenr_T last));
+extern void ins_bytes __ARGS((char_u *p));
+extern void ins_bytes_len __ARGS((char_u *p, int len));
+extern void ins_char __ARGS((int c));
+extern void ins_char_bytes __ARGS((char_u *buf, int charlen));
+extern void ins_str __ARGS((char_u *s));
+extern int del_char __ARGS((int fixpos));
+extern int del_chars __ARGS((long count, int fixpos));
+extern int del_bytes __ARGS((long count, int fixpos_arg, int use_delcombine));
+extern int truncate_line __ARGS((int fixpos));
+extern void del_lines __ARGS((long nlines, int undo));
+extern int gchar_pos __ARGS((pos_T *pos));
+extern int gchar_cursor __ARGS((void));
+extern void pchar_cursor __ARGS((int c));
+extern int inindent __ARGS((int extra));
+extern char_u *skip_to_option_part __ARGS((char_u *p));
+extern void changed __ARGS((void));
+extern void changed_bytes __ARGS((linenr_T lnum, colnr_T col));
+extern void appended_lines __ARGS((linenr_T lnum, long count));
+extern void appended_lines_mark __ARGS((linenr_T lnum, long count));
+extern void deleted_lines __ARGS((linenr_T lnum, long count));
+extern void deleted_lines_mark __ARGS((linenr_T lnum, long count));
+extern void changed_lines __ARGS((linenr_T lnum, colnr_T col, linenr_T lnume, long xtra));
+extern void unchanged __ARGS((buf_T *buf, int ff));
+extern void check_status __ARGS((buf_T *buf));
+extern void change_warning __ARGS((int col));
+extern int ask_yesno __ARGS((char_u *str, int direct));
+extern int get_keystroke __ARGS((void));
+extern int get_number __ARGS((int colon, int *mouse_used));
+extern int prompt_for_number __ARGS((int *mouse_used));
+extern void msgmore __ARGS((long n));
+extern void beep_flush __ARGS((void));
+extern void vim_beep __ARGS((void));
+extern void init_homedir __ARGS((void));
+extern void free_homedir __ARGS((void));
+extern void expand_env __ARGS((char_u *src, char_u *dst, int dstlen));
+extern void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, char_u *startstr));
+extern char_u *vim_getenv __ARGS((char_u *name, int *mustfree));
+extern char_u *expand_env_save __ARGS((char_u *src));
+extern void vim_setenv __ARGS((char_u *name, char_u *val));
+extern char_u *get_env_name __ARGS((expand_T *xp, int idx));
+extern void home_replace __ARGS((buf_T *buf, char_u *src, char_u *dst, int dstlen, int one));
+extern char_u *home_replace_save __ARGS((buf_T *buf, char_u *src));
+extern int fullpathcmp __ARGS((char_u *s1, char_u *s2, int checkname));
+extern char_u *gettail __ARGS((char_u *fname));
+extern char_u *gettail_sep __ARGS((char_u *fname));
+extern char_u *getnextcomp __ARGS((char_u *fname));
+extern char_u *get_past_head __ARGS((char_u *path));
+extern int vim_ispathsep __ARGS((int c));
+extern int vim_ispathlistsep __ARGS((int c));
+extern void shorten_dir __ARGS((char_u *str));
+extern int dir_of_file_exists __ARGS((char_u *fname));
+extern int vim_fnamecmp __ARGS((char_u *x, char_u *y));
+extern int vim_fnamencmp __ARGS((char_u *x, char_u *y, size_t len));
+extern char_u *concat_fnames __ARGS((char_u *fname1, char_u *fname2, int sep));
+extern char_u *concat_str __ARGS((char_u *str1, char_u *str2));
+extern void add_pathsep __ARGS((char_u *p));
+extern char_u *FullName_save __ARGS((char_u *fname, int force));
+extern pos_T *find_start_comment __ARGS((int ind_maxcomment));
+extern void do_c_expr_indent __ARGS((void));
+extern int cin_islabel __ARGS((int ind_maxcomment));
+extern int cin_iscase __ARGS((char_u *s));
+extern int cin_isscopedecl __ARGS((char_u *s));
+extern int get_c_indent __ARGS((void));
+extern int get_expr_indent __ARGS((void));
+extern int get_lisp_indent __ARGS((void));
+extern void prepare_to_exit __ARGS((void));
+extern void preserve_exit __ARGS((void));
+extern int vim_fexists __ARGS((char_u *fname));
+extern void line_breakcheck __ARGS((void));
+extern void fast_breakcheck __ARGS((void));
+extern int expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags));
+extern int match_suffix __ARGS((char_u *fname));
+extern int unix_expandpath __ARGS((garray_T *gap, char_u *path, int wildoff, int flags, int didstar));
+extern int gen_expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags));
+extern void addfile __ARGS((garray_T *gap, char_u *f, int flags));
+extern char_u *get_cmd_output __ARGS((char_u *cmd, char_u *infile, int flags));
+extern void FreeWild __ARGS((int count, char_u **files));
+extern int goto_im __ARGS((void));
 /* vim: set ft=c : */
diff --git a/src/proto/option.pro b/src/proto/option.pro
index bb50ef1..cf31dca 100644
--- a/src/proto/option.pro
+++ b/src/proto/option.pro
@@ -1,56 +1,56 @@
 /* option.c */
-void set_init_1 __ARGS((void));
-void set_string_default __ARGS((char *name, char_u *val));
-void set_number_default __ARGS((char *name, long val));
-void free_all_options __ARGS((void));
-void set_init_2 __ARGS((void));
-void set_init_3 __ARGS((void));
-void set_helplang_default __ARGS((char_u *lang));
-void init_gui_options __ARGS((void));
-void set_title_defaults __ARGS((void));
-int do_set __ARGS((char_u *arg, int opt_flags));
-void set_options_bin __ARGS((int oldval, int newval, int opt_flags));
-int get_viminfo_parameter __ARGS((int type));
-char_u *find_viminfo_parameter __ARGS((int type));
-void check_options __ARGS((void));
-void check_buf_options __ARGS((buf_T *buf));
-void free_string_option __ARGS((char_u *p));
-void clear_string_option __ARGS((char_u **pp));
-void set_term_option_alloced __ARGS((char_u **p));
-int was_set_insecurely __ARGS((char_u *opt, int opt_flags));
-void set_string_option_direct __ARGS((char_u *name, int opt_idx, char_u *val, int opt_flags, int set_sid));
-char_u *check_stl_option __ARGS((char_u *s));
-int get_option_value __ARGS((char_u *name, long *numval, char_u **stringval, int opt_flags));
-void set_option_value __ARGS((char_u *name, long number, char_u *string, int opt_flags));
-char_u *get_term_code __ARGS((char_u *tname));
-char_u *get_highlight_default __ARGS((void));
-char_u *get_encoding_default __ARGS((void));
-int makeset __ARGS((FILE *fd, int opt_flags, int local_only));
-int makefoldset __ARGS((FILE *fd));
-void clear_termoptions __ARGS((void));
-void free_termoptions __ARGS((void));
-void set_term_defaults __ARGS((void));
-void comp_col __ARGS((void));
-char_u *get_equalprg __ARGS((void));
-void win_copy_options __ARGS((win_T *wp_from, win_T *wp_to));
-void copy_winopt __ARGS((winopt_T *from, winopt_T *to));
-void check_win_options __ARGS((win_T *win));
-void check_winopt __ARGS((winopt_T *wop));
-void clear_winopt __ARGS((winopt_T *wop));
-void buf_copy_options __ARGS((buf_T *buf, int flags));
-void reset_modifiable __ARGS((void));
-void set_iminsert_global __ARGS((void));
-void set_imsearch_global __ARGS((void));
-void set_context_in_set_cmd __ARGS((expand_T *xp, char_u *arg, int opt_flags));
-int ExpandSettings __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
-int ExpandOldSetting __ARGS((int *num_file, char_u ***file));
-int has_format_option __ARGS((int x));
-int shortmess __ARGS((int x));
-void vimrc_found __ARGS((char_u *fname, char_u *envname));
-void change_compatible __ARGS((int on));
-int option_was_set __ARGS((char_u *name));
-int can_bs __ARGS((int what));
-void save_file_ff __ARGS((buf_T *buf));
-int file_ff_differs __ARGS((buf_T *buf));
-int check_ff_value __ARGS((char_u *p));
+extern void set_init_1 __ARGS((void));
+extern void set_string_default __ARGS((char *name, char_u *val));
+extern void set_number_default __ARGS((char *name, long val));
+extern void free_all_options __ARGS((void));
+extern void set_init_2 __ARGS((void));
+extern void set_init_3 __ARGS((void));
+extern void set_helplang_default __ARGS((char_u *lang));
+extern void init_gui_options __ARGS((void));
+extern void set_title_defaults __ARGS((void));
+extern int do_set __ARGS((char_u *arg, int opt_flags));
+extern void set_options_bin __ARGS((int oldval, int newval, int opt_flags));
+extern int get_viminfo_parameter __ARGS((int type));
+extern char_u *find_viminfo_parameter __ARGS((int type));
+extern void check_options __ARGS((void));
+extern void check_buf_options __ARGS((buf_T *buf));
+extern void free_string_option __ARGS((char_u *p));
+extern void clear_string_option __ARGS((char_u **pp));
+extern void set_term_option_alloced __ARGS((char_u **p));
+extern int was_set_insecurely __ARGS((char_u *opt, int opt_flags));
+extern void set_string_option_direct __ARGS((char_u *name, int opt_idx, char_u *val, int opt_flags, int set_sid));
+extern char_u *check_stl_option __ARGS((char_u *s));
+extern int get_option_value __ARGS((char_u *name, long *numval, char_u **stringval, int opt_flags));
+extern void set_option_value __ARGS((char_u *name, long number, char_u *string, int opt_flags));
+extern char_u *get_term_code __ARGS((char_u *tname));
+extern char_u *get_highlight_default __ARGS((void));
+extern char_u *get_encoding_default __ARGS((void));
+extern int makeset __ARGS((FILE *fd, int opt_flags, int local_only));
+extern int makefoldset __ARGS((FILE *fd));
+extern void clear_termoptions __ARGS((void));
+extern void free_termoptions __ARGS((void));
+extern void set_term_defaults __ARGS((void));
+extern void comp_col __ARGS((void));
+extern char_u *get_equalprg __ARGS((void));
+extern void win_copy_options __ARGS((win_T *wp_from, win_T *wp_to));
+extern void copy_winopt __ARGS((winopt_T *from, winopt_T *to));
+extern void check_win_options __ARGS((win_T *win));
+extern void check_winopt __ARGS((winopt_T *wop));
+extern void clear_winopt __ARGS((winopt_T *wop));
+extern void buf_copy_options __ARGS((buf_T *buf, int flags));
+extern void reset_modifiable __ARGS((void));
+extern void set_iminsert_global __ARGS((void));
+extern void set_imsearch_global __ARGS((void));
+extern void set_context_in_set_cmd __ARGS((expand_T *xp, char_u *arg, int opt_flags));
+extern int ExpandSettings __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
+extern int ExpandOldSetting __ARGS((int *num_file, char_u ***file));
+extern int has_format_option __ARGS((int x));
+extern int shortmess __ARGS((int x));
+extern void vimrc_found __ARGS((char_u *fname, char_u *envname));
+extern void change_compatible __ARGS((int on));
+extern int option_was_set __ARGS((char_u *name));
+extern int can_bs __ARGS((int what));
+extern void save_file_ff __ARGS((buf_T *buf));
+extern int file_ff_differs __ARGS((buf_T *buf));
+extern int check_ff_value __ARGS((char_u *p));
 /* vim: set ft=c : */
diff --git a/src/proto/syntax.pro b/src/proto/syntax.pro
index c33a890..ad442e6 100644
--- a/src/proto/syntax.pro
+++ b/src/proto/syntax.pro
@@ -1,47 +1,47 @@
 /* syntax.c */
-void syntax_start __ARGS((win_T *wp, linenr_T lnum));
-void syn_stack_free_all __ARGS((buf_T *buf));
-void syn_stack_apply_changes __ARGS((buf_T *buf));
-void syntax_end_parsing __ARGS((linenr_T lnum));
-int syntax_check_changed __ARGS((linenr_T lnum));
-int get_syntax_attr __ARGS((colnr_T col, int *can_spell));
-void syntax_clear __ARGS((buf_T *buf));
-void ex_syntax __ARGS((exarg_T *eap));
-int syntax_present __ARGS((buf_T *buf));
-void set_context_in_syntax_cmd __ARGS((expand_T *xp, char_u *arg));
-char_u *get_syntax_name __ARGS((expand_T *xp, int idx));
-int syn_get_id __ARGS((win_T *wp, long lnum, colnr_T col, int trans, int *spellp));
-int syn_get_foldlevel __ARGS((win_T *wp, long lnum));
-void init_highlight __ARGS((int both, int reset));
-int load_colors __ARGS((char_u *name));
-void do_highlight __ARGS((char_u *line, int forceit, int init));
-void free_highlight __ARGS((void));
-void restore_cterm_colors __ARGS((void));
-void set_normal_colors __ARGS((void));
-char_u *hl_get_font_name __ARGS((void));
-void hl_set_font_name __ARGS((char_u *font_name));
-void hl_set_bg_color_name __ARGS((char_u *name));
-void hl_set_fg_color_name __ARGS((char_u *name));
-void clear_hl_tables __ARGS((void));
-int hl_combine_attr __ARGS((int char_attr, int prim_attr));
-attrentry_T *syn_gui_attr2entry __ARGS((int attr));
-int syn_attr2attr __ARGS((int attr));
-attrentry_T *syn_term_attr2entry __ARGS((int attr));
-attrentry_T *syn_cterm_attr2entry __ARGS((int attr));
-char_u *highlight_has_attr __ARGS((int id, int flag, int modec));
-char_u *highlight_color __ARGS((int id, char_u *what, int modec));
-long_u highlight_gui_color_rgb __ARGS((int id, int fg));
-int syn_name2id __ARGS((char_u *name));
-int highlight_exists __ARGS((char_u *name));
-char_u *syn_id2name __ARGS((int id));
-int syn_namen2id __ARGS((char_u *linep, int len));
-int syn_check_group __ARGS((char_u *pp, int len));
-int syn_id2attr __ARGS((int hl_id));
-int syn_id2colors __ARGS((int hl_id, guicolor_T *fgp, guicolor_T *bgp));
-int syn_get_final_id __ARGS((int hl_id));
-void highlight_gui_started __ARGS((void));
-int highlight_changed __ARGS((void));
-void set_context_in_highlight_cmd __ARGS((expand_T *xp, char_u *arg));
-char_u *get_highlight_name __ARGS((expand_T *xp, int idx));
-void free_highlight_fonts __ARGS((void));
+extern void syntax_start __ARGS((win_T *wp, linenr_T lnum));
+extern void syn_stack_free_all __ARGS((buf_T *buf));
+extern void syn_stack_apply_changes __ARGS((buf_T *buf));
+extern void syntax_end_parsing __ARGS((linenr_T lnum));
+extern int syntax_check_changed __ARGS((linenr_T lnum));
+extern int get_syntax_attr __ARGS((colnr_T col, int *can_spell));
+extern void syntax_clear __ARGS((buf_T *buf));
+extern void ex_syntax __ARGS((exarg_T *eap));
+extern int syntax_present __ARGS((buf_T *buf));
+extern void set_context_in_syntax_cmd __ARGS((expand_T *xp, char_u *arg));
+extern char_u *get_syntax_name __ARGS((expand_T *xp, int idx));
+extern int syn_get_id __ARGS((win_T *wp, long lnum, colnr_T col, int trans, int *spellp));
+extern int syn_get_foldlevel __ARGS((win_T *wp, long lnum));
+extern void init_highlight __ARGS((int both, int reset));
+extern int load_colors __ARGS((char_u *name));
+extern void do_highlight __ARGS((char_u *line, int forceit, int init));
+extern void free_highlight __ARGS((void));
+extern void restore_cterm_colors __ARGS((void));
+extern void set_normal_colors __ARGS((void));
+extern char_u *hl_get_font_name __ARGS((void));
+extern void hl_set_font_name __ARGS((char_u *font_name));
+extern void hl_set_bg_color_name __ARGS((char_u *name));
+extern void hl_set_fg_color_name __ARGS((char_u *name));
+extern void clear_hl_tables __ARGS((void));
+extern int hl_combine_attr __ARGS((int char_attr, int prim_attr));
+extern attrentry_T *syn_gui_attr2entry __ARGS((int attr));
+extern int syn_attr2attr __ARGS((int attr));
+extern attrentry_T *syn_term_attr2entry __ARGS((int attr));
+extern attrentry_T *syn_cterm_attr2entry __ARGS((int attr));
+extern char_u *highlight_has_attr __ARGS((int id, int flag, int modec));
+extern char_u *highlight_color __ARGS((int id, char_u *what, int modec));
+extern long_u highlight_gui_color_rgb __ARGS((int id, int fg));
+extern int syn_name2id __ARGS((char_u *name));
+extern int highlight_exists __ARGS((char_u *name));
+extern char_u *syn_id2name __ARGS((int id));
+extern int syn_namen2id __ARGS((char_u *linep, int len));
+extern int syn_check_group __ARGS((char_u *pp, int len));
+extern int syn_id2attr __ARGS((int hl_id));
+extern int syn_id2colors __ARGS((int hl_id, guicolor_T *fgp, guicolor_T *bgp));
+extern int syn_get_final_id __ARGS((int hl_id));
+extern void highlight_gui_started __ARGS((void));
+extern int highlight_changed __ARGS((void));
+extern void set_context_in_highlight_cmd __ARGS((expand_T *xp, char_u *arg));
+extern char_u *get_highlight_name __ARGS((expand_T *xp, int idx));
+extern void free_highlight_fonts __ARGS((void));
 /* vim: set ft=c : */
diff --git a/src/proto/undo.pro b/src/proto/undo.pro
index ab70735..c48e65c 100644
--- a/src/proto/undo.pro
+++ b/src/proto/undo.pro
@@ -7,7 +7,7 @@
 extern void u_undo __ARGS((int count));
 extern void u_redo __ARGS((int count));
 extern void undo_time __ARGS((long step, int sec, int absolute));
-extern void u_sync __ARGS((void));
+extern void u_sync __ARGS((int force));
 extern void ex_undolist __ARGS((exarg_T *eap));
 extern void ex_undojoin __ARGS((exarg_T *eap));
 extern void u_unchanged __ARGS((buf_T *buf));
diff --git a/src/proto/window.pro b/src/proto/window.pro
index f0ca77b..5c00fbb 100644
--- a/src/proto/window.pro
+++ b/src/proto/window.pro
@@ -1,59 +1,61 @@
 /* window.c */
-void do_window __ARGS((int nchar, long Prenum, int xchar));
-int win_split __ARGS((int size, int flags));
-int win_valid __ARGS((win_T *win));
-int win_count __ARGS((void));
-int make_windows __ARGS((int count, int vertical));
-void win_move_after __ARGS((win_T *win1, win_T *win2));
-void win_equal __ARGS((win_T *next_curwin, int current, int dir));
-void close_windows __ARGS((buf_T *buf, int keep_curwin));
-void win_close __ARGS((win_T *win, int free_buf));
-void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
-void win_free_all __ARGS((void));
-void close_others __ARGS((int message, int forceit));
-void curwin_init __ARGS((void));
-int win_alloc_first __ARGS((void));
-void win_init_size __ARGS((void));
-int win_new_tabpage __ARGS((int after));
-int may_open_tabpage __ARGS((void));
-int make_tabpages __ARGS((int maxcount));
-int valid_tabpage __ARGS((tabpage_T *tpc));
-tabpage_T *find_tabpage __ARGS((int n));
-int tabpage_index __ARGS((tabpage_T *ftp));
-void goto_tabpage __ARGS((int n));
-void goto_tabpage_tp __ARGS((tabpage_T *tp));
-void tabpage_move __ARGS((int nr));
-void win_goto __ARGS((win_T *wp));
-win_T *win_find_nr __ARGS((int winnr));
-void win_enter __ARGS((win_T *wp, int undo_sync));
-win_T *buf_jump_open_win __ARGS((buf_T *buf));
-int win_alloc_lines __ARGS((win_T *wp));
-void win_free_lsize __ARGS((win_T *wp));
-void shell_new_rows __ARGS((void));
-void shell_new_columns __ARGS((void));
-void win_size_save __ARGS((garray_T *gap));
-void win_size_restore __ARGS((garray_T *gap));
-int win_comp_pos __ARGS((void));
-void win_setheight __ARGS((int height));
-void win_setheight_win __ARGS((int height, win_T *win));
-void win_setwidth __ARGS((int width));
-void win_setwidth_win __ARGS((int width, win_T *wp));
-void win_setminheight __ARGS((void));
-void win_drag_status_line __ARGS((win_T *dragwin, int offset));
-void win_drag_vsep_line __ARGS((win_T *dragwin, int offset));
-void win_comp_scroll __ARGS((win_T *wp));
-void command_height __ARGS((void));
-void last_status __ARGS((int morewin));
-int tabline_height __ARGS((void));
-char_u *grab_file_name __ARGS((long count, linenr_T *file_lnum));
-char_u *file_name_at_cursor __ARGS((int options, long count, linenr_T *file_lnum));
-char_u *file_name_in_line __ARGS((char_u *line, int col, int options, long count, char_u *rel_fname, linenr_T *file_lnum));
-char_u *find_file_name_in_path __ARGS((char_u *ptr, int len, int options, long count, char_u *rel_fname));
-int path_with_url __ARGS((char_u *fname));
-int vim_isAbsName __ARGS((char_u *name));
-int vim_FullName __ARGS((char_u *fname, char_u *buf, int len, int force));
-int min_rows __ARGS((void));
-int only_one_window __ARGS((void));
-void check_lnums __ARGS((int do_curwin));
-int win_hasvertsplit __ARGS((void));
+extern void do_window __ARGS((int nchar, long Prenum, int xchar));
+extern int win_split __ARGS((int size, int flags));
+extern int win_valid __ARGS((win_T *win));
+extern int win_count __ARGS((void));
+extern int make_windows __ARGS((int count, int vertical));
+extern void win_move_after __ARGS((win_T *win1, win_T *win2));
+extern void win_equal __ARGS((win_T *next_curwin, int current, int dir));
+extern void close_windows __ARGS((buf_T *buf, int keep_curwin));
+extern void win_close __ARGS((win_T *win, int free_buf));
+extern void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
+extern void win_free_all __ARGS((void));
+extern void close_others __ARGS((int message, int forceit));
+extern void curwin_init __ARGS((void));
+extern int win_alloc_first __ARGS((void));
+extern void win_init_size __ARGS((void));
+extern int win_new_tabpage __ARGS((int after));
+extern int may_open_tabpage __ARGS((void));
+extern int make_tabpages __ARGS((int maxcount));
+extern int valid_tabpage __ARGS((tabpage_T *tpc));
+extern tabpage_T *find_tabpage __ARGS((int n));
+extern int tabpage_index __ARGS((tabpage_T *ftp));
+extern void goto_tabpage __ARGS((int n));
+extern void goto_tabpage_tp __ARGS((tabpage_T *tp));
+extern void goto_tabpage_win __ARGS((tabpage_T *tp, win_T *wp));
+extern void tabpage_move __ARGS((int nr));
+extern void win_goto __ARGS((win_T *wp));
+extern win_T *win_find_nr __ARGS((int winnr));
+extern void win_enter __ARGS((win_T *wp, int undo_sync));
+extern win_T *buf_jump_open_win __ARGS((buf_T *buf));
+extern win_T *buf_jump_open_tab __ARGS((buf_T *buf));
+extern int win_alloc_lines __ARGS((win_T *wp));
+extern void win_free_lsize __ARGS((win_T *wp));
+extern void shell_new_rows __ARGS((void));
+extern void shell_new_columns __ARGS((void));
+extern void win_size_save __ARGS((garray_T *gap));
+extern void win_size_restore __ARGS((garray_T *gap));
+extern int win_comp_pos __ARGS((void));
+extern void win_setheight __ARGS((int height));
+extern void win_setheight_win __ARGS((int height, win_T *win));
+extern void win_setwidth __ARGS((int width));
+extern void win_setwidth_win __ARGS((int width, win_T *wp));
+extern void win_setminheight __ARGS((void));
+extern void win_drag_status_line __ARGS((win_T *dragwin, int offset));
+extern void win_drag_vsep_line __ARGS((win_T *dragwin, int offset));
+extern void win_comp_scroll __ARGS((win_T *wp));
+extern void command_height __ARGS((void));
+extern void last_status __ARGS((int morewin));
+extern int tabline_height __ARGS((void));
+extern char_u *grab_file_name __ARGS((long count, linenr_T *file_lnum));
+extern char_u *file_name_at_cursor __ARGS((int options, long count, linenr_T *file_lnum));
+extern char_u *file_name_in_line __ARGS((char_u *line, int col, int options, long count, char_u *rel_fname, linenr_T *file_lnum));
+extern char_u *find_file_name_in_path __ARGS((char_u *ptr, int len, int options, long count, char_u *rel_fname));
+extern int path_with_url __ARGS((char_u *fname));
+extern int vim_isAbsName __ARGS((char_u *name));
+extern int vim_FullName __ARGS((char_u *fname, char_u *buf, int len, int force));
+extern int min_rows __ARGS((void));
+extern int only_one_window __ARGS((void));
+extern void check_lnums __ARGS((int do_curwin));
+extern int win_hasvertsplit __ARGS((void));
 /* vim: set ft=c : */
diff --git a/src/spell.c b/src/spell.c
index fba3857..787a2c1 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -5959,7 +5959,7 @@
 {
     char_u	*p;
     char_u	*prevp;
-    int		flag;
+    unsigned	flag;
 
     if (entry->ae_flags != NULL
 		&& (affile->af_compforbid != 0 || affile->af_comppermit != 0))
@@ -6474,6 +6474,7 @@
 	if (spin->si_ascii && has_non_ascii(w))
 	{
 	    ++non_ascii;
+	    vim_free(pc);
 	    continue;
 	}
 
@@ -6495,10 +6496,11 @@
 	/* Store the word in the hashtable to be able to find duplicates. */
 	dw = (char_u *)getroom_save(spin, w);
 	if (dw == NULL)
+	{
 	    retval = FAIL;
-	vim_free(pc);
-	if (retval == FAIL)
+	    vim_free(pc);
 	    break;
+	}
 
 	hash = hash_hash(dw);
 	hi = hash_lookup(&ht, dw, hash);
@@ -6558,6 +6560,8 @@
 			    CONDIT_SUF, flags, store_afflist, pfxlen) == FAIL)
 		retval = FAIL;
 	}
+
+	vim_free(pc);
     }
 
     if (duplicate > 0)
diff --git a/src/undo.c b/src/undo.c
index efbd4cc..a2861d5 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -551,7 +551,7 @@
      */
     if (curbuf->b_u_synced == FALSE)
     {
-	u_sync();
+	u_sync(TRUE);
 	count = 1;
     }
 
@@ -673,7 +673,7 @@
 
     /* First make sure the current undoable change is synced. */
     if (curbuf->b_u_synced == FALSE)
-	u_sync();
+	u_sync(TRUE);
 
     u_newcount = 0;
     u_oldcount = 0;
@@ -1255,10 +1255,12 @@
  * u_sync: stop adding to the current entry list
  */
     void
-u_sync()
+u_sync(force)
+    int	    force;	/* Also sync when no_u_sync is set. */
 {
-    if (curbuf->b_u_synced)
-	return;		    /* already synced */
+    /* Skip it when already synced or syncing is disabled. */
+    if (curbuf->b_u_synced || (!force && no_u_sync > 0))
+	return;
 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
     if (im_is_preediting())
 	return;		    /* XIM is busy, don't break an undo sequence */
diff --git a/src/version.h b/src/version.h
index a5c7e88..9358164 100644
--- a/src/version.h
+++ b/src/version.h
@@ -19,9 +19,9 @@
 #define VIM_VERSION_MINOR_STR		"0"
 #define VIM_VERSION_100	    (VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR)
 
-#define VIM_VERSION_BUILD		 259
-#define VIM_VERSION_BUILD_BCD		0x103
-#define VIM_VERSION_BUILD_STR		"259"
+#define VIM_VERSION_BUILD		 260
+#define VIM_VERSION_BUILD_BCD		0x104
+#define VIM_VERSION_BUILD_STR		"260"
 #define VIM_VERSION_PATCHLEVEL		 0
 #define VIM_VERSION_PATCHLEVEL_STR	"0"
 /* Used by MacOS port should be one of: development, alpha, beta, final */
@@ -33,8 +33,8 @@
  * VIM_VERSION_MEDIUM is used for the startup-screen.
  * VIM_VERSION_LONG is used for the ":version" command and "Vim -h".
  */
-#define VIM_VERSION_NODOT	"vim70c"
-#define VIM_VERSION_SHORT	"7.0c"
-#define VIM_VERSION_MEDIUM	"7.0c13 BETA"
-#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0c13 BETA (2006 Apr 8)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0c13 BETA (2006 Apr 8, compiled "
+#define VIM_VERSION_NODOT	"vim70d"
+#define VIM_VERSION_SHORT	"7.0d"
+#define VIM_VERSION_MEDIUM	"7.0d BETA"
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0d BETA (2006 Apr 10)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0d BETA (2006 Apr 10, compiled "
diff --git a/src/window.c b/src/window.c
index 5e9553b..b401fc1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3527,6 +3527,26 @@
 }
 
 /*
+ * Enter window "wp" in tab page "tp".
+ * Also updates the GUI tab.
+ */
+    void
+goto_tabpage_win(tp, wp)
+    tabpage_T	*tp;
+    win_T	*wp;
+{
+    goto_tabpage_tp(tp);
+    if (curtab == tp && win_valid(wp))
+    {
+	win_enter(wp, TRUE);
+# ifdef FEAT_GUI_TABLINE
+	if (gui_use_tabline())
+	    gui_mch_set_curtab(tabpage_index(curtab));
+# endif
+    }
+}
+
+/*
  * Move the current tab page to before tab page "nr".
  */
     void
@@ -3810,7 +3830,7 @@
 
     /* sync undo before leaving the current buffer */
     if (undo_sync && curbuf != wp->w_buffer)
-	u_sync();
+	u_sync(FALSE);
     /* may have to copy the buffer options when 'cpo' contains 'S' */
     if (wp->w_buffer != curbuf)
 	buf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP);
@@ -3896,9 +3916,8 @@
 
 #if defined(FEAT_WINDOWS) || defined(FEAT_SIGNS) || defined(PROTO)
 /*
- * Jump to the first open window that contains buffer buf if one exists
- * TODO: Alternatively jump to last open window? Dependent from 'splitbelow'?
- * Returns pointer to window if it exists, otherwise NULL.
+ * Jump to the first open window that contains buffer "buf", if one exists.
+ * Returns a pointer to the window found, otherwise NULL.
  */
     win_T *
 buf_jump_open_win(buf)
@@ -3907,7 +3926,7 @@
 # ifdef FEAT_WINDOWS
     win_T	*wp;
 
-    for (wp = firstwin; wp; wp = wp->w_next)
+    for (wp = firstwin; wp != NULL; wp = wp->w_next)
 	if (wp->w_buffer == buf)
 	    break;
     if (wp != NULL)
@@ -3919,6 +3938,47 @@
     return NULL;
 # endif
 }
+
+/*
+ * Jump to the first open window in any tab page that contains buffer "buf",
+ * if one exists.
+ * Returns a pointer to the window found, otherwise NULL.
+ */
+    win_T *
+buf_jump_open_tab(buf)
+    buf_T	*buf;
+{
+# ifdef FEAT_WINDOWS
+    win_T	*wp;
+    tabpage_T	*tp;
+
+    /* First try the current tab page. */
+    wp = buf_jump_open_win(buf);
+    if (wp != NULL)
+	return wp;
+
+    for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+	if (tp != curtab)
+	{
+	    for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)
+		if (wp->w_buffer == buf)
+		    break;
+	    if (wp != NULL)
+	    {
+		goto_tabpage_win(tp, wp);
+		if (curwin != wp)
+		    wp = NULL;	/* something went wrong */
+		break;
+	    }
+	}
+
+    return wp;
+# else
+    if (curwin->w_buffer == buf)
+	return curwin;
+    return NULL;
+# endif
+}
 #endif
 
 /*