Karsten Hopp 5ddb51
To: vim_dev@googlegroups.com
Karsten Hopp 5ddb51
Subject: Patch 7.3.924
Karsten Hopp 5ddb51
Fcc: outbox
Karsten Hopp 5ddb51
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 5ddb51
Mime-Version: 1.0
Karsten Hopp 5ddb51
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 5ddb51
Content-Transfer-Encoding: 8bit
Karsten Hopp 5ddb51
------------
Karsten Hopp 5ddb51
Karsten Hopp 5ddb51
Patch 7.3.924
Karsten Hopp 5ddb51
Problem:    Python interface can't easily access options.
Karsten Hopp 5ddb51
Solution:   Add vim.options, vim.window.options and vim.buffer.options. (ZyX)
Karsten Hopp 5ddb51
Files:	    runtime/doc/if_pyth.txt, src/eval.c, src/if_py_both.h,
Karsten Hopp 5ddb51
	    src/if_python.c, src/if_python3.c, src/option.c,
Karsten Hopp 5ddb51
	    src/proto/eval.pro, src/proto/option.pro, src/testdir/test86.in,
Karsten Hopp 5ddb51
	    src/testdir/test86.ok, src/testdir/test87.in,
Karsten Hopp 5ddb51
	    src/testdir/test87.ok, src/vim.h
Karsten Hopp 5ddb51
Karsten Hopp 5ddb51
Karsten Hopp 5ddb51
*** ../vim-7.3.923/runtime/doc/if_pyth.txt	2013-04-24 14:06:42.000000000 +0200
Karsten Hopp 5ddb51
--- runtime/doc/if_pyth.txt	2013-05-06 03:39:13.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 243,248 ****
Karsten Hopp 5ddb51
--- 243,260 ----
Karsten Hopp 5ddb51
  	vim (|v:|) variables respectively. Identical to `vim.bindeval("g:")`, 
Karsten Hopp 5ddb51
  	but faster.
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
+ vim.options						*python-options*
Karsten Hopp 5ddb51
+ 	Object partly supporting mapping protocol (supports setting and 
Karsten Hopp 5ddb51
+ 	getting items) providing a read-write access to global options.
Karsten Hopp 5ddb51
+ 	Note: unlike |:set| this provides access only to global options. You
Karsten Hopp 5ddb51
+ 	cannot use this object to obtain or set local options' values or
Karsten Hopp 5ddb51
+ 	access local-only options in any fashion. Raises KeyError if no global
Karsten Hopp 5ddb51
+ 	option with such name exists (i.e. does not raise KeyError for
Karsten Hopp 5ddb51
+ 	|global-local| options and global only options, but does for window-
Karsten Hopp 5ddb51
+ 	and buffer-local ones).  Use |python-buffer| objects to access to
Karsten Hopp 5ddb51
+ 	buffer-local options and |python-window| objects to access to
Karsten Hopp 5ddb51
+ 	window-local options.
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
  Output from Python					*python-output*
Karsten Hopp 5ddb51
  	Vim displays all Python code output in the Vim message area.  Normal
Karsten Hopp 5ddb51
  	output appears as information messages, and error output appears as
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 283,288 ****
Karsten Hopp 5ddb51
--- 295,311 ----
Karsten Hopp 5ddb51
  line numbers, which start from 1.  This is particularly relevant when dealing
Karsten Hopp 5ddb51
  with marks (see below) which use vim line numbers.
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
+ The buffer object attributes are:
Karsten Hopp 5ddb51
+ 	b.vars		Dictionary-like object used to access 
Karsten Hopp 5ddb51
+ 			|buffer-variable|s.
Karsten Hopp 5ddb51
+ 	b.options	Mapping object (supports item getting, setting and 
Karsten Hopp 5ddb51
+ 			deleting) that provides access to buffer-local options 
Karsten Hopp 5ddb51
+ 			and buffer-local values of |global-local| options. Use 
Karsten Hopp 5ddb51
+ 			|python-window|.options if option is window-local, 
Karsten Hopp 5ddb51
+ 			this object will raise KeyError. If option is 
Karsten Hopp 5ddb51
+ 			|global-local| and local value is missing getting it 
Karsten Hopp 5ddb51
+ 			will return None.
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
  The buffer object methods are:
Karsten Hopp 5ddb51
  	b.append(str)	Append a line to the buffer
Karsten Hopp 5ddb51
  	b.append(str, nr)  Idem, below line "nr"
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 313,318 ****
Karsten Hopp 5ddb51
--- 336,343 ----
Karsten Hopp 5ddb51
  	:py (row,col) = b.mark('a')	# named mark
Karsten Hopp 5ddb51
  	:py r = b.range(1,5)		# a sub-range of the buffer
Karsten Hopp 5ddb51
  	:py b.vars["foo"] = "bar"	# assign b:foo variable
Karsten Hopp 5ddb51
+ 	:py b.options["ff"] = "dos"	# set fileformat
Karsten Hopp 5ddb51
+ 	:py del b.options["ar"]		# same as :set autoread<
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
  ==============================================================================
Karsten Hopp 5ddb51
  4. Range objects					*python-range*
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 363,368 ****
Karsten Hopp 5ddb51
--- 388,401 ----
Karsten Hopp 5ddb51
  	vars (read-only)	The window |w:| variables. Attribute is 
Karsten Hopp 5ddb51
  				unassignable, but you can change window 
Karsten Hopp 5ddb51
  				variables this way
Karsten Hopp 5ddb51
+ 	options (read-only)	The window-local options. Attribute is 
Karsten Hopp 5ddb51
+ 				unassignable, but you can change window 
Karsten Hopp 5ddb51
+ 				options this way. Provides access only to 
Karsten Hopp 5ddb51
+ 				window-local options, for buffer-local use 
Karsten Hopp 5ddb51
+ 				|python-buffer| and for global ones use 
Karsten Hopp 5ddb51
+ 				|python-options|. If option is |global-local| 
Karsten Hopp 5ddb51
+ 				and local value is missing getting it will 
Karsten Hopp 5ddb51
+ 				return None.
Karsten Hopp 5ddb51
  The height attribute is writable only if the screen is split horizontally.
Karsten Hopp 5ddb51
  The width attribute is writable only if the screen is split vertically.
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/eval.c	2013-04-24 14:06:42.000000000 +0200
Karsten Hopp 5ddb51
--- src/eval.c	2013-05-06 03:42:00.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 16643,16651 ****
Karsten Hopp 5ddb51
--- 16643,16690 ----
Karsten Hopp 5ddb51
      setwinvar(argvars, rettv, 0);
Karsten Hopp 5ddb51
  }
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
+     int
Karsten Hopp 5ddb51
+ switch_win(save_curwin, save_curtab, win, tp)
Karsten Hopp 5ddb51
+     win_T	**save_curwin;
Karsten Hopp 5ddb51
+     tabpage_T	**save_curtab;
Karsten Hopp 5ddb51
+     win_T	*win;
Karsten Hopp 5ddb51
+     tabpage_T	*tp;
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+ #ifdef FEAT_WINDOWS
Karsten Hopp 5ddb51
+     /* set curwin to be our win, temporarily */
Karsten Hopp 5ddb51
+     *save_curwin = curwin;
Karsten Hopp 5ddb51
+     *save_curtab = curtab;
Karsten Hopp 5ddb51
+     goto_tabpage_tp(tp, TRUE);
Karsten Hopp 5ddb51
+     if (!win_valid(win))
Karsten Hopp 5ddb51
+ 	return FAIL;
Karsten Hopp 5ddb51
+     curwin = win;
Karsten Hopp 5ddb51
+     curbuf = curwin->w_buffer;
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+     return OK;
Karsten Hopp 5ddb51
+ }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     void
Karsten Hopp 5ddb51
+ restore_win(save_curwin, save_curtab)
Karsten Hopp 5ddb51
+     win_T	*save_curwin;
Karsten Hopp 5ddb51
+     tabpage_T	*save_curtab;
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+ #ifdef FEAT_WINDOWS
Karsten Hopp 5ddb51
+     /* Restore current tabpage and window, if still valid (autocomands can
Karsten Hopp 5ddb51
+      * make them invalid). */
Karsten Hopp 5ddb51
+     if (valid_tabpage(save_curtab))
Karsten Hopp 5ddb51
+ 	goto_tabpage_tp(save_curtab, TRUE);
Karsten Hopp 5ddb51
+     if (win_valid(save_curwin))
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	curwin = save_curwin;
Karsten Hopp 5ddb51
+ 	curbuf = curwin->w_buffer;
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+ }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
  /*
Karsten Hopp 5ddb51
   * "setwinvar()" and "settabwinvar()" functions
Karsten Hopp 5ddb51
   */
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
      static void
Karsten Hopp 5ddb51
  setwinvar(argvars, rettv, off)
Karsten Hopp 5ddb51
      typval_T	*argvars;
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 16678,16691 ****
Karsten Hopp 5ddb51
      if (win != NULL && varname != NULL && varp != NULL)
Karsten Hopp 5ddb51
      {
Karsten Hopp 5ddb51
  #ifdef FEAT_WINDOWS
Karsten Hopp 5ddb51
! 	/* set curwin to be our win, temporarily */
Karsten Hopp 5ddb51
! 	save_curwin = curwin;
Karsten Hopp 5ddb51
! 	save_curtab = curtab;
Karsten Hopp 5ddb51
! 	goto_tabpage_tp(tp, TRUE);
Karsten Hopp 5ddb51
! 	if (!win_valid(win))
Karsten Hopp 5ddb51
  	    return;
Karsten Hopp 5ddb51
- 	curwin = win;
Karsten Hopp 5ddb51
- 	curbuf = curwin->w_buffer;
Karsten Hopp 5ddb51
  #endif
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
  	if (*varname == '&')
Karsten Hopp 5ddb51
--- 16717,16724 ----
Karsten Hopp 5ddb51
      if (win != NULL && varname != NULL && varp != NULL)
Karsten Hopp 5ddb51
      {
Karsten Hopp 5ddb51
  #ifdef FEAT_WINDOWS
Karsten Hopp 5ddb51
! 	if (switch_win(&save_curwin, &save_curtab, win, tp) == FAIL)
Karsten Hopp 5ddb51
  	    return;
Karsten Hopp 5ddb51
  #endif
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
  	if (*varname == '&')
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 16713,16727 ****
Karsten Hopp 5ddb51
  	}
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
  #ifdef FEAT_WINDOWS
Karsten Hopp 5ddb51
! 	/* Restore current tabpage and window, if still valid (autocomands can
Karsten Hopp 5ddb51
! 	 * make them invalid). */
Karsten Hopp 5ddb51
! 	if (valid_tabpage(save_curtab))
Karsten Hopp 5ddb51
! 	    goto_tabpage_tp(save_curtab, TRUE);
Karsten Hopp 5ddb51
! 	if (win_valid(save_curwin))
Karsten Hopp 5ddb51
! 	{
Karsten Hopp 5ddb51
! 	    curwin = save_curwin;
Karsten Hopp 5ddb51
! 	    curbuf = curwin->w_buffer;
Karsten Hopp 5ddb51
! 	}
Karsten Hopp 5ddb51
  #endif
Karsten Hopp 5ddb51
      }
