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