20001a0
To: vim_dev@googlegroups.com
20001a0
Subject: Patch 7.3.054
20001a0
Fcc: outbox
20001a0
From: Bram Moolenaar <Bram@moolenaar.net>
20001a0
Mime-Version: 1.0
20001a0
Content-Type: text/plain; charset=UTF-8
20001a0
Content-Transfer-Encoding: 8bit
20001a0
------------
20001a0
20001a0
Patch 7.3.054
20001a0
Problem:    Can define a user command for :Print, but it doesn't work. (Aaron
20001a0
	    Thoma)
20001a0
Solution:   Let user command :Print overrule the builtin command (Christian
20001a0
	    Brabandt)  Disallow :X and :Next as a user defined command.
20001a0
Files:	    src/ex_docmd.c
20001a0
20001a0
20001a0
*** ../vim-7.3.053/src/ex_docmd.c	2010-10-13 17:50:02.000000000 +0200
20001a0
--- src/ex_docmd.c	2010-11-10 18:33:18.000000000 +0100
20001a0
***************
20001a0
*** 2871,2878 ****
20001a0
  	    }
20001a0
  
20001a0
  #ifdef FEAT_USR_CMDS
20001a0
! 	/* Look for a user defined command as a last resort */
20001a0
! 	if (eap->cmdidx == CMD_SIZE && *eap->cmd >= 'A' && *eap->cmd <= 'Z')
20001a0
  	{
20001a0
  	    /* User defined commands may contain digits. */
20001a0
  	    while (ASCII_ISALNUM(*p))
20001a0
--- 2871,2880 ----
20001a0
  	    }
20001a0
  
20001a0
  #ifdef FEAT_USR_CMDS
20001a0
! 	/* Look for a user defined command as a last resort.  Let ":Print" be
20001a0
! 	 * overruled by a user defined command. */
20001a0
! 	if ((eap->cmdidx == CMD_SIZE || eap->cmdidx == CMD_Print)
20001a0
! 		&& *eap->cmd >= 'A' && *eap->cmd <= 'Z')
20001a0
  	{
20001a0
  	    /* User defined commands may contain digits. */
20001a0
  	    while (ASCII_ISALNUM(*p))
20001a0
***************
20001a0
*** 5588,5593 ****
20001a0
--- 5590,5596 ----
20001a0
      int	    compl = EXPAND_NOTHING;
20001a0
      char_u  *compl_arg = NULL;
20001a0
      int	    has_attr = (eap->arg[0] == '-');
20001a0
+     int	    name_len;
20001a0
  
20001a0
      p = eap->arg;
20001a0
  
20001a0
***************
20001a0
*** 5613,5618 ****
20001a0
--- 5616,5622 ----
20001a0
  	return;
20001a0
      }
20001a0
      end = p;
20001a0
+     name_len = (int)(end - name);
20001a0
  
20001a0
      /* If there is nothing after the name, and no attributes were specified,
20001a0
       * we are listing commands
20001a0
***************
20001a0
*** 5627,5632 ****
20001a0
--- 5631,5643 ----
20001a0
  	EMSG(_("E183: User defined commands must start with an uppercase letter"));
20001a0
  	return;
20001a0
      }
20001a0
+     else if ((name_len == 1 && *name == 'X')
20001a0
+ 	  || (name_len <= 4
20001a0
+ 		  && STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0))
20001a0
+     {
20001a0
+ 	EMSG(_("E841: Reserved name, cannot be used for user defined command"));
20001a0
+ 	return;
20001a0
+     }
20001a0
      else
20001a0
  	uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
20001a0
  								eap->forceit);
20001a0
***************
20001a0
*** 9394,9400 ****
20001a0
  ex_ptag(eap)
20001a0
      exarg_T	*eap;
20001a0
  {
20001a0
!     g_do_tagpreview = p_pvh;
20001a0
      ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1);
20001a0
  }
20001a0
  
20001a0
--- 9405,9411 ----
20001a0
  ex_ptag(eap)
20001a0
      exarg_T	*eap;
20001a0
  {
20001a0
!     g_do_tagpreview = p_pvh;  /* will be reset to 0 in ex_tag_cmd() */
20001a0
      ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1);
20001a0
  }
20001a0
  
20001a0
*** ../vim-7.3.053/src/version.c	2010-11-10 17:11:29.000000000 +0100
20001a0
--- src/version.c	2010-11-10 18:58:28.000000000 +0100
20001a0
***************
20001a0
*** 716,717 ****
20001a0
--- 716,719 ----
20001a0
  {   /* Add new patch number below this line */
20001a0
+ /**/
20001a0
+     54,
20001a0
  /**/
20001a0
20001a0
-- 
20001a0
You can be stopped by the police for biking over 65 miles per hour.
20001a0
You are not allowed to walk across a street on your hands.
20001a0
		[real standing laws in Connecticut, United States of America]
20001a0
20001a0
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
20001a0
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
20001a0
\\\        download, build and distribute -- http://www.A-A-P.org        ///
20001a0
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///