Karsten Hopp 5ddb51
  }
Karsten Hopp 5ddb51
--- 16746,16752 ----
Karsten Hopp 5ddb51
  	}
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
  #ifdef FEAT_WINDOWS
Karsten Hopp 5ddb51
! 	restore_win(save_curwin, save_curtab);
Karsten Hopp 5ddb51
  #endif
Karsten Hopp 5ddb51
      }
Karsten Hopp 5ddb51
  }
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/if_py_both.h	2013-04-24 14:06:42.000000000 +0200
Karsten Hopp 5ddb51
--- src/if_py_both.h	2013-05-06 03:47:38.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 1497,1502 ****
Karsten Hopp 5ddb51
--- 1497,1775 ----
Karsten Hopp 5ddb51
      { NULL,	    NULL,		0,	    NULL }
Karsten Hopp 5ddb51
  };
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
+ /*
Karsten Hopp 5ddb51
+  * Options object
Karsten Hopp 5ddb51
+  */
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ static PyTypeObject OptionsType;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ typedef int (*checkfun)(void *);
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ typedef struct
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+     PyObject_HEAD
Karsten Hopp 5ddb51
+     int opt_type;
Karsten Hopp 5ddb51
+     void *from;
Karsten Hopp 5ddb51
+     checkfun Check;
Karsten Hopp 5ddb51
+     PyObject *fromObj;
Karsten Hopp 5ddb51
+ } OptionsObject;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     static PyObject *
Karsten Hopp 5ddb51
+ OptionsItem(OptionsObject *this, PyObject *keyObject)
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+     char_u	*key;
Karsten Hopp 5ddb51
+     int		flags;
Karsten Hopp 5ddb51
+     long	numval;
Karsten Hopp 5ddb51
+     char_u	*stringval;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (this->Check(this->from))
Karsten Hopp 5ddb51
+ 	return NULL;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     DICTKEY_DECL
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     DICTKEY_GET_NOTEMPTY(NULL)
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     flags = get_option_value_strict(key, &numval, &stringval,
Karsten Hopp 5ddb51
+ 				    this->opt_type, this->from);
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     DICTKEY_UNREF
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (flags == 0)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	PyErr_SetString(PyExc_KeyError, "Option does not exist in given scope");
Karsten Hopp 5ddb51
+ 	return NULL;
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (flags & SOPT_UNSET)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	Py_INCREF(Py_None);
Karsten Hopp 5ddb51
+ 	return Py_None;
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+     else if (flags & SOPT_BOOL)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	PyObject *r;
Karsten Hopp 5ddb51
+ 	r = numval ? Py_True : Py_False;
Karsten Hopp 5ddb51
+ 	Py_INCREF(r);
Karsten Hopp 5ddb51
+ 	return r;
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+     else if (flags & SOPT_NUM)
Karsten Hopp 5ddb51
+ 	return PyInt_FromLong(numval);
Karsten Hopp 5ddb51
+     else if (flags & SOPT_STRING)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	if (stringval)
Karsten Hopp 5ddb51
+ 	    return PyBytes_FromString((char *) stringval);
Karsten Hopp 5ddb51
+ 	else
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    PyErr_SetString(PyExc_ValueError, "Unable to get option value");
Karsten Hopp 5ddb51
+ 	    return NULL;
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+     else
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	PyErr_SetVim("Internal error: unknown option type. Should not happen");
Karsten Hopp 5ddb51
+ 	return NULL;
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+ }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     static int
Karsten Hopp 5ddb51
+ set_option_value_for(key, numval, stringval, opt_flags, opt_type, from)
Karsten Hopp 5ddb51
+     char_u	*key;
Karsten Hopp 5ddb51
+     int		numval;
Karsten Hopp 5ddb51
+     char_u	*stringval;
Karsten Hopp 5ddb51
+     int		opt_flags;
Karsten Hopp 5ddb51
+     int		opt_type;
Karsten Hopp 5ddb51
+     void	*from;
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+     win_T	*save_curwin;
Karsten Hopp 5ddb51
+     tabpage_T	*save_curtab;
Karsten Hopp 5ddb51
+     aco_save_T	aco;
Karsten Hopp 5ddb51
+     int		r = 0;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     switch (opt_type)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	case SREQ_WIN:
Karsten Hopp 5ddb51
+ 	    if (switch_win(&save_curwin, &save_curtab, (win_T *) from, curtab)
Karsten Hopp 5ddb51
+ 								      == FAIL)
Karsten Hopp 5ddb51
+ 	    {
Karsten Hopp 5ddb51
+ 		PyErr_SetVim("Problem while switching windows.");
Karsten Hopp 5ddb51
+ 		return -1;
Karsten Hopp 5ddb51
+ 	    }
Karsten Hopp 5ddb51
+ 	    set_option_value(key, numval, stringval, opt_flags);
Karsten Hopp 5ddb51
+ 	    restore_win(save_curwin, save_curtab);
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ 	case SREQ_BUF:
Karsten Hopp 5ddb51
+ 	    aucmd_prepbuf(&aco, (buf_T *) from);
Karsten Hopp 5ddb51
+ 	    set_option_value(key, numval, stringval, opt_flags);
Karsten Hopp 5ddb51
+ 	    aucmd_restbuf(&aco;;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ 	case SREQ_GLOBAL:
Karsten Hopp 5ddb51
+ 	    set_option_value(key, numval, stringval, opt_flags);
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+     return r;
Karsten Hopp 5ddb51
+ }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     static int
Karsten Hopp 5ddb51
+ OptionsAssItem(OptionsObject *this, PyObject *keyObject, PyObject *valObject)
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+     char_u	*key;
Karsten Hopp 5ddb51
+     int		flags;
Karsten Hopp 5ddb51
+     int		opt_flags;
Karsten Hopp 5ddb51
+     int		r = 0;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (this->Check(this->from))
Karsten Hopp 5ddb51
+ 	return -1;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     DICTKEY_DECL
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     DICTKEY_GET_NOTEMPTY(-1)
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     flags = get_option_value_strict(key, NULL, NULL,
Karsten Hopp 5ddb51
+ 				    this->opt_type, this->from);
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     DICTKEY_UNREF
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (flags == 0)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	PyErr_SetString(PyExc_KeyError, "Option does not exist in given scope");
Karsten Hopp 5ddb51
+ 	return -1;
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (valObject == NULL)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	if (this->opt_type == SREQ_GLOBAL)
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    PyErr_SetString(PyExc_ValueError, "Unable to unset global option");
Karsten Hopp 5ddb51
+ 	    return -1;
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+ 	else if (!(flags & SOPT_GLOBAL))
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    PyErr_SetString(PyExc_ValueError, "Unable to unset option without "
Karsten Hopp 5ddb51
+ 						"global value");
Karsten Hopp 5ddb51
+ 	    return -1;
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+ 	else
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    unset_global_local_option(key, this->from);
Karsten Hopp 5ddb51
+ 	    return 0;
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     opt_flags = (this->opt_type ? OPT_LOCAL : OPT_GLOBAL);
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (flags & SOPT_BOOL)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	if (!PyBool_Check(valObject))
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    PyErr_SetString(PyExc_ValueError, "Object must be boolean");
Karsten Hopp 5ddb51
+ 	    return -1;
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ 	r = set_option_value_for(key, (valObject == Py_True), NULL, opt_flags,
Karsten Hopp 5ddb51
+ 				this->opt_type, this->from);
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+     else if (flags & SOPT_NUM)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	int val;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ #if PY_MAJOR_VERSION < 3
Karsten Hopp 5ddb51
+ 	if (PyInt_Check(valObject))
Karsten Hopp 5ddb51
+ 	    val = PyInt_AsLong(valObject);
Karsten Hopp 5ddb51
+ 	else
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+ 	if (PyLong_Check(valObject))
Karsten Hopp 5ddb51
+ 	    val = PyLong_AsLong(valObject);
Karsten Hopp 5ddb51
+ 	else
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    PyErr_SetString(PyExc_ValueError, "Object must be integer");
Karsten Hopp 5ddb51
+ 	    return -1;
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ 	r = set_option_value_for(key, val, NULL, opt_flags,
Karsten Hopp 5ddb51
+ 				this->opt_type, this->from);
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+     else
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	char_u	*val;
Karsten Hopp 5ddb51
+ 	if (PyBytes_Check(valObject))
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ 	    if (PyString_AsStringAndSize(valObject, (char **) &val, NULL) == -1)
Karsten Hopp 5ddb51
+ 		return -1;
Karsten Hopp 5ddb51
+ 	    if (val == NULL)
Karsten Hopp 5ddb51
+ 		return -1;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ 	    val = vim_strsave(val);
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+ 	else if (PyUnicode_Check(valObject))
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    PyObject	*bytes;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ 	    bytes = PyUnicode_AsEncodedString(valObject, (char *)ENC_OPT, NULL);
Karsten Hopp 5ddb51
+ 	    if (bytes == NULL)
Karsten Hopp 5ddb51
+ 		return -1;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ 	    if(PyString_AsStringAndSize(bytes, (char **) &val, NULL) == -1)
Karsten Hopp 5ddb51
+ 		return -1;
Karsten Hopp 5ddb51
+ 	    if (val == NULL)
Karsten Hopp 5ddb51
+ 		return -1;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ 	    val = vim_strsave(val);
Karsten Hopp 5ddb51
+ 	    Py_XDECREF(bytes);
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+ 	else
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    PyErr_SetString(PyExc_ValueError, "Object must be string");
Karsten Hopp 5ddb51
+ 	    return -1;
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ 	r = set_option_value_for(key, 0, val, opt_flags,
Karsten Hopp 5ddb51
+ 				this->opt_type, this->from);
Karsten Hopp 5ddb51
+ 	vim_free(val);
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     return r;
Karsten Hopp 5ddb51
+ }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     static int
Karsten Hopp 5ddb51
+ dummy_check(void *arg UNUSED)
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+     return 0;
Karsten Hopp 5ddb51
+ }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     static PyObject *
Karsten Hopp 5ddb51
+ OptionsNew(int opt_type, void *from, checkfun Check, PyObject *fromObj)
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+     OptionsObject	*self;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     self = PyObject_NEW(OptionsObject, &OptionsType);
Karsten Hopp 5ddb51
+     if (self == NULL)
Karsten Hopp 5ddb51
+ 	return NULL;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     self->opt_type = opt_type;
Karsten Hopp 5ddb51
+     self->from = from;
Karsten Hopp 5ddb51
+     self->Check = Check;
Karsten Hopp 5ddb51
+     self->fromObj = fromObj;
Karsten Hopp 5ddb51
+     if (fromObj)
Karsten Hopp 5ddb51
+ 	Py_INCREF(fromObj);
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     return (PyObject *)(self);
Karsten Hopp 5ddb51
+ }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     static void
Karsten Hopp 5ddb51
+ OptionsDestructor(PyObject *self)
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+     if (((OptionsObject *)(self))->fromObj)
Karsten Hopp 5ddb51
+ 	Py_DECREF(((OptionsObject *)(self))->fromObj);
Karsten Hopp 5ddb51
+     DESTRUCTOR_FINISH(self);
Karsten Hopp 5ddb51
+ }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ static PyMappingMethods OptionsAsMapping = {
Karsten Hopp 5ddb51
+     (lenfunc)       NULL,
Karsten Hopp 5ddb51
+     (binaryfunc)    OptionsItem,
Karsten Hopp 5ddb51
+     (objobjargproc) OptionsAssItem,
Karsten Hopp 5ddb51
+ };
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
  #define INVALID_WINDOW_VALUE ((win_T *)(-1))
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
      static int
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 1534,1541 ****
Karsten Hopp 5ddb51
  #endif
