Subject: Re: bug#9810: cw in viper mode clobbers clipboard

From: Bob Nnamtrop <[email-masked]>
Date: Sat, 29 Oct 2011 09:26:57 -0600

On Fri, Oct 28, 2011 at 11:37 PM, Chong Yidong <[email-masked]> wrote:
> Bob Nnamtrop <[email-masked]> writes:
>
>> I do not consider the selected word when one does 'cw' an active
>> region (in the usual emacs sense). It is a vi construct independent of
>> emacs active regions and so it need not honor the
>> select-active-regions setting.
>
> Could you test the following patch and see if it does what you expect?
>
> === modified file 'lisp/emulation/viper-cmd.el'
> *** lisp/emulation/viper-cmd.el 2011-07-09 19:32:42 +0000
> --- lisp/emulation/viper-cmd.el 2011-10-29 05:36:10 +0000
> ***************
> *** 1387,1393 ****
>        (insert " ")(backward-char 1)))
>    (if (= viper-com-point (point))
>        (viper-forward-char-carefully))
> !   (set-mark viper-com-point)
>    (if (eq m-com 'viper-next-line-at-bol)
>        (viper-enlarge-region (mark t) (point)))
>    (if (< (point) (mark t))
> --- 1387,1393 ----
>        (insert " ")(backward-char 1)))
>    (if (= viper-com-point (point))
>        (viper-forward-char-carefully))
> !   (push-mark viper-com-point t)
>    (if (eq m-com 'viper-next-line-at-bol)
>        (viper-enlarge-region (mark t) (point)))
>    (if (< (point) (mark t))
> ***************
> *** 1396,1403 ****
>        (viper-backward-char-carefully)) ; give back the newline
>    (if (eq viper-intermediate-command 'viper-repeat)
>        (viper-change-subr (mark t) (point))
> !     (viper-change (mark t) (point))
> !     ))
>
>  ;; this is invoked by viper-substitute-line
>  (defun viper-exec-Change (m-com com)
> --- 1396,1403 ----
>        (viper-backward-char-carefully)) ; give back the newline
>    (if (eq viper-intermediate-command 'viper-repeat)
>        (viper-change-subr (mark t) (point))
> !     (viper-change (mark t) (point)))
> !   (viper-deactivate-mark))
>
>  ;; this is invoked by viper-substitute-line
>  (defun viper-exec-Change (m-com com)
>
>

Yes, it makes cw work the way I expect even if select-active-regions is t.

Thanks,
Bob