Subject: bug#6956: 24.0.50; pasting mouse selection in other session pastes only first word

From: Chong Yidong <[email-masked]>
Date: Sat, 04 Sep 2010 21:53:46 -0400

Thanks, the patch looks generally OK, except for the following:

>  (defcustom mouse-drag-copy-region nil
> -  "If non-nil, mouse drag copies region to kill-ring."
> +  "If non-nil, copy to kill-ring upon mouse adjustments of the region.
> +
> +For consistency this affects both actual mouse drag operations and
> +`mouse-save-then-kill' (\\[mouse-save-then-kill]) operations that
> +change the region."

It is sufficient to say "This affects `mouse-save-then-kill'
(\\[mouse-save-then-kill]) in addition to mouse drags."

>  If the region is inactive, activate it temporarily.  Set mark at
>  the original point, and move point to the position of CLICK.
> +If `mouse-drag-copy-region' is non-nil, also save the region
> +to the kill ring.
>
>  If the region is already active, adjust it.  Normally, do this by
>  moving point or mark, whichever is closer, to CLICK.  But if you
>  have selected whole words or lines, move point or mark to the
>  word or line boundary closest to CLICK instead.
> +If `mouse-drag-copy-region' is non-nil, also save the region
> +to the kill ring, replacing the previous kill corresponding
> +to the already active region.

We don't need to explain what mouse-drag-copy-region does twice.
Just add a separate paragraph saying

  If `mouse-drag-copy-region' is non-nil, this command also saves the
  region to the kill ring, replacing the previous kill if it was also
  made with `mouse-save-then-kill'.

>  If this command is called a second consecutive time with the same
> -CLICK position, kill the region."
> +CLICK position, kill the region (or delete it
> +if `mouse-drag-copy-region' is non-nil - it will already
> +have been saved to the kill ring by the previous click.)"

Omit the part after the "-", it's not necessary.

> -      (kill-region (mark t) (point))
> +      (if mouse-drag-copy-region
> +          ;; region already saved the previous click,
> +          ;; don't make a duplicate entry, just delete
> +          (delete-region (mark t) (point))
> +        (kill-region (mark t) (point)))
> +      (setq deactivate-mark t)

What's the additional deactivate-mark for?