Karsten Hopp 5ddb51
      else if (strcmp(name, "vars") == 0)
Karsten Hopp 5ddb51
  	return DictionaryNew(this->win->w_vars);
Karsten Hopp 5ddb51
      else if (strcmp(name,"__members__") == 0)
Karsten Hopp 5ddb51
! 	return Py_BuildValue("[ssss]", "buffer", "cursor", "height", "vars");
Karsten Hopp 5ddb51
      else
Karsten Hopp 5ddb51
  	return NULL;
Karsten Hopp 5ddb51
  }
Karsten Hopp 5ddb51
--- 1807,1818 ----
Karsten Hopp 5ddb51
  #endif
Karsten Hopp 5ddb51
      else if (strcmp(name, "vars") == 0)
Karsten Hopp 5ddb51
  	return DictionaryNew(this->win->w_vars);
Karsten Hopp 5ddb51
+     else if (strcmp(name, "options") == 0)
Karsten Hopp 5ddb51
+ 	return OptionsNew(SREQ_WIN, this->win, (checkfun) CheckWindow,
Karsten Hopp 5ddb51
+ 			(PyObject *) this);
Karsten Hopp 5ddb51
      else if (strcmp(name,"__members__") == 0)
Karsten Hopp 5ddb51
! 	return Py_BuildValue("[sssss]", "buffer", "cursor", "height", "vars",
Karsten Hopp 5ddb51
! 		"options");
Karsten Hopp 5ddb51
      else
Karsten Hopp 5ddb51
  	return NULL;
Karsten Hopp 5ddb51
  }
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 2499,2506 ****
Karsten Hopp 5ddb51
  	return Py_BuildValue(Py_ssize_t_fmt, this->buf->b_fnum);
Karsten Hopp 5ddb51
      else if (strcmp(name, "vars") == 0)
Karsten Hopp 5ddb51
  	return DictionaryNew(this->buf->b_vars);
Karsten Hopp 5ddb51
      else if (strcmp(name,"__members__") == 0)
Karsten Hopp 5ddb51
! 	return Py_BuildValue("[sss]", "name", "number", "vars");
Karsten Hopp 5ddb51
      else
Karsten Hopp 5ddb51
  	return NULL;
Karsten Hopp 5ddb51
  }
Karsten Hopp 5ddb51
--- 2776,2786 ----
Karsten Hopp 5ddb51
  	return Py_BuildValue(Py_ssize_t_fmt, this->buf->b_fnum);
Karsten Hopp 5ddb51
      else if (strcmp(name, "vars") == 0)
Karsten Hopp 5ddb51
  	return DictionaryNew(this->buf->b_vars);
Karsten Hopp 5ddb51
+     else if (strcmp(name, "options") == 0)
Karsten Hopp 5ddb51
+ 	return OptionsNew(SREQ_BUF, this->buf, (checkfun) CheckBuffer,
Karsten Hopp 5ddb51
+ 			(PyObject *) this);
Karsten Hopp 5ddb51
      else if (strcmp(name,"__members__") == 0)
Karsten Hopp 5ddb51
! 	return Py_BuildValue("[ssss]", "name", "number", "vars", "options");
Karsten Hopp 5ddb51
      else
Karsten Hopp 5ddb51
  	return NULL;
Karsten Hopp 5ddb51
  }
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 3121,3126 ****
Karsten Hopp 5ddb51
--- 3401,3414 ----
Karsten Hopp 5ddb51
      FunctionType.tp_getattr = FunctionGetattr;
Karsten Hopp 5ddb51
  #endif
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
+     vim_memset(&OptionsType, 0, sizeof(OptionsType));
Karsten Hopp 5ddb51
+     OptionsType.tp_name = "vim.options";
Karsten Hopp 5ddb51
+     OptionsType.tp_basicsize = sizeof(OptionsObject);
Karsten Hopp 5ddb51
+     OptionsType.tp_flags = Py_TPFLAGS_DEFAULT;
Karsten Hopp 5ddb51
+     OptionsType.tp_doc = "object for manipulating options";
Karsten Hopp 5ddb51
+     OptionsType.tp_as_mapping = &OptionsAsMapping;
Karsten Hopp 5ddb51
+     OptionsType.tp_dealloc = OptionsDestructor;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
  #if PY_MAJOR_VERSION >= 3
Karsten Hopp 5ddb51
      vim_memset(&vimmodule, 0, sizeof(vimmodule));
Karsten Hopp 5ddb51
      vimmodule.m_name = "vim";
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/if_python.c	2013-04-24 14:06:42.000000000 +0200
Karsten Hopp 5ddb51
--- src/if_python.c	2013-05-06 03:36:46.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 1341,1346 ****
Karsten Hopp 5ddb51
--- 1341,1347 ----
Karsten Hopp 5ddb51
      PyType_Ready(&BufListType);
Karsten Hopp 5ddb51
      PyType_Ready(&WinListType);
Karsten Hopp 5ddb51
      PyType_Ready(&CurrentType);
Karsten Hopp 5ddb51
+     PyType_Ready(&OptionsType);
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
      /* Set sys.argv[] to avoid a crash in warn(). */
Karsten Hopp 5ddb51
      PySys_SetArgv(1, argv);
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 1360,1365 ****
Karsten Hopp 5ddb51
--- 1361,1369 ----
Karsten Hopp 5ddb51
      tmp = DictionaryNew(&vimvardict);
Karsten Hopp 5ddb51
      PyDict_SetItemString(dict, "vvars",   tmp);
Karsten Hopp 5ddb51
      Py_DECREF(tmp);
Karsten Hopp 5ddb51
+     tmp = OptionsNew(SREQ_GLOBAL, NULL, dummy_check, NULL);
Karsten Hopp 5ddb51
+     PyDict_SetItemString(dict, "options", tmp);
Karsten Hopp 5ddb51
+     Py_DECREF(tmp);
Karsten Hopp 5ddb51
      PyDict_SetItemString(dict, "VAR_LOCKED",    PyInt_FromLong(VAR_LOCKED));
Karsten Hopp 5ddb51
      PyDict_SetItemString(dict, "VAR_FIXED",     PyInt_FromLong(VAR_FIXED));
Karsten Hopp 5ddb51
      PyDict_SetItemString(dict, "VAR_SCOPE",     PyInt_FromLong(VAR_SCOPE));
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/if_python3.c	2013-04-24 14:06:42.000000000 +0200
Karsten Hopp 5ddb51
--- src/if_python3.c	2013-05-06 03:36:46.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 1628,1633 ****
Karsten Hopp 5ddb51
--- 1628,1634 ----
Karsten Hopp 5ddb51
      PyType_Ready(&DictionaryType);
Karsten Hopp 5ddb51
      PyType_Ready(&ListType);
Karsten Hopp 5ddb51
      PyType_Ready(&FunctionType);
Karsten Hopp 5ddb51
+     PyType_Ready(&OptionsType);
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
      /* Set sys.argv[] to avoid a crash in warn(). */
Karsten Hopp 5ddb51
      PySys_SetArgv(1, argv);
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 1649,1654 ****
Karsten Hopp 5ddb51
--- 1650,1657 ----
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
      PyModule_AddObject(mod, "vars", DictionaryNew(&globvardict));
Karsten Hopp 5ddb51
      PyModule_AddObject(mod, "vvars", DictionaryNew(&vimvardict));
