comparison lisp/mouse.el @ 8224:1cc48bdd0c6b

(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.
author Richard M. Stallman <rms@gnu.org>
date Tue, 12 Jul 1994 17:03:13 +0000
parents f5c8a4e8c4a5
children 120d62d58330
comparison
equal deleted inserted replaced
8223:e82a71b09d7a 8224:1cc48bdd0c6b
627 ((eq (car-safe event) 'switch-frame)) 627 ((eq (car-safe event) 'switch-frame))
628 628
629 ;; Are we moving within the original window? 629 ;; Are we moving within the original window?
630 ((and (eq (posn-window end) start-window) 630 ((and (eq (posn-window end) start-window)
631 (integer-or-marker-p end-point)) 631 (integer-or-marker-p end-point))
632 (set-marker mouse-secondary-start nil)
633 (let ((range (mouse-start-end start-point end-point 632 (let ((range (mouse-start-end start-point end-point
634 click-count))) 633 click-count)))
635 (move-overlay mouse-secondary-overlay 634 (if (or (/= start-point end-point)
636 (car range) (nth 1 range)))) 635 (null (marker-position mouse-secondary-start)))
636 (progn
637 (set-marker mouse-secondary-start nil)
638 (move-overlay mouse-secondary-overlay
639 (car range) (nth 1 range))))))
637 (t 640 (t
638 (let ((mouse-row (cdr (cdr (mouse-position))))) 641 (let ((mouse-row (cdr (cdr (mouse-position)))))
639 (cond 642 (cond
640 ((null mouse-row)) 643 ((null mouse-row))
641 ((< mouse-row top) 644 ((< mouse-row top)
785 (overlay-end mouse-secondary-overlay)) 788 (overlay-end mouse-secondary-overlay))
786 (move-overlay mouse-secondary-overlay 789 (move-overlay mouse-secondary-overlay
787 (overlay-start mouse-secondary-overlay) 790 (overlay-start mouse-secondary-overlay)
788 click-posn)) 791 click-posn))
789 (setq deactivate-mark nil))) 792 (setq deactivate-mark nil)))
790 (setcar kill-ring (buffer-substring 793 (if (eq last-command 'mouse-secondary-save-then-kill)
791 (overlay-start mouse-secondary-overlay) 794 (progn
792 (overlay-end mouse-secondary-overlay))) 795 ;; If the front of the kill ring comes from
793 (if interprogram-cut-function 796 ;; an immediately previous use of this command,
794 (funcall interprogram-cut-function (car kill-ring)))) 797 ;; replace it with the extended region.
798 ;; (It would be annoying to make a separate entry.)
799 (setcar kill-ring
800 (buffer-substring
801 (overlay-start mouse-secondary-overlay)
802 (overlay-end mouse-secondary-overlay)))
803 (if interprogram-cut-function
804 (funcall interprogram-cut-function (car kill-ring))))
805 (copy-region-as-kill (overlay-start mouse-secondary-overlay)
806 (overlay-end mouse-secondary-overlay))))
795 (if mouse-secondary-start 807 (if mouse-secondary-start
796 ;; All we have is one end of a selection, 808 ;; All we have is one end of a selection,
797 ;; so put the other end here. 809 ;; so put the other end here.
798 (let ((start (+ 0 mouse-secondary-start))) 810 (let ((start (+ 0 mouse-secondary-start)))
799 (kill-ring-save start click-posn) 811 (kill-ring-save start click-posn)