Karsten Hopp 85476a
To: vim_dev@googlegroups.com
Karsten Hopp 85476a
Subject: Patch 7.3.694
Karsten Hopp 85476a
Fcc: outbox
Karsten Hopp 85476a
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 85476a
Mime-Version: 1.0
Karsten Hopp 85476a
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 85476a
Content-Transfer-Encoding: 8bit
Karsten Hopp 85476a
------------
Karsten Hopp 85476a
Karsten Hopp 85476a
Patch 7.3.694
Karsten Hopp 85476a
Problem:    Now that 'shiftwidth' may use the value of 'tabstop' it is not so
Karsten Hopp 85476a
            easy to use in indent files.
Karsten Hopp 85476a
Solution:   Add the shiftwidth() function. (so8res)
Karsten Hopp 85476a
Files:      runtime/doc/eval.txt, src/eval.c
Karsten Hopp 85476a
Karsten Hopp 85476a
Karsten Hopp 85476a
*** ../vim-7.3.693/runtime/doc/eval.txt	2012-06-29 12:54:32.000000000 +0200
Karsten Hopp 85476a
--- runtime/doc/eval.txt	2012-10-21 00:43:22.000000000 +0200
Karsten Hopp 85476a
***************
Karsten Hopp 85476a
*** 1921,1926 ****
Karsten Hopp 85476a
--- 1932,1938 ----
Karsten Hopp 85476a
  shellescape( {string} [, {special}])
Karsten Hopp 85476a
  				String	escape {string} for use as shell
Karsten Hopp 85476a
  					command argument
Karsten Hopp 85476a
+ shiftwidth()			Number	effective value of 'shiftwidth'
Karsten Hopp 85476a
  simplify( {filename})		String	simplify filename as much as possible
Karsten Hopp 85476a
  sin( {expr})			Float	sine of {expr}
Karsten Hopp 85476a
  sinh( {expr})			Float	hyperbolic sine of {expr}
Karsten Hopp 85476a
***************
Karsten Hopp 85476a
*** 3732,3741 ****
Karsten Hopp 85476a
  		Like |input()|, but when the GUI is running and text dialogs
Karsten Hopp 85476a
  		are supported, a dialog window pops up to input the text.
Karsten Hopp 85476a
  		Example: >
Karsten Hopp 85476a
! 			:let n = inputdialog("value for shiftwidth", &sw)
Karsten Hopp 85476a
! 			:if n != ""
Karsten Hopp 85476a
! 			:  let &sw = n
Karsten Hopp 85476a
! 			:endif
Karsten Hopp 85476a
  <		When the dialog is cancelled {cancelreturn} is returned.  When
Karsten Hopp 85476a
  		omitted an empty string is returned.
Karsten Hopp 85476a
  		Hitting <Enter> works like pressing the OK button.  Hitting
Karsten Hopp 85476a
--- 3755,3764 ----
Karsten Hopp 85476a
  		Like |input()|, but when the GUI is running and text dialogs
Karsten Hopp 85476a
  		are supported, a dialog window pops up to input the text.
Karsten Hopp 85476a
  		Example: >
Karsten Hopp 85476a
! 		   :let n = inputdialog("value for shiftwidth", shiftwidth())
Karsten Hopp 85476a
! 		   :if n != ""
Karsten Hopp 85476a
! 		   :  let &sw = n
Karsten Hopp 85476a
! 		   :endif
Karsten Hopp 85476a
  <		When the dialog is cancelled {cancelreturn} is returned.  When
Karsten Hopp 85476a
  		omitted an empty string is returned.
Karsten Hopp 85476a
  		Hitting <Enter> works like pressing the OK button.  Hitting
Karsten Hopp 85476a
***************
Karsten Hopp 85476a
*** 5308,5313 ****
Karsten Hopp 85476a
--- 5332,5354 ----
Karsten Hopp 85476a
  		    :call system("chmod +w -- " . shellescape(expand("%")))
Karsten Hopp 85476a
  
Karsten Hopp 85476a
  
Karsten Hopp 85476a
+ shiftwidth()						*shiftwidth()*
Karsten Hopp 85476a
+ 		Returns the effective value of 'shiftwidth'. This is the
Karsten Hopp 85476a
+ 		'shiftwidth' value unless it is zero, in which case it is the
Karsten Hopp 85476a
+ 		'tabstop' value.  To be backwards compatible in indent
Karsten Hopp 85476a
+ 		plugins, use this: >
Karsten Hopp 85476a
+ 			if exists('*shiftwidth')
Karsten Hopp 85476a
+ 			  func s:sw()
Karsten Hopp 85476a
+ 			    return shiftwidth()
Karsten Hopp 85476a
+ 			  endfunc
Karsten Hopp 85476a
+ 			else
Karsten Hopp 85476a
+ 			  func s:sw()
Karsten Hopp 85476a
+ 			    return &sw
Karsten Hopp 85476a
+ 			  endfunc
Karsten Hopp 85476a
+ 			endif
Karsten Hopp 85476a
+ <		And then use s:sw() instead of &sw.
Karsten Hopp 85476a
+ 
Karsten Hopp 85476a
+ 
Karsten Hopp 85476a
  simplify({filename})					*simplify()*