Karsten Hopp 5ddb51
+     PyModule_AddObject(mod, "options",
Karsten Hopp 5ddb51
+ 	    OptionsNew(SREQ_GLOBAL, NULL, dummy_check, NULL));
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
  #define ADD_INT_CONSTANT(name, value) \
Karsten Hopp 5ddb51
      tmp = PyLong_FromLong(value); \
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/option.c	2013-03-19 16:46:59.000000000 +0100
Karsten Hopp 5ddb51
--- src/option.c	2013-05-06 03:47:31.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 8820,8825 ****
Karsten Hopp 5ddb51
--- 8820,8963 ----
Karsten Hopp 5ddb51
  }
Karsten Hopp 5ddb51
  #endif
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
+ #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3)
Karsten Hopp 5ddb51
+ /*
Karsten Hopp 5ddb51
+  * Returns the option attributes and its value. Unlike the above function it
Karsten Hopp 5ddb51
+  * will return either global value or local value of the option depending on
Karsten Hopp 5ddb51
+  * what was requested, but it will never return global value if it was
Karsten Hopp 5ddb51
+  * requested to return local one and vice versa. Neither it will return
Karsten Hopp 5ddb51
+  * buffer-local value if it was requested to return window-local one.
Karsten Hopp 5ddb51
+  *
Karsten Hopp 5ddb51
+  * Pretends that option is absent if it is not present in the requested scope
Karsten Hopp 5ddb51
+  * (i.e. has no global, window-local or buffer-local value depending on
Karsten Hopp 5ddb51
+  * opt_type). Uses
Karsten Hopp 5ddb51
+  *
Karsten Hopp 5ddb51
+  * Returned flags:
Karsten Hopp 5ddb51
+  *       0 hidden or unknown option
Karsten Hopp 5ddb51
+  *  see SOPT_* in vim.h for other flags
Karsten Hopp 5ddb51
+  *
Karsten Hopp 5ddb51
+  * Possible opt_type values: see SREQ_* in vim.h
Karsten Hopp 5ddb51
+  */
Karsten Hopp 5ddb51
+     int
Karsten Hopp 5ddb51
+ get_option_value_strict(name, numval, stringval, opt_type, from)
Karsten Hopp 5ddb51
+     char_u	*name;
Karsten Hopp 5ddb51
+     long	*numval;
Karsten Hopp 5ddb51
+     char_u	**stringval;	    /* NULL when only obtaining attributes */
Karsten Hopp 5ddb51
+     int		opt_type;
Karsten Hopp 5ddb51
+     void	*from;
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+     int		opt_idx;
Karsten Hopp 5ddb51
+     char_u	*varp;
Karsten Hopp 5ddb51
+     struct vimoption *p;
Karsten Hopp 5ddb51
+     int		r = 0;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     opt_idx = findoption(name);
Karsten Hopp 5ddb51
+     if (opt_idx < 0)
Karsten Hopp 5ddb51
+ 	return 0;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     p = &(options[opt_idx]);
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     /* Hidden option */
Karsten Hopp 5ddb51
+     if (p->var == NULL)
Karsten Hopp 5ddb51
+ 	return 0;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (p->flags & P_BOOL)
Karsten Hopp 5ddb51
+ 	r |= SOPT_BOOL;
Karsten Hopp 5ddb51
+     else if (p->flags & P_NUM)
Karsten Hopp 5ddb51
+ 	r |= SOPT_NUM;
Karsten Hopp 5ddb51
+     else if (p->flags & P_STRING)
Karsten Hopp 5ddb51
+ 	r |= SOPT_STRING;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (p->indir == PV_NONE)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	if (opt_type == SREQ_GLOBAL)
Karsten Hopp 5ddb51
+ 	    r |= SOPT_GLOBAL;
Karsten Hopp 5ddb51
+ 	else
Karsten Hopp 5ddb51
+ 	    return 0; /* Did not request global-only option */
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+     else
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	if (p->indir & PV_BOTH)
Karsten Hopp 5ddb51
+ 	    r |= SOPT_GLOBAL;
Karsten Hopp 5ddb51
+ 	else if (opt_type == SREQ_GLOBAL)
Karsten Hopp 5ddb51
+ 	    return 0; /* Requested global option */
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ 	if (p->indir & PV_WIN)
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    if (opt_type == SREQ_BUF)
Karsten Hopp 5ddb51
+ 		return 0; /* Did not request window-local option */
Karsten Hopp 5ddb51
+ 	    else
Karsten Hopp 5ddb51
+ 		r |= SOPT_WIN;
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+ 	else if (p->indir & PV_BUF)
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    if (opt_type == SREQ_WIN)
Karsten Hopp 5ddb51
+ 		return 0; /* Did not request buffer-local option */
Karsten Hopp 5ddb51
+ 	    else
Karsten Hopp 5ddb51
+ 		r |= SOPT_BUF;
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (stringval == NULL)
Karsten Hopp 5ddb51
+ 	return r;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (opt_type == SREQ_GLOBAL)
Karsten Hopp 5ddb51
+ 	varp = p->var;
Karsten Hopp 5ddb51
+     else
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	if (opt_type == SREQ_BUF)
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    /* Special case: 'modified' is b_changed, but we also want to
Karsten Hopp 5ddb51
+ 	     * consider it set when 'ff' or 'fenc' changed. */
Karsten Hopp 5ddb51
+ 	    if (p->indir == PV_MOD)
Karsten Hopp 5ddb51
+ 	    {
Karsten Hopp 5ddb51
+ 		*numval = bufIsChanged((buf_T *) from);
Karsten Hopp 5ddb51
+ 		varp = NULL;
Karsten Hopp 5ddb51
+ 	    }
Karsten Hopp 5ddb51
+ #ifdef FEAT_CRYPT
Karsten Hopp 5ddb51
+ 	    else if (p->indir == PV_KEY)
Karsten Hopp 5ddb51
+ 	    {
Karsten Hopp 5ddb51
+ 		/* never return the value of the crypt key */
Karsten Hopp 5ddb51
+ 		*stringval = NULL;
Karsten Hopp 5ddb51
+ 		varp = NULL;
Karsten Hopp 5ddb51
+ 	    }
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+ 	    else
Karsten Hopp 5ddb51
+ 	    {
Karsten Hopp 5ddb51
+ 		aco_save_T	aco;
Karsten Hopp 5ddb51
+ 		aucmd_prepbuf(&aco, (buf_T *) from);
Karsten Hopp 5ddb51
+ 		varp = get_varp(p);
Karsten Hopp 5ddb51
+ 		aucmd_restbuf(&aco;;
Karsten Hopp 5ddb51
+ 	    }
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+ 	else if (opt_type == SREQ_WIN)
Karsten Hopp 5ddb51
+ 	{
Karsten Hopp 5ddb51
+ 	    win_T	*save_curwin;
Karsten Hopp 5ddb51
+ 	    save_curwin = curwin;
Karsten Hopp 5ddb51
+ 	    curwin = (win_T *) from;
Karsten Hopp 5ddb51
+ 	    curbuf = curwin->w_buffer;
Karsten Hopp 5ddb51
+ 	    varp = get_varp(p);
Karsten Hopp 5ddb51
+ 	    curwin = save_curwin;
Karsten Hopp 5ddb51
+ 	    curbuf = curwin->w_buffer;
Karsten Hopp 5ddb51
+ 	}
Karsten Hopp 5ddb51
+ 	if (varp == p->var)
Karsten Hopp 5ddb51
+ 	    return (r | SOPT_UNSET);
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     if (varp != NULL)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	if (p->flags & P_STRING)
Karsten Hopp 5ddb51
+ 	    *stringval = vim_strsave(*(char_u **)(varp));
Karsten Hopp 5ddb51
+ 	else if (p->flags & P_NUM)
Karsten Hopp 5ddb51
+ 	    *numval = *(long *) varp;
Karsten Hopp 5ddb51
+ 	else
Karsten Hopp 5ddb51
+ 	    *numval = *(int *)varp;
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     return r;
Karsten Hopp 5ddb51
+ }
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
  /*
Karsten Hopp 5ddb51
   * Set the value of option "name".
Karsten Hopp 5ddb51
   * Use "string" for string options, use "number" for other options.
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 9557,9562 ****
Karsten Hopp 5ddb51
--- 9695,9781 ----
Karsten Hopp 5ddb51
  }
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
  /*
Karsten Hopp 5ddb51
+  * Unset local option value, similar to ":set opt<".
Karsten Hopp 5ddb51
+  */
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     void
Karsten Hopp 5ddb51
+ unset_global_local_option(name, from)
Karsten Hopp 5ddb51
+     char_u	*name;
Karsten Hopp 5ddb51
+     void	*from;
Karsten Hopp 5ddb51
+ {
Karsten Hopp 5ddb51
+     struct vimoption *p;
Karsten Hopp 5ddb51
+     int		opt_idx;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     buf_T *buf = (buf_T *) from;
Karsten Hopp 5ddb51
+     win_T *win = (win_T *) from;
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     opt_idx = findoption(name);
Karsten Hopp 5ddb51
+     p = &(options[opt_idx]);
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+     switch ((int)p->indir)
Karsten Hopp 5ddb51
+     {
Karsten Hopp 5ddb51
+ 	/* global option with local value: use local value if it's been set */
Karsten Hopp 5ddb51
+ 	case PV_EP:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_ep = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ 	case PV_KP:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_kp = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ 	case PV_PATH:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_path = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ 	case PV_AR:
Karsten Hopp 5ddb51
+ 	    buf->b_p_ar = -1;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ 	case PV_TAGS:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_tags = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ #ifdef FEAT_FIND_ID
Karsten Hopp 5ddb51
+ 	case PV_DEF:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_def = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ 	case PV_INC:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_inc = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+ #ifdef FEAT_INS_EXPAND
Karsten Hopp 5ddb51
+ 	case PV_DICT:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_dict = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ 	case PV_TSR:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_tsr = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+ #ifdef FEAT_QUICKFIX
Karsten Hopp 5ddb51
+ 	case PV_EFM:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_efm = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ 	case PV_GP:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_gp = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ 	case PV_MP:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_mp = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+ #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
Karsten Hopp 5ddb51
+ 	case PV_BEXPR:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_bexpr = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+ #if defined(FEAT_CRYPT)
Karsten Hopp 5ddb51
+ 	case PV_CM:
Karsten Hopp 5ddb51
+ 	    *buf->b_p_cm = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+ #ifdef FEAT_STL_OPT
Karsten Hopp 5ddb51
+ 	case PV_STL:
Karsten Hopp 5ddb51
+ 	    *win->w_p_stl = NUL;
Karsten Hopp 5ddb51
+ 	    break;
Karsten Hopp 5ddb51
+ #endif
Karsten Hopp 5ddb51
+     }
Karsten Hopp 5ddb51
+ }
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ /*
Karsten Hopp 5ddb51
   * Get pointer to option variable, depending on local or global scope.
Karsten Hopp 5ddb51
   */
