Karsten Hopp 7ba507
To: vim_dev@googlegroups.com
Karsten Hopp 7ba507
Subject: Patch 7.3.065
Karsten Hopp 7ba507
Fcc: outbox
Karsten Hopp 7ba507
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 7ba507
Mime-Version: 1.0
Karsten Hopp 7ba507
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 7ba507
Content-Transfer-Encoding: 8bit
Karsten Hopp 7ba507
------------
Karsten Hopp 7ba507
Karsten Hopp 7ba507
Patch 7.3.065
Karsten Hopp 7ba507
Problem:    Can't get current line number in a source file.
Karsten Hopp 7ba507
Solution:   Add the <slnum> item, similar to <sfile>.
Karsten Hopp 7ba507
Files:	    src/ex_docmd.c
Karsten Hopp 7ba507
Karsten Hopp 7ba507
Karsten Hopp 7ba507
*** ../vim-7.3.064/src/ex_docmd.c	2010-11-16 11:29:30.000000000 +0100
Karsten Hopp 7ba507
--- src/ex_docmd.c	2010-11-24 15:41:51.000000000 +0100
Karsten Hopp 7ba507
***************
Karsten Hopp 7ba507
*** 9538,9554 ****
Karsten Hopp 7ba507
  #define SPEC_CFILE  4
Karsten Hopp 7ba507
  		    "<sfile>",		/* ":so" file name */
Karsten Hopp 7ba507
  #define SPEC_SFILE  5
Karsten Hopp 7ba507
  #ifdef FEAT_AUTOCMD
Karsten Hopp 7ba507
  		    "<afile>",		/* autocommand file name */
Karsten Hopp 7ba507
! # define SPEC_AFILE 6
Karsten Hopp 7ba507
  		    "<abuf>",		/* autocommand buffer number */
Karsten Hopp 7ba507
! # define SPEC_ABUF  7
Karsten Hopp 7ba507
  		    "<amatch>",		/* autocommand match name */
Karsten Hopp 7ba507
! # define SPEC_AMATCH 8
Karsten Hopp 7ba507
  #endif
Karsten Hopp 7ba507
  #ifdef FEAT_CLIENTSERVER
Karsten Hopp 7ba507
  		    "<client>"
Karsten Hopp 7ba507
! # define SPEC_CLIENT 9
Karsten Hopp 7ba507
  #endif
Karsten Hopp 7ba507
      };
Karsten Hopp 7ba507
  
Karsten Hopp 7ba507
--- 9538,9560 ----
Karsten Hopp 7ba507
  #define SPEC_CFILE  4
Karsten Hopp 7ba507
  		    "<sfile>",		/* ":so" file name */
Karsten Hopp 7ba507
  #define SPEC_SFILE  5
Karsten Hopp 7ba507
+ 		    "<slnum>",		/* ":so" file line number */
Karsten Hopp 7ba507
+ #define SPEC_SLNUM  6
Karsten Hopp 7ba507
  #ifdef FEAT_AUTOCMD
Karsten Hopp 7ba507
  		    "<afile>",		/* autocommand file name */
Karsten Hopp 7ba507
! # define SPEC_AFILE 7
Karsten Hopp 7ba507
  		    "<abuf>",		/* autocommand buffer number */
Karsten Hopp 7ba507
! # define SPEC_ABUF  8
Karsten Hopp 7ba507
  		    "<amatch>",		/* autocommand match name */
Karsten Hopp 7ba507
! # define SPEC_AMATCH 9
Karsten Hopp 7ba507
  #endif
Karsten Hopp 7ba507
  #ifdef FEAT_CLIENTSERVER
Karsten Hopp 7ba507
  		    "<client>"
Karsten Hopp 7ba507
! # ifdef FEAT_AUTOCMD
Karsten Hopp 7ba507
! #  define SPEC_CLIENT 10
Karsten Hopp 7ba507
! # else
Karsten Hopp 7ba507
! #  define SPEC_CLIENT 7
Karsten Hopp 7ba507
! # endif
Karsten Hopp 7ba507
  #endif
Karsten Hopp 7ba507
      };
