*** src/eval.c.orig	2013-05-05 16:53:45.000000000 -0700
--- src/eval.c	2013-05-13 13:14:33.000000000 -0700
*************** static void f_atan2 __ARGS((typval_T *ar
*** 478,483 ****
--- 478,484 ----
  #endif
  static void f_browse __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_browsedir __ARGS((typval_T *argvars, typval_T *rettv));
+ static void f_bufferlist __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_bufexists __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_buflisted __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_bufloaded __ARGS((typval_T *argvars, typval_T *rettv));
*************** static void f_synIDtrans __ARGS((typval_
*** 728,733 ****
--- 729,735 ----
  static void f_synstack __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_synconcealed __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_system __ARGS((typval_T *argvars, typval_T *rettv));
+ static void f_tabpagelist __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_tabpagebuflist __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_tabpagenr __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_tabpagewinnr __ARGS((typval_T *argvars, typval_T *rettv));
*************** static void f_winbufnr __ARGS((typval_T 
*** 756,761 ****
--- 758,764 ----
  static void f_wincol __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_winheight __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_winline __ARGS((typval_T *argvars, typval_T *rettv));
+ static void f_winlist __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_winnr __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_winrestcmd __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_winrestview __ARGS((typval_T *argvars, typval_T *rettv));
*************** static struct fst
*** 7860,7865 ****
--- 7863,7869 ----
      {"buffer_exists",	1, 1, f_bufexists},	/* obsolete */
      {"buffer_name",	1, 1, f_bufname},	/* obsolete */
      {"buffer_number",	1, 1, f_bufnr},		/* obsolete */
+     {"bufferlist",	0, 0, f_bufferlist},
      {"buflisted",	1, 1, f_buflisted},
      {"bufloaded",	1, 1, f_bufloaded},
      {"bufname",		1, 1, f_bufname},
*************** static struct fst
*** 8114,8119 ****
--- 8118,8124 ----
      {"synstack",	2, 2, f_synstack},
      {"system",		1, 2, f_system},
      {"tabpagebuflist",	0, 1, f_tabpagebuflist},
+     {"tabpagelist",	0, 0, f_tabpagelist},
      {"tabpagenr",	0, 1, f_tabpagenr},
      {"tabpagewinnr",	1, 2, f_tabpagewinnr},
      {"tagfiles",	0, 0, f_tagfiles},
*************** static struct fst
*** 8141,8146 ****
--- 8146,8152 ----
      {"wincol",		0, 0, f_wincol},
      {"winheight",	1, 1, f_winheight},
      {"winline",		0, 0, f_winline},
+     {"winlist",		0, 1, f_winlist},
      {"winnr",		0, 1, f_winnr},
      {"winrestcmd",	0, 0, f_winrestcmd},
      {"winrestview",	1, 1, f_winrestview},
*************** find_buffer(avar)
*** 8985,8990 ****
--- 8991,9033 ----
  }
  
  /*
+  * "bufferlist()" function
+  */
+     static void
+ f_bufferlist(argvars, rettv)
+     typval_T	*argvars UNUSED;
+     typval_T	*rettv;
+ {
+     buf_T	*buf = NULL;
+     dict_T	*dict;
+ 
+     rettv->vval.v_number = FALSE;
+ 
+     if (rettv_list_alloc(rettv) == OK)
+     {
+ 	for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ 	{
+ 	    dict = dict_alloc();
+ 	    if (dict == NULL)
+ 		return;
+ 
+ 	    dict_add_nr_str(dict, "num", buf->b_fnum, NULL);
+ 	    dict_add_nr_str(dict, "name", 0L, buf->b_ffname);
+ 	    dict_add_nr_str(dict, "lnum", buflist_findlnum(buf), NULL);
+ 	    dict_add_nr_str(dict, "listed", buf->b_p_bl, NULL);
+ 	    dict_add_nr_str(dict, "loaded", buf->b_ml.ml_mfp != NULL, NULL);
+ 	    dict_add_nr_str(dict, "changed", bufIsChanged(buf), NULL);
+ 	    dict_add_nr_str(dict, "changedtick", buf->b_changedtick, NULL);
+ 	    dict_add_nr_str(dict, "hidden",
+ 			    buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0,
+ 			    NULL);
+ 
+ 	    list_append_dict(rettv->vval.v_list, dict);
+ 	}
+     }
+ }
+ 
+ /*
   * "bufexists(expr)" function
   */
      static void
*************** f_settabvar(argvars, rettv)
*** 16604,16609 ****
--- 16647,16653 ----
  
      rettv->vval.v_number = 0;
  
+ #ifdef FEAT_WINDOWS
      if (check_restricted() || check_secure())
  	return;
  
*************** f_settabvar(argvars, rettv)
*** 16629,16634 ****
--- 16673,16679 ----
  	if (valid_tabpage(save_curtab))
  	    goto_tabpage_tp(save_curtab, TRUE);
      }
+ #endif
  }
  
  /*
*************** done:
*** 17971,17976 ****
--- 18016,18063 ----
  }
  
  /*
+  * "tabpagelist()" function
+  */
+     static void
+ f_tabpagelist(argvars, rettv)
+     typval_T	*argvars UNUSED;
+     typval_T	*rettv;
+ {
+     rettv->vval.v_number = FALSE;
+ 
+     if (rettv_list_alloc(rettv) == OK)
+     {
+ #ifdef FEAT_WINDOWS
+ 	tabpage_T   *tp;
+ 	win_T	    *wp;
+ 	dict_T	    *dict;
+ 	int	    i = 1;
+ 	int	    nr;
+ 
+ 	for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+ 	{
+ 	    dict = dict_alloc();
+ 	    if (dict == NULL)
+ 		continue;
+ 
+ 	    dict_add_nr_str(dict, "num", i, NULL);
+ 
+ 	    /* Count the number of windows in this tab page */
+ 	    nr = 1;
+ 	    for (wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
+ 		 wp != ((tp == curtab) ? lastwin : tp->tp_lastwin);
+ 		 wp = wp->w_next)
+ 		nr++;
+ 	    dict_add_nr_str(dict, "numwindows", nr, NULL);
+ 
+ 	    list_append_dict(rettv->vval.v_list, dict);
+ 	    i++;
+ 	}
+ #endif
+     }
+ }
+ 
+ /*
   * "tabpagebuflist()" function
   */
      static void
*************** f_winline(argvars, rettv)
*** 18669,18674 ****
--- 18756,18811 ----
  }
  
  /*
+  * "winlist()" function
+  */
+     static void
+ f_winlist(argvars, rettv)
+     typval_T	*argvars UNUSED;
+     typval_T	*rettv;
+ {
+     rettv->vval.v_number = FALSE;
+ 
+     if (rettv_list_alloc(rettv) == OK)
+     {
+ #ifdef FEAT_WINDOWS
+ 	tabpage_T   *tp;
+         win_T	    *wp = NULL;
+ 	dict_T	    *dict;
+ 	short	    i = 1;
+ 
+ 	/* Use the specified tab page. Default is current tab page */
+ 	if (argvars[0].v_type == VAR_UNKNOWN)
+ 	    wp = firstwin;
+ 	else
+ 	{
+ 	    tp = find_tabpage((int)get_tv_number(&argvars[0]));
+ 	    if (tp != NULL)
+ 		wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
+ 	}
+ 
+         for (; wp; wp = wp->w_next)
+ 	{
+ 	    dict = dict_alloc();
+ 	    if (dict == NULL)
+ 		continue;
+ 
+ 	    /*
+ 	     * TODO:
+ 	     * Add window variables for each window
+ 	     */
+ 	    dict_add_nr_str(dict, "num", i, NULL);
+ 	    dict_add_nr_str(dict, "height", wp->w_height, NULL);
+ 	    dict_add_nr_str(dict, "width", wp->w_width, NULL);
+ 	    dict_add_nr_str(dict, "bufnum", wp->w_buffer->b_fnum, NULL);
+ 
+ 	    list_append_dict(rettv->vval.v_list, dict);
+ 	    i++;
+ 	}
+ #endif
+     }
+ }
+ 
+ /*
   * "winnr()" function
   */
      static void
*** runtime/doc/eval.txt.orig	2013-05-05 18:05:08.000000000 -0700
--- runtime/doc/eval.txt	2013-05-17 17:43:28.000000000 -0700
*************** atan2( {expr}, {expr})		Float   arc tang
*** 1693,1698 ****
--- 1693,1699 ----
  browse( {save}, {title}, {initdir}, {default})
  				String	put up a file requester
  browsedir( {title}, {initdir})	String	put up a directory requester
+ bufferlist()			List	list of buffers
  bufexists( {expr})		Number	TRUE if buffer {expr} exists
  buflisted( {expr})		Number	TRUE if buffer {expr} is listed
  bufloaded( {expr})		Number	TRUE if buffer {expr} is loaded
*************** synIDattr( {synID}, {what} [, {mode}])
*** 1964,1969 ****
--- 1965,1971 ----
  synIDtrans( {synID})		Number	translated syntax ID of {synID}
  synstack( {lnum}, {col})	List	stack of syntax IDs at {lnum} and {col}
  system( {expr} [, {input}])	String	output of shell command/filter {expr}
+ tabpagelist()			List	list of tab pages
  tabpagebuflist( [{arg}])	List	list of buffer numbers in tab page
  tabpagenr( [{arg}])		Number	number of current or last tab page
  tabpagewinnr( {tabarg}[, {arg}])
*************** winbufnr( {nr})			Number	buffer number o
*** 1989,1994 ****
--- 1991,1997 ----
  wincol()			Number	window column of the cursor
  winheight( {nr})		Number	height of window {nr}
  winline()			Number	window line of the cursor
+ winlist( [{arg}])		List	list of windows in tab page
  winnr( [{expr}])		Number	number of current window
  winrestcmd()			String	returns command to restore window sizes
  winrestview( {dict})		none	restore view of current window
*************** browsedir({title}, {initdir})
*** 2137,2142 ****
--- 2140,2157 ----
  		When the "Cancel" button is hit, something went wrong, or
  		browsing is not possible, an empty string is returned.
  
+ bufferlist()						*bufferlist()*
+ 		Returns a List of buffers. Each list item is a dictionary with
+ 		the following entries:
+ 			num		buffer number.
+ 			name		full path to the file in the buffer.
+ 			lnum		current line number in buffer.
+ 			listed		TRUE if the buffer is listed.
+ 			loaded		TRUE if the buffer is loaded.
+ 			hidden		TRUE if the buffer is hidden.
+ 			changed		TRUE if the buffer is modified.
+ 			changedtick	number of changes made to the buffer.
+ 
  bufexists({expr})					*bufexists()*
  		The result is a Number, which is non-zero if a buffer called
  		{expr} exists.
*************** system({expr} [, {input}])				*system()*
*** 5846,5851 ****
--- 5861,5872 ----
  		Use |:checktime| to force a check.
  
  
+ tabpagelist()						*tabpagelist()*
+ 		Returns a List of tab pages. Each list item is a dictionary
+ 		with the following entries:
+ 			num		tab page number.
+ 			numwindows	number of windows in the tab page.
+ 
  tabpagebuflist([{arg}])					*tabpagebuflist()*
  		The result is a |List|, where each item is the number of the
  		buffer associated with each window in the current tab page.
*************** winheight({nr})						*winheight()*
*** 6159,6164 ****
--- 6180,6195 ----
  		Examples: >
    :echo "The current window has " . winheight(0) . " lines."
  <
+ winlist([{arg}])					*winlist()*
+ 		Returns a List of windows in a tab page.  {arg} specifies the
+ 		number of tab page to be used.  When omitted the current tab
+ 		page is used.  Each list item is a dictionary with the
+ 		following entries:
+ 			num		window number.
+ 			height		window height.
+ 			width		window width.
+ 			bufnum		number of buffer in the window.
+ 
  							*winline()*
  winline()	The result is a Number, which is the screen line of the cursor
  		in the window.	This is counting screen lines from the top of