Karsten Hopp 5ddb51
      static char_u *
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/proto/eval.pro	2013-04-15 12:27:30.000000000 +0200
Karsten Hopp 5ddb51
--- src/proto/eval.pro	2013-05-06 03:36:46.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 125,128 ****
Karsten Hopp 5ddb51
--- 125,130 ----
Karsten Hopp 5ddb51
  void ex_oldfiles __ARGS((exarg_T *eap));
Karsten Hopp 5ddb51
  int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
Karsten Hopp 5ddb51
  char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
Karsten Hopp 5ddb51
+ int switch_win __ARGS((win_T **, tabpage_T **, win_T *, tabpage_T *));
Karsten Hopp 5ddb51
+ void restore_win __ARGS((win_T *, tabpage_T *));
Karsten Hopp 5ddb51
  /* vim: set ft=c : */
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/proto/option.pro	2013-01-17 17:01:57.000000000 +0100
Karsten Hopp 5ddb51
--- src/proto/option.pro	2013-05-06 03:47:07.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 22,27 ****
Karsten Hopp 5ddb51
--- 22,28 ----
Karsten Hopp 5ddb51
  char_u *check_colorcolumn __ARGS((win_T *wp));
Karsten Hopp 5ddb51
  char_u *check_stl_option __ARGS((char_u *s));
Karsten Hopp 5ddb51
  int get_option_value __ARGS((char_u *name, long *numval, char_u **stringval, int opt_flags));
Karsten Hopp 5ddb51
+ int get_option_value_strict __ARGS((char_u *name, long *numval, char_u **stringval, int opt_type, void *from));
Karsten Hopp 5ddb51
  void set_option_value __ARGS((char_u *name, long number, char_u *string, int opt_flags));
Karsten Hopp 5ddb51
  char_u *get_term_code __ARGS((char_u *tname));
Karsten Hopp 5ddb51
  char_u *get_highlight_default __ARGS((void));
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 33,38 ****
Karsten Hopp 5ddb51
--- 34,40 ----
Karsten Hopp 5ddb51
  void free_one_termoption __ARGS((char_u *var));
Karsten Hopp 5ddb51
  void set_term_defaults __ARGS((void));
Karsten Hopp 5ddb51
  void comp_col __ARGS((void));
Karsten Hopp 5ddb51
+ void unset_global_local_option __ARGS((char_u *name, void *from));
Karsten Hopp 5ddb51
  char_u *get_equalprg __ARGS((void));
Karsten Hopp 5ddb51
  void win_copy_options __ARGS((win_T *wp_from, win_T *wp_to));
Karsten Hopp 5ddb51
  void copy_winopt __ARGS((winopt_T *from, winopt_T *to));
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/testdir/test86.in	2013-04-24 14:06:42.000000000 +0200
Karsten Hopp 5ddb51
--- src/testdir/test86.in	2013-05-06 03:36:46.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 359,364 ****
Karsten Hopp 5ddb51
--- 359,483 ----
Karsten Hopp 5ddb51
  :put =pyeval('vim.vars[''foo'']')
Karsten Hopp 5ddb51
  :put =pyeval('vim.current.window.vars[''abc'']')
Karsten Hopp 5ddb51
  :put =pyeval('vim.current.buffer.vars[''baz'']')
