summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-07-12 17:03:13 +0000
committerRichard M. Stallman <rms@gnu.org>1994-07-12 17:03:13 +0000
commit6988cdacf940e9911381188735f3940b288091fa (patch)
treeba701a8547f5507d02c5de97ebc6cc6c08ddec12 /lisp/mouse.el
parent1501df8963f90fb01ee70f4238e10ad7cfe2a84f (diff)
downloademacs-6988cdacf940e9911381188735f3940b288091fa.tar.gz
(mouse-drag-secondary): Don't start making an overlay
when the range is empty. (mouse-secondary-save-then-kill): The first time, make a new kill ring entry.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el28
1 files changed, 20 insertions, 8 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index f7977689634..c43b25457c9 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -629,11 +629,14 @@ This must be bound to a button-down mouse event."
;; Are we moving within the original window?
((and (eq (posn-window end) start-window)
(integer-or-marker-p end-point))
- (set-marker mouse-secondary-start nil)
(let ((range (mouse-start-end start-point end-point
click-count)))
- (move-overlay mouse-secondary-overlay
- (car range) (nth 1 range))))
+ (if (or (/= start-point end-point)
+ (null (marker-position mouse-secondary-start)))
+ (progn
+ (set-marker mouse-secondary-start nil)
+ (move-overlay mouse-secondary-overlay
+ (car range) (nth 1 range))))))
(t
(let ((mouse-row (cdr (cdr (mouse-position)))))
(cond
@@ -787,11 +790,20 @@ again. If you do this twice in the same position, it kills the selection."
(overlay-start mouse-secondary-overlay)
click-posn))
(setq deactivate-mark nil)))
- (setcar kill-ring (buffer-substring
- (overlay-start mouse-secondary-overlay)
- (overlay-end mouse-secondary-overlay)))
- (if interprogram-cut-function
- (funcall interprogram-cut-function (car kill-ring))))
+ (if (eq last-command 'mouse-secondary-save-then-kill)
+ (progn
+ ;; If the front of the kill ring comes from
+ ;; an immediately previous use of this command,
+ ;; replace it with the extended region.
+ ;; (It would be annoying to make a separate entry.)
+ (setcar kill-ring
+ (buffer-substring
+ (overlay-start mouse-secondary-overlay)
+ (overlay-end mouse-secondary-overlay)))
+ (if interprogram-cut-function
+ (funcall interprogram-cut-function (car kill-ring))))
+ (copy-region-as-kill (overlay-start mouse-secondary-overlay)
+ (overlay-end mouse-secondary-overlay))))
(if mouse-secondary-start
;; All we have is one end of a selection,
;; so put the other end here.