Karsten Hopp 85476a
  		Simplify the file name as much as possible without changing
Karsten Hopp 85476a
  		the meaning.  Shortcuts (on MS-Windows) or symbolic links (on
Karsten Hopp 85476a
*** ../vim-7.3.693/src/eval.c	2012-08-08 14:33:16.000000000 +0200
Karsten Hopp 85476a
--- src/eval.c	2012-10-21 00:29:15.000000000 +0200
Karsten Hopp 85476a
***************
Karsten Hopp 85476a
*** 687,692 ****
Karsten Hopp 85476a
--- 687,693 ----
Karsten Hopp 85476a
  static void f_settabwinvar __ARGS((typval_T *argvars, typval_T *rettv));
Karsten Hopp 85476a
  static void f_setwinvar __ARGS((typval_T *argvars, typval_T *rettv));
Karsten Hopp 85476a
  static void f_shellescape __ARGS((typval_T *argvars, typval_T *rettv));
Karsten Hopp 85476a
+ static void f_shiftwidth __ARGS((typval_T *argvars, typval_T *rettv));
Karsten Hopp 85476a
  static void f_simplify __ARGS((typval_T *argvars, typval_T *rettv));
Karsten Hopp 85476a
  #ifdef FEAT_FLOAT
Karsten Hopp 85476a
  static void f_sin __ARGS((typval_T *argvars, typval_T *rettv));
Karsten Hopp 85476a
***************
Karsten Hopp 85476a
*** 8051,8056 ****
Karsten Hopp 85476a
--- 8052,8058 ----
Karsten Hopp 85476a
      {"settabwinvar",	4, 4, f_settabwinvar},
Karsten Hopp 85476a
      {"setwinvar",	3, 3, f_setwinvar},
Karsten Hopp 85476a
      {"shellescape",	1, 2, f_shellescape},
Karsten Hopp 85476a
+     {"shiftwidth",	0, 0, f_shiftwidth},
Karsten Hopp 85476a
      {"simplify",	1, 1, f_simplify},
Karsten Hopp 85476a
  #ifdef FEAT_FLOAT
Karsten Hopp 85476a
      {"sin",		1, 1, f_sin},
Karsten Hopp 85476a
***************
Karsten Hopp 85476a
*** 16652,16657 ****
Karsten Hopp 85476a
--- 16654,16670 ----
Karsten Hopp 85476a
  }
Karsten Hopp 85476a
  
Karsten Hopp 85476a
  /*
Karsten Hopp 85476a
+  * shiftwidth() function
Karsten Hopp 85476a
+  */
Karsten Hopp 85476a
+     static void
Karsten Hopp 85476a
+ f_shiftwidth(argvars, rettv)
Karsten Hopp 85476a
+     typval_T	*argvars;
Karsten Hopp 85476a
+     typval_T	*rettv;
Karsten Hopp 85476a
+ {
Karsten Hopp 85476a
+     rettv->vval.v_number = get_sw_value();
Karsten Hopp 85476a
+ }
Karsten Hopp 85476a
+ 
Karsten Hopp 85476a
+ /*
Karsten Hopp 85476a
   * "simplify()" function
Karsten Hopp 85476a
   */
Karsten Hopp 85476a
      static void
Karsten Hopp 85476a
*** ../vim-7.3.693/src/version.c	2012-10-21 00:10:29.000000000 +0200
Karsten Hopp 85476a
--- src/version.c	2012-10-21 00:30:27.000000000 +0200
Karsten Hopp 85476a
***************
Karsten Hopp 85476a
*** 721,722 ****
Karsten Hopp 85476a
--- 721,724 ----
Karsten Hopp 85476a
  {   /* Add new patch number below this line */
Karsten Hopp 85476a
+ /**/
Karsten Hopp 85476a
+     694,
Karsten Hopp 85476a
  /**/
Karsten Hopp 85476a
Karsten Hopp 85476a
-- 
Karsten Hopp 85476a
CRONE:  Who sent you?
Karsten Hopp 85476a
ARTHUR: The Knights Who Say GNU!
Karsten Hopp 85476a
CRONE:  Aaaagh!  (she looks around in rear) No!  We have no licenses here.
Karsten Hopp 85476a
           "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD
Karsten Hopp 85476a
Karsten Hopp 85476a
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 85476a
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 85476a
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 85476a
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///