Karsten Hopp 5ddb51
+ :"
Karsten Hopp 5ddb51
+ :" Options
Karsten Hopp 5ddb51
+ :" paste:          boolean, global
Karsten Hopp 5ddb51
+ :" previewheight   number,  global
Karsten Hopp 5ddb51
+ :" operatorfunc:   string,  global
Karsten Hopp 5ddb51
+ :" number:         boolean, window-local
Karsten Hopp 5ddb51
+ :" numberwidth:    number,  window-local
Karsten Hopp 5ddb51
+ :" colorcolumn:    string,  window-local
Karsten Hopp 5ddb51
+ :" statusline:     string,  window-local/global
Karsten Hopp 5ddb51
+ :" autoindent:     boolean, buffer-local
Karsten Hopp 5ddb51
+ :" iminsert:       number,  buffer-local
Karsten Hopp 5ddb51
+ :" omnifunc:       string,  buffer-local
Karsten Hopp 5ddb51
+ :" preserveindent: boolean, buffer-local/global
Karsten Hopp 5ddb51
+ :" path:           string,  buffer-local/global
Karsten Hopp 5ddb51
+ :let g:bufs=[bufnr('%')]
Karsten Hopp 5ddb51
+ :new
Karsten Hopp 5ddb51
+ :let g:bufs+=[bufnr('%')]
Karsten Hopp 5ddb51
+ :vnew
Karsten Hopp 5ddb51
+ :let g:bufs+=[bufnr('%')]
Karsten Hopp 5ddb51
+ :wincmd j
Karsten Hopp 5ddb51
+ :vnew
Karsten Hopp 5ddb51
+ :let g:bufs+=[bufnr('%')]
Karsten Hopp 5ddb51
+ :wincmd l
Karsten Hopp 5ddb51
+ :fun RecVars(opt)
Karsten Hopp 5ddb51
+ :  let gval =string(eval('&g:'.a:opt))
Karsten Hopp 5ddb51
+ :  let wvals=join(map(range(1, 4),  'v:val.":".string(getwinvar(v:val, "&".a:opt))'))
Karsten Hopp 5ddb51
+ :  let bvals=join(map(copy(g:bufs), 'v:val.":".string(getbufvar(v:val, "&".a:opt))'))
Karsten Hopp 5ddb51
+ :  put ='  G: '.gval
Karsten Hopp 5ddb51
+ :  put ='  W: '.wvals
Karsten Hopp 5ddb51
+ :  put ='  B: '.wvals
Karsten Hopp 5ddb51
+ :endfun
Karsten Hopp 5ddb51
+ py << EOF
Karsten Hopp 5ddb51
+ def e(s, g=globals(), l=locals()):
Karsten Hopp 5ddb51
+     try:
Karsten Hopp 5ddb51
+         exec(s, g, l)
Karsten Hopp 5ddb51
+     except Exception as e:
Karsten Hopp 5ddb51
+         vim.command('throw ' + repr(e.__class__.__name__))
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ def ev(s, g=globals(), l=locals()):
Karsten Hopp 5ddb51
+     try:
Karsten Hopp 5ddb51
+         return eval(s, g, l)
Karsten Hopp 5ddb51
+     except Exception as e:
Karsten Hopp 5ddb51
+         vim.command('throw ' + repr(e.__class__.__name__))
Karsten Hopp 5ddb51
+         return 0
Karsten Hopp 5ddb51
+ EOF
Karsten Hopp 5ddb51
+ :function E(s)
Karsten Hopp 5ddb51
+ :   python e(vim.eval('a:s'))
Karsten Hopp 5ddb51
+ :endfunction
Karsten Hopp 5ddb51
+ :function Ev(s)
Karsten Hopp 5ddb51
+ :   return pyeval('ev(vim.eval("a:s"))')
Karsten Hopp 5ddb51
+ :endfunction
Karsten Hopp 5ddb51
+ :py gopts1=vim.options
Karsten Hopp 5ddb51
+ :py wopts1=vim.windows[2].options
Karsten Hopp 5ddb51
+ :py wopts2=vim.windows[0].options
Karsten Hopp 5ddb51
+ :py wopts3=vim.windows[1].options
Karsten Hopp 5ddb51
+ :py bopts1=vim.buffers[vim.bindeval("g:bufs")[2]].options
Karsten Hopp 5ddb51
+ :py bopts2=vim.buffers[vim.bindeval("g:bufs")[1]].options
Karsten Hopp 5ddb51
+ :py bopts3=vim.buffers[vim.bindeval("g:bufs")[0]].options
Karsten Hopp 5ddb51
+ :let lst=[]
Karsten Hopp 5ddb51
+ :let lst+=[['paste',          1,     0,     1,     2,      1,    1,      0    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['previewheight',  5,     1,     6,     'a',    0,    1,      0    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['operatorfunc',   'A',   'B',   'C',   2,      0,    1,      0    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['number',         0,     1,     1,     0,      1,    0,      1    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['numberwidth',    2,     3,     5,     -100,   0,    0,      1    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['colorcolumn',    '+1',  '+2',  '+3',  'abc',  0,    0,      1    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['statusline',     '1',   '2',   '4',   0,      0,    1,      1    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['autoindent',     0,     1,     1,     2,      1,    0,      2    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['iminsert',       0,     2,     1,     3,      0,    0,      2    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['omnifunc',       'A',   'B',   'C',   1,      0,    0,      2    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['preserveindent', 0,     1,     1,     2,      1,    1,      2    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['path',           '.,,', ',,',  '.',   0,      0,    1,      2    ]]
Karsten Hopp 5ddb51
+ :for       [oname,            oval1, oval2, oval3, invval, bool, global, local] in lst
Karsten Hopp 5ddb51
+ :   py oname=vim.eval('oname')
Karsten Hopp 5ddb51
+ :   py oval1=vim.bindeval('oval1')
Karsten Hopp 5ddb51
+ :   py oval2=vim.bindeval('oval2')
Karsten Hopp 5ddb51
+ :   py oval3=vim.bindeval('oval3')
Karsten Hopp 5ddb51
+ :   if invval is 0 || invval is 1
Karsten Hopp 5ddb51
+ :       py invval=bool(vim.bindeval('invval'))
Karsten Hopp 5ddb51
+ :   else
Karsten Hopp 5ddb51
+ :       py invval=vim.bindeval('invval')
Karsten Hopp 5ddb51
+ :   endif
Karsten Hopp 5ddb51
+ :   if bool
Karsten Hopp 5ddb51
+ :       py oval1=bool(oval1)
Karsten Hopp 5ddb51
+ :       py oval2=bool(oval2)
Karsten Hopp 5ddb51
+ :       py oval3=bool(oval3)
Karsten Hopp 5ddb51
+ :   endif
Karsten Hopp 5ddb51
+ :   put ='>>> '.oname
Karsten Hopp 5ddb51
+ :   for v in ['gopts1', 'wopts1', 'bopts1']
Karsten Hopp 5ddb51
+ :       try
Karsten Hopp 5ddb51
+ :           put ='  p/'.v.': '.Ev('repr('.v.'['''.oname.'''])')
Karsten Hopp 5ddb51
+ :       catch
Karsten Hopp 5ddb51
+ :           put ='  p/'.v.'! '.v:exception
Karsten Hopp 5ddb51
+ :       endtry
Karsten Hopp 5ddb51
+ :       try
Karsten Hopp 5ddb51
+ :           call E(v.'["'.oname.'"]=invval')
Karsten Hopp 5ddb51
+ :       catch
Karsten Hopp 5ddb51
+ :           put ='  inv: '.string(invval).'! '.v:exception
Karsten Hopp 5ddb51
+ :       endtry
Karsten Hopp 5ddb51
+ :       for vv in (v is# 'gopts1' ? [v] : [v, v[:-2].'2', v[:-2].'3'])
Karsten Hopp 5ddb51
+ :           let val=substitute(vv, '^.opts', 'oval', '')
Karsten Hopp 5ddb51
+ :           try
Karsten Hopp 5ddb51
+ :               call E(vv.'["'.oname.'"]='.val)
Karsten Hopp 5ddb51
+ :           catch
Karsten Hopp 5ddb51
+ :               put ='  '.vv.'! '.v:exception
Karsten Hopp 5ddb51
+ :           endtry
Karsten Hopp 5ddb51
+ :       endfor
Karsten Hopp 5ddb51
+ :   endfor
Karsten Hopp 5ddb51
+ :   call RecVars(oname)
Karsten Hopp 5ddb51
+ :   for v in ['wopts3', 'bopts3']
Karsten Hopp 5ddb51
+ :       try
Karsten Hopp 5ddb51
+ :           call E('del '.v.'["'.oname.'"]')
Karsten Hopp 5ddb51
+ :       catch
Karsten Hopp 5ddb51
+ :           put ='  del '.v.'! '.v:exception
Karsten Hopp 5ddb51
+ :       endtry
Karsten Hopp 5ddb51
+ :   endfor
Karsten Hopp 5ddb51
+ :   call RecVars(oname)
Karsten Hopp 5ddb51
+ endtry
Karsten Hopp 5ddb51
+ :endfor
Karsten Hopp 5ddb51
+ :only
Karsten Hopp 5ddb51
  :endfun
Karsten Hopp 5ddb51
  :"
Karsten Hopp 5ddb51
  :call Test()
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/testdir/test86.ok	2013-04-24 14:06:42.000000000 +0200
Karsten Hopp 5ddb51
--- src/testdir/test86.ok	2013-05-06 03:36:46.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 80,82 ****
Karsten Hopp 5ddb51
--- 80,308 ----
Karsten Hopp 5ddb51
  bac
Karsten Hopp 5ddb51
  def
Karsten Hopp 5ddb51
  bar
Karsten Hopp 5ddb51
+ >>> paste
Karsten Hopp 5ddb51
+   p/gopts1: False
Karsten Hopp 5ddb51
+   inv: 2! ValueError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 1
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:1 4:1
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:1 4:1
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 1
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:1 4:1
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:1 4:1
Karsten Hopp 5ddb51
+ >>> previewheight
Karsten Hopp 5ddb51
+   p/gopts1: 12
Karsten Hopp 5ddb51
+   inv: 'a'! ValueError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 'a'! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 'a'! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 5
Karsten Hopp 5ddb51
+   W: 1:5 2:5 3:5 4:5
Karsten Hopp 5ddb51
+   B: 1:5 2:5 3:5 4:5
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 5
Karsten Hopp 5ddb51
+   W: 1:5 2:5 3:5 4:5
Karsten Hopp 5ddb51
+   B: 1:5 2:5 3:5 4:5
Karsten Hopp 5ddb51
+ >>> operatorfunc
Karsten Hopp 5ddb51
+   p/gopts1: ''
Karsten Hopp 5ddb51
+   inv: 2! ValueError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 'A'
Karsten Hopp 5ddb51
+   W: 1:'A' 2:'A' 3:'A' 4:'A'
Karsten Hopp 5ddb51
+   B: 1:'A' 2:'A' 3:'A' 4:'A'
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 'A'
Karsten Hopp 5ddb51
+   W: 1:'A' 2:'A' 3:'A' 4:'A'
Karsten Hopp 5ddb51
+   B: 1:'A' 2:'A' 3:'A' 4:'A'
Karsten Hopp 5ddb51
+ >>> number
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 0! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1: False
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 0! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   del wopts3! ValueError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+ >>> numberwidth
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: -100! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1: 8
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: -100! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 8
Karsten Hopp 5ddb51
+   W: 1:3 2:5 3:2 4:8
Karsten Hopp 5ddb51
+   B: 1:3 2:5 3:2 4:8
Karsten Hopp 5ddb51
+   del wopts3! ValueError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 8
Karsten Hopp 5ddb51
+   W: 1:3 2:5 3:2 4:8
Karsten Hopp 5ddb51
+   B: 1:3 2:5 3:2 4:8
Karsten Hopp 5ddb51
+ >>> colorcolumn
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 'abc'! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1: ''
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 'abc'! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: ''
Karsten Hopp 5ddb51
+   W: 1:'+2' 2:'+3' 3:'+1' 4:''
Karsten Hopp 5ddb51
+   B: 1:'+2' 2:'+3' 3:'+1' 4:''
Karsten Hopp 5ddb51
+   del wopts3! ValueError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: ''
Karsten Hopp 5ddb51
+   W: 1:'+2' 2:'+3' 3:'+1' 4:''
Karsten Hopp 5ddb51
+   B: 1:'+2' 2:'+3' 3:'+1' 4:''
Karsten Hopp 5ddb51
+ >>> statusline
Karsten Hopp 5ddb51
+   p/gopts1: ''
Karsten Hopp 5ddb51
+   inv: 0! ValueError
Karsten Hopp 5ddb51
+   p/wopts1: None
Karsten Hopp 5ddb51
+   inv: 0! ValueError
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 0! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: '1'
Karsten Hopp 5ddb51
+   W: 1:'2' 2:'4' 3:'1' 4:'1'
Karsten Hopp 5ddb51
+   B: 1:'2' 2:'4' 3:'1' 4:'1'
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: '1'
Karsten Hopp 5ddb51
+   W: 1:'2' 2:'1' 3:'1' 4:'1'
Karsten Hopp 5ddb51
+   B: 1:'2' 2:'1' 3:'1' 4:'1'
Karsten Hopp 5ddb51
+ >>> autoindent
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1: False
Karsten Hopp 5ddb51
+   inv: 2! ValueError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! ValueError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+ >>> iminsert
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 3! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 3! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1: 2
Karsten Hopp 5ddb51
+   G: 1
Karsten Hopp 5ddb51
+   W: 1:2 2:1 3:0 4:2
Karsten Hopp 5ddb51
+   B: 1:2 2:1 3:0 4:2
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! ValueError
Karsten Hopp 5ddb51
+   G: 1
Karsten Hopp 5ddb51
+   W: 1:2 2:1 3:0 4:2
Karsten Hopp 5ddb51
+   B: 1:2 2:1 3:0 4:2
Karsten Hopp 5ddb51
+ >>> omnifunc
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 1! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 1! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1: ''
Karsten Hopp 5ddb51
+   inv: 1! ValueError
Karsten Hopp 5ddb51
+   G: ''
Karsten Hopp 5ddb51
+   W: 1:'B' 2:'C' 3:'A' 4:''
Karsten Hopp 5ddb51
+   B: 1:'B' 2:'C' 3:'A' 4:''
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! ValueError
Karsten Hopp 5ddb51
+   G: ''
Karsten Hopp 5ddb51
+   W: 1:'B' 2:'C' 3:'A' 4:''
Karsten Hopp 5ddb51
+   B: 1:'B' 2:'C' 3:'A' 4:''
Karsten Hopp 5ddb51
+ >>> preserveindent
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1: False
Karsten Hopp 5ddb51
+   inv: 2! ValueError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! ValueError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+ >>> path
Karsten Hopp 5ddb51
+   p/gopts1: '.,/usr/include,,'
Karsten Hopp 5ddb51
+   inv: 0! ValueError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 0! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1: None
Karsten Hopp 5ddb51
+   inv: 0! ValueError
Karsten Hopp 5ddb51
+   G: '.,,'
Karsten Hopp 5ddb51
+   W: 1:',,' 2:'.' 3:'.,,' 4:'.,,'
Karsten Hopp 5ddb51
+   B: 1:',,' 2:'.' 3:'.,,' 4:'.,,'
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   G: '.,,'
Karsten Hopp 5ddb51
+   W: 1:',,' 2:'.,,' 3:'.,,' 4:'.,,'
Karsten Hopp 5ddb51
+   B: 1:',,' 2:'.,,' 3:'.,,' 4:'.,,'
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/testdir/test87.in	2013-04-24 14:06:42.000000000 +0200
Karsten Hopp 5ddb51
--- src/testdir/test87.in	2013-05-06 03:36:46.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 328,333 ****
Karsten Hopp 5ddb51
--- 328,452 ----
Karsten Hopp 5ddb51
  :put =py3eval('vim.vars[''foo'']')
Karsten Hopp 5ddb51
  :put =py3eval('vim.current.window.vars[''abc'']')
Karsten Hopp 5ddb51
  :put =py3eval('vim.current.buffer.vars[''baz'']')
Karsten Hopp 5ddb51
+ :"
Karsten Hopp 5ddb51
+ :" Options
Karsten Hopp 5ddb51
+ :" paste:          boolean, global
Karsten Hopp 5ddb51
+ :" previewheight   number,  global
Karsten Hopp 5ddb51
+ :" operatorfunc:   string,  global
Karsten Hopp 5ddb51
+ :" number:         boolean, window-local
Karsten Hopp 5ddb51
+ :" numberwidth:    number,  window-local
Karsten Hopp 5ddb51
+ :" colorcolumn:    string,  window-local
Karsten Hopp 5ddb51
+ :" statusline:     string,  window-local/global
Karsten Hopp 5ddb51
+ :" autoindent:     boolean, buffer-local
Karsten Hopp 5ddb51
+ :" iminsert:       number,  buffer-local
Karsten Hopp 5ddb51
+ :" omnifunc:       string,  buffer-local
Karsten Hopp 5ddb51
+ :" preserveindent: boolean, buffer-local/global
Karsten Hopp 5ddb51
+ :" path:           string,  buffer-local/global
Karsten Hopp 5ddb51
+ :let g:bufs=[bufnr('%')]
Karsten Hopp 5ddb51
+ :new
Karsten Hopp 5ddb51
+ :let g:bufs+=[bufnr('%')]
Karsten Hopp 5ddb51
+ :vnew
Karsten Hopp 5ddb51
+ :let g:bufs+=[bufnr('%')]
Karsten Hopp 5ddb51
+ :wincmd j
Karsten Hopp 5ddb51
+ :vnew
Karsten Hopp 5ddb51
+ :let g:bufs+=[bufnr('%')]
Karsten Hopp 5ddb51
+ :wincmd l
Karsten Hopp 5ddb51
+ :fun RecVars(opt)
Karsten Hopp 5ddb51
+ :  let gval =string(eval('&g:'.a:opt))
Karsten Hopp 5ddb51
+ :  let wvals=join(map(range(1, 4),  'v:val.":".string(getwinvar(v:val, "&".a:opt))'))
Karsten Hopp 5ddb51
+ :  let bvals=join(map(copy(g:bufs), 'v:val.":".string(getbufvar(v:val, "&".a:opt))'))
Karsten Hopp 5ddb51
+ :  put ='  G: '.gval
Karsten Hopp 5ddb51
+ :  put ='  W: '.wvals
Karsten Hopp 5ddb51
+ :  put ='  B: '.wvals
Karsten Hopp 5ddb51
+ :endfun
Karsten Hopp 5ddb51
+ py3 << EOF
Karsten Hopp 5ddb51
+ def e(s, g=globals(), l=locals()):
Karsten Hopp 5ddb51
+     try:
Karsten Hopp 5ddb51
+         exec(s, g, l)
Karsten Hopp 5ddb51
+     except Exception as e:
Karsten Hopp 5ddb51
+         vim.command('throw ' + repr(e.__class__.__name__))
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ def ev(s, g=globals(), l=locals()):
Karsten Hopp 5ddb51
+     try:
Karsten Hopp 5ddb51
+         return eval(s, g, l)
Karsten Hopp 5ddb51
+     except Exception as e:
Karsten Hopp 5ddb51
+         vim.command('throw ' + repr(e.__class__.__name__))
Karsten Hopp 5ddb51
+         return 0
Karsten Hopp 5ddb51
+ EOF
Karsten Hopp 5ddb51
+ :function E(s)
Karsten Hopp 5ddb51
+ :   python3 e(vim.eval('a:s'))
Karsten Hopp 5ddb51
+ :endfunction
Karsten Hopp 5ddb51
+ :function Ev(s)
Karsten Hopp 5ddb51
+ :   return py3eval('ev(vim.eval("a:s"))')
Karsten Hopp 5ddb51
+ :endfunction
Karsten Hopp 5ddb51
+ :py3 gopts1=vim.options
Karsten Hopp 5ddb51
+ :py3 wopts1=vim.windows[2].options
Karsten Hopp 5ddb51
+ :py3 wopts2=vim.windows[0].options
Karsten Hopp 5ddb51
+ :py3 wopts3=vim.windows[1].options
Karsten Hopp 5ddb51
+ :py3 bopts1=vim.buffers[vim.bindeval("g:bufs")[2]].options
Karsten Hopp 5ddb51
+ :py3 bopts2=vim.buffers[vim.bindeval("g:bufs")[1]].options
Karsten Hopp 5ddb51
+ :py3 bopts3=vim.buffers[vim.bindeval("g:bufs")[0]].options
Karsten Hopp 5ddb51
+ :let lst=[]
Karsten Hopp 5ddb51
+ :let lst+=[['paste',          1,     0,     1,     2,      1,    1,      0    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['previewheight',  5,     1,     6,     'a',    0,    1,      0    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['operatorfunc',   'A',   'B',   'C',   2,      0,    1,      0    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['number',         0,     1,     1,     0,      1,    0,      1    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['numberwidth',    2,     3,     5,     -100,   0,    0,      1    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['colorcolumn',    '+1',  '+2',  '+3',  'abc',  0,    0,      1    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['statusline',     '1',   '2',   '4',   0,      0,    1,      1    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['autoindent',     0,     1,     1,     2,      1,    0,      2    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['iminsert',       0,     2,     1,     3,      0,    0,      2    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['omnifunc',       'A',   'B',   'C',   1,      0,    0,      2    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['preserveindent', 0,     1,     1,     2,      1,    1,      2    ]]
Karsten Hopp 5ddb51
+ :let lst+=[['path',           '.,,', ',,',  '.',   0,      0,    1,      2    ]]
Karsten Hopp 5ddb51
+ :for       [oname,            oval1, oval2, oval3, invval, bool, global, local] in lst
Karsten Hopp 5ddb51
+ :   py3 oname=vim.eval('oname')
Karsten Hopp 5ddb51
+ :   py3 oval1=vim.bindeval('oval1')
Karsten Hopp 5ddb51
+ :   py3 oval2=vim.bindeval('oval2')
Karsten Hopp 5ddb51
+ :   py3 oval3=vim.bindeval('oval3')
Karsten Hopp 5ddb51
+ :   if invval is 0 || invval is 1
Karsten Hopp 5ddb51
+ :       py3 invval=bool(vim.bindeval('invval'))
Karsten Hopp 5ddb51
+ :   else
Karsten Hopp 5ddb51
+ :       py3 invval=vim.bindeval('invval')
Karsten Hopp 5ddb51
+ :   endif
Karsten Hopp 5ddb51
+ :   if bool
Karsten Hopp 5ddb51
+ :       py3 oval1=bool(oval1)
Karsten Hopp 5ddb51
+ :       py3 oval2=bool(oval2)
Karsten Hopp 5ddb51
+ :       py3 oval3=bool(oval3)
Karsten Hopp 5ddb51
+ :   endif
Karsten Hopp 5ddb51
+ :   put ='>>> '.oname
Karsten Hopp 5ddb51
+ :   for v in ['gopts1', 'wopts1', 'bopts1']
Karsten Hopp 5ddb51
+ :       try
Karsten Hopp 5ddb51
+ :           put ='  p/'.v.': '.Ev('repr('.v.'['''.oname.'''])')
Karsten Hopp 5ddb51
+ :       catch
Karsten Hopp 5ddb51
+ :           put ='  p/'.v.'! '.v:exception
Karsten Hopp 5ddb51
+ :       endtry
Karsten Hopp 5ddb51
+ :       try
Karsten Hopp 5ddb51
+ :           call E(v.'["'.oname.'"]=invval')
Karsten Hopp 5ddb51
+ :       catch
Karsten Hopp 5ddb51
+ :           put ='  inv: '.string(invval).'! '.v:exception
Karsten Hopp 5ddb51
+ :       endtry
Karsten Hopp 5ddb51
+ :       for vv in (v is# 'gopts1' ? [v] : [v, v[:-2].'2', v[:-2].'3'])
Karsten Hopp 5ddb51
+ :           let val=substitute(vv, '^.opts', 'oval', '')
Karsten Hopp 5ddb51
+ :           try
Karsten Hopp 5ddb51
+ :               call E(vv.'["'.oname.'"]='.val)
Karsten Hopp 5ddb51
+ :           catch
Karsten Hopp 5ddb51
+ :               put ='  '.vv.'! '.v:exception
Karsten Hopp 5ddb51
+ :           endtry
Karsten Hopp 5ddb51
+ :       endfor
Karsten Hopp 5ddb51
+ :   endfor
Karsten Hopp 5ddb51
+ :   call RecVars(oname)
Karsten Hopp 5ddb51
+ :   for v in ['wopts3', 'bopts3']
Karsten Hopp 5ddb51
+ :       try
Karsten Hopp 5ddb51
+ :           call E('del '.v.'["'.oname.'"]')
Karsten Hopp 5ddb51
+ :       catch
Karsten Hopp 5ddb51
+ :           put ='  del '.v.'! '.v:exception
Karsten Hopp 5ddb51
+ :       endtry
Karsten Hopp 5ddb51
+ :   endfor
Karsten Hopp 5ddb51
+ :   call RecVars(oname)
Karsten Hopp 5ddb51
+ endtry
Karsten Hopp 5ddb51
+ :endfor
Karsten Hopp 5ddb51
+ :only
Karsten Hopp 5ddb51
  :endfun
Karsten Hopp 5ddb51
  :"
Karsten Hopp 5ddb51
  :call Test()
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/testdir/test87.ok	2013-04-24 14:06:42.000000000 +0200
Karsten Hopp 5ddb51
--- src/testdir/test87.ok	2013-05-06 03:36:46.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 69,71 ****
Karsten Hopp 5ddb51
--- 69,297 ----
Karsten Hopp 5ddb51
  bac
Karsten Hopp 5ddb51
  def
Karsten Hopp 5ddb51
  bar
Karsten Hopp 5ddb51
+ >>> paste
Karsten Hopp 5ddb51
+   p/gopts1: False
Karsten Hopp 5ddb51
+   inv: 2! ValueError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 1
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:1 4:1
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:1 4:1
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 1
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:1 4:1
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:1 4:1
Karsten Hopp 5ddb51
+ >>> previewheight
Karsten Hopp 5ddb51
+   p/gopts1: 12
Karsten Hopp 5ddb51
+   inv: 'a'! ValueError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 'a'! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 'a'! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 5
Karsten Hopp 5ddb51
+   W: 1:5 2:5 3:5 4:5
Karsten Hopp 5ddb51
+   B: 1:5 2:5 3:5 4:5
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 5
Karsten Hopp 5ddb51
+   W: 1:5 2:5 3:5 4:5
Karsten Hopp 5ddb51
+   B: 1:5 2:5 3:5 4:5
Karsten Hopp 5ddb51
+ >>> operatorfunc
Karsten Hopp 5ddb51
+   p/gopts1: b''
Karsten Hopp 5ddb51
+   inv: 2! ValueError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 'A'
Karsten Hopp 5ddb51
+   W: 1:'A' 2:'A' 3:'A' 4:'A'
Karsten Hopp 5ddb51
+   B: 1:'A' 2:'A' 3:'A' 4:'A'
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 'A'
Karsten Hopp 5ddb51
+   W: 1:'A' 2:'A' 3:'A' 4:'A'
Karsten Hopp 5ddb51
+   B: 1:'A' 2:'A' 3:'A' 4:'A'
Karsten Hopp 5ddb51
+ >>> number
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 0! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1: False
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 0! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   del wopts3! ValueError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+ >>> numberwidth
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: -100! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1: 8
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: -100! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 8
Karsten Hopp 5ddb51
+   W: 1:3 2:5 3:2 4:8
Karsten Hopp 5ddb51
+   B: 1:3 2:5 3:2 4:8
Karsten Hopp 5ddb51
+   del wopts3! ValueError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: 8
Karsten Hopp 5ddb51
+   W: 1:3 2:5 3:2 4:8
Karsten Hopp 5ddb51
+   B: 1:3 2:5 3:2 4:8
Karsten Hopp 5ddb51
+ >>> colorcolumn
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 'abc'! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1: b''
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 'abc'! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: ''
Karsten Hopp 5ddb51
+   W: 1:'+2' 2:'+3' 3:'+1' 4:''
Karsten Hopp 5ddb51
+   B: 1:'+2' 2:'+3' 3:'+1' 4:''
Karsten Hopp 5ddb51
+   del wopts3! ValueError
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: ''
Karsten Hopp 5ddb51
+   W: 1:'+2' 2:'+3' 3:'+1' 4:''
Karsten Hopp 5ddb51
+   B: 1:'+2' 2:'+3' 3:'+1' 4:''
Karsten Hopp 5ddb51
+ >>> statusline
Karsten Hopp 5ddb51
+   p/gopts1: b''
Karsten Hopp 5ddb51
+   inv: 0! ValueError
Karsten Hopp 5ddb51
+   p/wopts1: None
Karsten Hopp 5ddb51
+   inv: 0! ValueError
Karsten Hopp 5ddb51
+   p/bopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 0! KeyError
Karsten Hopp 5ddb51
+   bopts1! KeyError
Karsten Hopp 5ddb51
+   bopts2! KeyError
Karsten Hopp 5ddb51
+   bopts3! KeyError
Karsten Hopp 5ddb51
+   G: '1'
Karsten Hopp 5ddb51
+   W: 1:'2' 2:'4' 3:'1' 4:'1'
Karsten Hopp 5ddb51
+   B: 1:'2' 2:'4' 3:'1' 4:'1'
Karsten Hopp 5ddb51
+   del bopts3! KeyError
Karsten Hopp 5ddb51
+   G: '1'
Karsten Hopp 5ddb51
+   W: 1:'2' 2:'1' 3:'1' 4:'1'
Karsten Hopp 5ddb51
+   B: 1:'2' 2:'1' 3:'1' 4:'1'
Karsten Hopp 5ddb51
+ >>> autoindent
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1: False
Karsten Hopp 5ddb51
+   inv: 2! ValueError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! ValueError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+ >>> iminsert
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 3! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 3! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1: 2
Karsten Hopp 5ddb51
+   G: 1
Karsten Hopp 5ddb51
+   W: 1:2 2:1 3:0 4:2
Karsten Hopp 5ddb51
+   B: 1:2 2:1 3:0 4:2
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! ValueError
Karsten Hopp 5ddb51
+   G: 1
Karsten Hopp 5ddb51
+   W: 1:2 2:1 3:0 4:2
Karsten Hopp 5ddb51
+   B: 1:2 2:1 3:0 4:2
Karsten Hopp 5ddb51
+ >>> omnifunc
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 1! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 1! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1: b''
Karsten Hopp 5ddb51
+   inv: 1! ValueError
Karsten Hopp 5ddb51
+   G: ''
Karsten Hopp 5ddb51
+   W: 1:'B' 2:'C' 3:'A' 4:''
Karsten Hopp 5ddb51
+   B: 1:'B' 2:'C' 3:'A' 4:''
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! ValueError
Karsten Hopp 5ddb51
+   G: ''
Karsten Hopp 5ddb51
+   W: 1:'B' 2:'C' 3:'A' 4:''
Karsten Hopp 5ddb51
+   B: 1:'B' 2:'C' 3:'A' 4:''
Karsten Hopp 5ddb51
+ >>> preserveindent
Karsten Hopp 5ddb51
+   p/gopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   gopts1! KeyError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 2! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1: False
Karsten Hopp 5ddb51
+   inv: 2! ValueError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   del bopts3! ValueError
Karsten Hopp 5ddb51
+   G: 0
Karsten Hopp 5ddb51
+   W: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+   B: 1:1 2:1 3:0 4:0
Karsten Hopp 5ddb51
+ >>> path
Karsten Hopp 5ddb51
+   p/gopts1: b'.,/usr/include,,'
Karsten Hopp 5ddb51
+   inv: 0! ValueError
Karsten Hopp 5ddb51
+   p/wopts1! KeyError
Karsten Hopp 5ddb51
+   inv: 0! KeyError
Karsten Hopp 5ddb51
+   wopts1! KeyError
Karsten Hopp 5ddb51
+   wopts2! KeyError
Karsten Hopp 5ddb51
+   wopts3! KeyError
Karsten Hopp 5ddb51
+   p/bopts1: None
Karsten Hopp 5ddb51
+   inv: 0! ValueError
Karsten Hopp 5ddb51
+   G: '.,,'
Karsten Hopp 5ddb51
+   W: 1:',,' 2:'.' 3:'.,,' 4:'.,,'
Karsten Hopp 5ddb51
+   B: 1:',,' 2:'.' 3:'.,,' 4:'.,,'
Karsten Hopp 5ddb51
+   del wopts3! KeyError
Karsten Hopp 5ddb51
+   G: '.,,'
Karsten Hopp 5ddb51
+   W: 1:',,' 2:'.,,' 3:'.,,' 4:'.,,'
Karsten Hopp 5ddb51
+   B: 1:',,' 2:'.,,' 3:'.,,' 4:'.,,'
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/vim.h	2013-03-19 16:46:59.000000000 +0100
Karsten Hopp 5ddb51
--- src/vim.h	2013-05-06 03:36:46.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 2230,2233 ****
Karsten Hopp 5ddb51
--- 2230,2246 ----
Karsten Hopp 5ddb51
  #define FILEINFO_READ_FAIL   2	/* CreateFile() failed */
Karsten Hopp 5ddb51
  #define FILEINFO_INFO_FAIL   3	/* GetFileInformationByHandle() failed */
Karsten Hopp 5ddb51
  
Karsten Hopp 5ddb51
+ /* Return value from get_option_value_strict */
Karsten Hopp 5ddb51
+ #define SOPT_BOOL	0x01	/* Boolean option */
Karsten Hopp 5ddb51
+ #define SOPT_NUM	0x02	/* Number option */
Karsten Hopp 5ddb51
+ #define SOPT_STRING	0x04	/* String option */
Karsten Hopp 5ddb51
+ #define SOPT_GLOBAL	0x08	/* Option has global value */
Karsten Hopp 5ddb51
+ #define SOPT_WIN	0x10	/* Option has window-local value */
Karsten Hopp 5ddb51
+ #define SOPT_BUF	0x20	/* Option has buffer-local value */
Karsten Hopp 5ddb51
+ #define SOPT_UNSET	0x40	/* Option does not have local value set */
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
+ #define SREQ_GLOBAL	0	/* Request global option */
Karsten Hopp 5ddb51
+ #define SREQ_WIN	1	/* Request window-local option */
Karsten Hopp 5ddb51
+ #define SREQ_BUF	2	/* Request buffer-local option */
Karsten Hopp 5ddb51
+ 
Karsten Hopp 5ddb51
  #endif /* VIM__H */
Karsten Hopp 5ddb51
*** ../vim-7.3.923/src/version.c	2013-05-04 04:40:06.000000000 +0200
Karsten Hopp 5ddb51
--- src/version.c	2013-05-06 03:38:06.000000000 +0200
Karsten Hopp 5ddb51
***************
Karsten Hopp 5ddb51
*** 730,731 ****
Karsten Hopp 5ddb51
--- 730,733 ----
Karsten Hopp 5ddb51
  {   /* Add new patch number below this line */
Karsten Hopp 5ddb51
+ /**/
Karsten Hopp 5ddb51
+     924,
Karsten Hopp 5ddb51
  /**/
Karsten Hopp 5ddb51
Karsten Hopp 5ddb51
-- 
Karsten Hopp 5ddb51
ARTHUR: (as the MAN next to him is squashed by a sheep) Knights!  Run away!
Karsten Hopp 5ddb51
   Midst echoing shouts of "run away" the KNIGHTS retreat to cover with the odd
Karsten Hopp 5ddb51
   cow or goose hitting them still.  The KNIGHTS crouch down under cover.
Karsten Hopp 5ddb51
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 5ddb51
Karsten Hopp 5ddb51
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 5ddb51
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 5ddb51
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 5ddb51
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///