comparison lisp/mouse.el @ 21194:7a7950ffa79b

(mouse-drag-region): Bind deactivate-mark around call to copy-region-as-kill. (mouse-set-region): Likewise. (mouse-secondary-save-then-kill): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Mon, 16 Mar 1998 08:05:58 +0000
parents c42a2b3bbb21
children 4b4a4e32ffef
comparison
equal deleted inserted replaced
21193:20bba919ec72 21194:7a7950ffa79b
429 (if (numberp (posn-point end)) 429 (if (numberp (posn-point end))
430 (goto-char (posn-point end))) 430 (goto-char (posn-point end)))
431 ;; Don't set this-command to kill-region, so that a following 431 ;; Don't set this-command to kill-region, so that a following
432 ;; C-w will not double the text in the kill ring. 432 ;; C-w will not double the text in the kill ring.
433 ;; Ignore last-command so we don't append to a preceding kill. 433 ;; Ignore last-command so we don't append to a preceding kill.
434 (let (this-command last-command) 434 (let (this-command last-command deactivate-mark)
435 (copy-region-as-kill (mark) (point))) 435 (copy-region-as-kill (mark) (point)))
436 (mouse-set-region-1))) 436 (mouse-set-region-1)))
437 437
438 (defun mouse-set-region-1 () 438 (defun mouse-set-region-1 ()
439 (setq mouse-last-region-beg (region-beginning)) 439 (setq mouse-last-region-beg (region-beginning))
606 (overlay-start mouse-drag-overlay)) 606 (overlay-start mouse-drag-overlay))
607 region-termination)) 607 region-termination))
608 last-command this-command) 608 last-command this-command)
609 (push-mark region-commencement t t) 609 (push-mark region-commencement t t)
610 (goto-char region-termination) 610 (goto-char region-termination)
611 (copy-region-as-kill (point) (mark t)) 611 ;; Don't let copy-region-as-kill set deactivate-mark.
612 (let (deactivate-mark)
613 (copy-region-as-kill (point) (mark t)))
612 (let ((buffer (current-buffer))) 614 (let ((buffer (current-buffer)))
613 (mouse-show-mark) 615 (mouse-show-mark)
614 ;; mouse-show-mark can call read-event, 616 ;; mouse-show-mark can call read-event,
615 ;; and that means the Emacs server could switch buffers 617 ;; and that means the Emacs server could switch buffers
616 ;; under us. If that happened, 618 ;; under us. If that happened,
1277 ;; replace it with the extended region. 1279 ;; replace it with the extended region.
1278 ;; (It would be annoying to make a separate entry.) 1280 ;; (It would be annoying to make a separate entry.)
1279 (kill-new (buffer-substring 1281 (kill-new (buffer-substring
1280 (overlay-start mouse-secondary-overlay) 1282 (overlay-start mouse-secondary-overlay)
1281 (overlay-end mouse-secondary-overlay)) t) 1283 (overlay-end mouse-secondary-overlay)) t)
1282 (copy-region-as-kill (overlay-start mouse-secondary-overlay) 1284 (let (deactivate-mark)
1283 (overlay-end mouse-secondary-overlay)))) 1285 (copy-region-as-kill (overlay-start mouse-secondary-overlay)
1286 (overlay-end mouse-secondary-overlay)))))
1284 (if mouse-secondary-start 1287 (if mouse-secondary-start
1285 ;; All we have is one end of a selection, 1288 ;; All we have is one end of a selection,
1286 ;; so put the other end here. 1289 ;; so put the other end here.
1287 (let ((start (+ 0 mouse-secondary-start))) 1290 (let ((start (+ 0 mouse-secondary-start)))
1288 (kill-ring-save start click-posn) 1291 (kill-ring-save start click-posn)