Karsten Hopp 7ba507
  
Karsten Hopp 7ba507
***************
Karsten Hopp 7ba507
*** 9573,9578 ****
Karsten Hopp 7ba507
--- 9579,9585 ----
Karsten Hopp 7ba507
   *	  '<cWORD>' to WORD under the cursor
Karsten Hopp 7ba507
   *	  '<cfile>' to path name under the cursor
Karsten Hopp 7ba507
   *	  '<sfile>' to sourced file name
Karsten Hopp 7ba507
+  *	  '<slnum>' to sourced file line number
Karsten Hopp 7ba507
   *	  '<afile>' to file name for autocommand
Karsten Hopp 7ba507
   *	  '<abuf>'  to buffer number for autocommand
Karsten Hopp 7ba507
   *	  '<amatch>' to matching name for autocommand
Karsten Hopp 7ba507
***************
Karsten Hopp 7ba507
*** 9604,9613 ****
Karsten Hopp 7ba507
  #ifdef FEAT_MODIFY_FNAME
Karsten Hopp 7ba507
      int		skip_mod = FALSE;
Karsten Hopp 7ba507
  #endif
Karsten Hopp 7ba507
- 
Karsten Hopp 7ba507
- #if defined(FEAT_AUTOCMD) || defined(FEAT_CLIENTSERVER)
Karsten Hopp 7ba507
      char_u	strbuf[30];
Karsten Hopp 7ba507
- #endif
Karsten Hopp 7ba507
  
Karsten Hopp 7ba507
      *errormsg = NULL;
Karsten Hopp 7ba507
      if (escaped != NULL)
Karsten Hopp 7ba507
--- 9611,9617 ----
Karsten Hopp 7ba507
***************
Karsten Hopp 7ba507
*** 9796,9801 ****
Karsten Hopp 7ba507
--- 9800,9814 ----
Karsten Hopp 7ba507
  		    return NULL;
Karsten Hopp 7ba507
  		}
Karsten Hopp 7ba507
  		break;
Karsten Hopp 7ba507
+ 	case SPEC_SLNUM:	/* line in file for ":so" command */
Karsten Hopp 7ba507
+ 		if (sourcing_name == NULL || sourcing_lnum == 0)
Karsten Hopp 7ba507
+ 		{
Karsten Hopp 7ba507
+ 		    *errormsg = (char_u *)_("E842: no line number to use for \"<slnum>\"");
Karsten Hopp 7ba507
+ 		    return NULL;
Karsten Hopp 7ba507
+ 		}
Karsten Hopp 7ba507
+ 		sprintf((char *)strbuf, "%ld", (long)sourcing_lnum);
Karsten Hopp 7ba507
+ 		result = strbuf;
Karsten Hopp 7ba507
+ 		break;
Karsten Hopp 7ba507
  #if defined(FEAT_CLIENTSERVER)
Karsten Hopp 7ba507
  	case SPEC_CLIENT:	/* Source of last submitted input */
Karsten Hopp 7ba507
  		sprintf((char *)strbuf, PRINTF_HEX_LONG_U,
Karsten Hopp 7ba507
*** ../vim-7.3.064/src/version.c	2010-11-24 14:28:53.000000000 +0100
Karsten Hopp 7ba507
--- src/version.c	2010-11-24 15:49:57.000000000 +0100
Karsten Hopp 7ba507
***************
Karsten Hopp 7ba507
*** 716,717 ****
Karsten Hopp 7ba507
--- 716,719 ----
Karsten Hopp 7ba507
  {   /* Add new patch number below this line */
Karsten Hopp 7ba507
+ /**/
Karsten Hopp 7ba507
+     65,
Karsten Hopp 7ba507
  /**/
Karsten Hopp 7ba507
Karsten Hopp 7ba507
Karsten Hopp 7ba507
-- 
Karsten Hopp 7ba507
If you don't get everything you want, think of
Karsten Hopp 7ba507
everything you didn't get and don't want.
Karsten Hopp 7ba507
Karsten Hopp 7ba507
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 7ba507
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 7ba507
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 7ba507
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///