unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: David De La Harpe Golden <david@harpegolden.net>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: 6956@debbugs.gnu.org
Subject: bug#6956: 24.0.50; pasting mouse selection in other session pastes only first word
Date: Sun, 05 Sep 2010 15:36:58 +0100	[thread overview]
Message-ID: <4C83AB0A.8040605@harpegolden.net> (raw)
In-Reply-To: <87pqwtuf9x.fsf@stupidchicken.com>

[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]

On 05/09/10 02:53, Chong Yidong wrote:

> 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'.
>

^^^ Strictly that's not true, it also replaces kills made by mouse-drag 
i.e. an already active region (otherwise you would drag select a region 
with mouse-1, then mouse-3 extend, and you'd get two kill ring entries).

Here's one with revised doc phrasing.

...I haven't tried making shift-selection respect 
"mouse"-"drag"-copy-region as yet, but that should be straightforward 
given similarity to the "select-active-regions => 'only" code path. 
(It's not like I'm personally going to use mouse-drag-copy-region => t 
in any case....)

The customization name would then be kind of misleading, but, well, it 
has company.   Effectively, mouse-drag-copy-region would "really" be 
something like the (hypothetical) "clipboard-active-regions => 'only" in 
end effect, though probably implemented by hitting the kill ring and 
thus (maybe) the os clipboard as a side effect, so maybe
"killring-active-regions => 'only" would be more accurate.








[-- Attachment #2: mouse-save-then-kill-save-on-mdcr_r2.diff --]
[-- Type: text/x-patch, Size: 2288 bytes --]

=== modified file 'lisp/mouse.el'
--- lisp/mouse.el	2010-08-29 16:17:13 +0000
+++ lisp/mouse.el	2010-09-05 14:07:38 +0000
@@ -43,7 +43,10 @@
   :group 'mouse)
 
 (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.
+
+This affects `mouse-save-then-kill' (\\[mouse-save-then-kill]) in
+addition to mouse drags."
   :type 'boolean
   :version "24.1"
   :group 'mouse)
@@ -1348,8 +1351,13 @@
 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, this command also saves the
+new region to the kill ring (replacing the previous kill if the
+previous region was just saved to the kill ring).
+
 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)"
   (interactive "e")
   (mouse-minibuffer-check click)
   (let* ((posn     (event-start click))
@@ -1371,7 +1379,11 @@
      ((and (eq last-command 'mouse-save-then-kill)
 	   (eq click-pt mouse-save-then-kill-posn)
 	   (eq window (selected-window)))
-      (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 mouse-selection-click-count 0)
       (setq mouse-save-then-kill-posn nil))
 
@@ -1394,6 +1406,9 @@
 	  (goto-char (nth 1 range)))
 	(setq deactivate-mark nil)
 	(mouse-set-region-1)
+        (when mouse-drag-copy-region
+          ;; presumably region already copied to kill-ring once, so replace.
+          (kill-new (filter-buffer-substring (mark t) (point)) t))
 	;; Arrange for a repeated mouse-3 to kill the region.
 	(setq mouse-save-then-kill-posn click-pt)))
 
@@ -1405,6 +1420,8 @@
 	(if before-scroll (goto-char before-scroll)))
       (exchange-point-and-mark)
       (mouse-set-region-1)
+      (when mouse-drag-copy-region
+        (kill-new (filter-buffer-substring (mark t) (point))))
       (setq mouse-save-then-kill-posn click-pt)))))
 
 \f


  parent reply	other threads:[~2010-09-05 14:36 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31 16:48 bug#6956: 24.0.50; pasting mouse selection in other session pastes only first word Drew Adams
2010-08-31 17:26 ` Eli Zaretskii
2010-08-31 18:13   ` Chong Yidong
2010-09-01 14:38     ` Eli Zaretskii
2010-09-04  7:18       ` Eli Zaretskii
2010-09-04  8:35         ` Jan Djärv
2010-09-04 11:07           ` Eli Zaretskii
2010-09-04 15:06             ` Drew Adams
2010-09-04 15:44               ` Eli Zaretskii
2010-09-04 15:15             ` Jan Djärv
2010-09-04 19:09             ` Chong Yidong
2010-09-04 20:35               ` David De La Harpe Golden
2010-09-04 21:38                 ` David De La Harpe Golden
2010-09-05  1:53                   ` Chong Yidong
2010-09-05  5:33                     ` David De La Harpe Golden
2010-09-05 14:36                     ` David De La Harpe Golden [this message]
2010-09-05  3:09                   ` Eli Zaretskii
2010-09-05  4:48                     ` David De La Harpe Golden
2010-09-05  5:06                       ` Eli Zaretskii
2010-09-04 17:06           ` David De La Harpe Golden
2010-08-31 18:16   ` Drew Adams
2010-09-16 20:02 ` Eli Zaretskii
2010-09-16 23:51   ` Drew Adams
2010-09-17  8:01     ` Eli Zaretskii
     [not found]       ` <3BE2421F73AD4292AE8375CA3328663D@us.oracle.com>
2010-09-17 16:14         ` Eli Zaretskii
2010-09-17 16:20           ` Drew Adams
2010-09-17 17:03             ` Eli Zaretskii
2010-09-20 18:47               ` Drew Adams
2010-09-20 19:18                 ` Eli Zaretskii
2010-09-20 20:19                   ` Drew Adams
2010-09-20 20:43                   ` Drew Adams
2010-09-20 20:52                     ` Eli Zaretskii
2010-09-20 21:41                       ` Drew Adams
2010-09-20 21:53                         ` Eli Zaretskii
2010-09-20 22:24                           ` Drew Adams
2010-09-21  4:08                             ` Eli Zaretskii
2010-09-21 14:20                               ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C83AB0A.8040605@harpegolden.net \
    --to=david@harpegolden.net \
    --cc=6956@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).