[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r101357: Respect mouse-drag-copy-regi
From: |
David De La Harpe Golden |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r101357: Respect mouse-drag-copy-region upon mouse-3 region adjustment. |
Date: |
Sun, 05 Sep 2010 23:40:57 +0100 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 101357
committer: David De La Harpe Golden <address@hidden>
branch nick: trunk
timestamp: Sun 2010-09-05 23:40:57 +0100
message:
Respect mouse-drag-copy-region upon mouse-3 region adjustment.
* mouse.el (mouse-save-then-kill): Save region to kill-ring when
mouse-drag-copy-region is non-nil (Bug#6956).
modified:
lisp/ChangeLog
lisp/mouse.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-09-05 21:28:50 +0000
+++ b/lisp/ChangeLog 2010-09-05 22:40:57 +0000
@@ -1,3 +1,8 @@
+2010-09-05 David De La Harpe Golden <address@hidden>
+
+ * mouse.el (mouse-save-then-kill): Save region to kill-ring
+ when mouse-drag-copy-region is non-nil (Bug#6956).
+
2010-09-05 Chong Yidong <address@hidden>
* dired.el (dired-ls-sorting-switches, dired-sort-by-name-regexp):
=== modified file 'lisp/mouse.el'
--- a/lisp/mouse.el 2010-08-29 16:17:13 +0000
+++ b/lisp/mouse.el 2010-09-05 22:40:57 +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 in 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
+ ;; 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)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r101357: Respect mouse-drag-copy-region upon mouse-3 region adjustment.,
David De La Harpe Golden <=