tags:

views:

35

answers:

1

Hey,

I have the following function and keybinding in my .viper file:

(defun th-change-to-regexp (regexp)
  (interactive "s")
  (kill-region (point) (progn
                         (re-search-forward regexp nil nil 1)
                         (- (point) 1)))
  (backward-char)
  (viper-insert))

(define-key viper-vi-global-user-map "ct" 'th-change-to-regexp)

I'm getting the following error on the viper-insert command I think -

Wrong number of arguments: #[(arg) "Ä \210^H\211^X\204^M^@Å\202(^@^H:\203'@\203^^^@H
@Æ\232\203\"^@Å\202(^@^H@\202(^@^H)^YÇÈ ÉÊ\211\211¯^F!\210Ë=\203S@ \211^[ÌV
\205O^@ÊÍÎ\217\210^KS\211^S\202>^@)\202U^@Ï )\207"  
[arg val viper-intermediate-command count viper-set-complex-command-for-undo 1 (nil) 
viper-set-destructive-command viper-insert 114 ...] 8 ("/contrib/projects/emacs23/32bit
/share/emacs/23.1/lisp/emulation/viper-cmd.elc" . 54774) "P"], 0

Thanks

+2  A: 

I'm not a viper user, so I could be completely off about this, but viper-insert takes 1 required argument, and you are not giving it any arguments. You could send it the current prefix argument with

(viper-insert current-prefix-arg) 
haxney
That worked, thanks!
Sid