Mercurial > emacs
comparison lisp/mouse.el @ 8765:77933f36ddc2
(mouse-save-then-kill, mouse-secondary-save-then-kill): Use the kill-new
interface; don't manipulate kill-ring directly.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 15 Sep 1994 21:51:14 +0000 |
parents | a446d13c46ea |
children | 06864fef4ec3 |
comparison
equal
deleted
inserted
replaced
8764:878de309ab95 | 8765:77933f36ddc2 |
---|---|
577 (set-mark (car range)) | 577 (set-mark (car range)) |
578 (goto-char (nth 1 range))) | 578 (goto-char (nth 1 range))) |
579 ;; We have already put the old region in the kill ring. | 579 ;; We have already put the old region in the kill ring. |
580 ;; Replace it with the extended region. | 580 ;; Replace it with the extended region. |
581 ;; (It would be annoying to make a separate entry.) | 581 ;; (It would be annoying to make a separate entry.) |
582 (setcar kill-ring (buffer-substring (point) (mark t))) | 582 (kill-new (buffer-substring (point) (mark t)) t) |
583 (if interprogram-cut-function | |
584 (funcall interprogram-cut-function (car kill-ring))) | |
585 ;; Arrange for a repeated mouse-3 to kill this region. | 583 ;; Arrange for a repeated mouse-3 to kill this region. |
586 (setq mouse-save-then-kill-posn | 584 (setq mouse-save-then-kill-posn |
587 (list (car kill-ring) (point) click-posn)) | 585 (list (car kill-ring) (point) click-posn)) |
588 (mouse-show-mark)) | 586 (mouse-show-mark)) |
589 ;; If we click this button again without moving it, | 587 ;; If we click this button again without moving it, |
617 ;; That is what xterm does, and it seems reasonable. | 615 ;; That is what xterm does, and it seems reasonable. |
618 (if (< (abs (- new (point))) (abs (- new (mark t)))) | 616 (if (< (abs (- new (point))) (abs (- new (mark t)))) |
619 (goto-char new) | 617 (goto-char new) |
620 (set-mark new)) | 618 (set-mark new)) |
621 (setq deactivate-mark nil))) | 619 (setq deactivate-mark nil))) |
622 (setcar kill-ring (buffer-substring (point) (mark t))) | 620 (kill-new (buffer-substring (point) (mark t)) t)) |
623 (if interprogram-cut-function | |
624 (funcall interprogram-cut-function (car kill-ring)))) | |
625 ;; We just have point, so set mark here. | 621 ;; We just have point, so set mark here. |
626 (mouse-set-mark-fast click) | 622 (mouse-set-mark-fast click) |
627 (kill-ring-save (point) (mark t)) | 623 (kill-ring-save (point) (mark t)) |
628 (mouse-show-mark)) | 624 (mouse-show-mark)) |
629 (setq mouse-save-then-kill-posn | 625 (setq mouse-save-then-kill-posn |
847 (overlay-start mouse-secondary-overlay) | 843 (overlay-start mouse-secondary-overlay) |
848 (nth 1 range))) | 844 (nth 1 range))) |
849 ;; We have already put the old region in the kill ring. | 845 ;; We have already put the old region in the kill ring. |
850 ;; Replace it with the extended region. | 846 ;; Replace it with the extended region. |
851 ;; (It would be annoying to make a separate entry.) | 847 ;; (It would be annoying to make a separate entry.) |
852 (setcar kill-ring (buffer-substring | 848 (kill-new (buffer-substring |
853 (overlay-start mouse-secondary-overlay) | 849 (overlay-start mouse-secondary-overlay) |
854 (overlay-end mouse-secondary-overlay))) | 850 (overlay-end mouse-secondary-overlay)) t) |
855 (if interprogram-cut-function | |
856 (funcall interprogram-cut-function (car kill-ring))) | |
857 ;; Arrange for a repeated mouse-3 to kill this region. | 851 ;; Arrange for a repeated mouse-3 to kill this region. |
858 (setq mouse-save-then-kill-posn | 852 (setq mouse-save-then-kill-posn |
859 (list (car kill-ring) (point) click-posn))) | 853 (list (car kill-ring) (point) click-posn))) |
860 ;; If we click this button again without moving it, | 854 ;; If we click this button again without moving it, |
861 ;; that time kill. | 855 ;; that time kill. |
892 (move-overlay mouse-secondary-overlay | 886 (move-overlay mouse-secondary-overlay |
893 (overlay-start mouse-secondary-overlay) | 887 (overlay-start mouse-secondary-overlay) |
894 click-posn)) | 888 click-posn)) |
895 (setq deactivate-mark nil))) | 889 (setq deactivate-mark nil))) |
896 (if (eq last-command 'mouse-secondary-save-then-kill) | 890 (if (eq last-command 'mouse-secondary-save-then-kill) |
897 (progn | 891 ;; If the front of the kill ring comes from |
898 ;; If the front of the kill ring comes from | 892 ;; an immediately previous use of this command, |
899 ;; an immediately previous use of this command, | 893 ;; replace it with the extended region. |
900 ;; replace it with the extended region. | 894 ;; (It would be annoying to make a separate entry.) |
901 ;; (It would be annoying to make a separate entry.) | 895 (kill-new (buffer-substring |
902 (setcar kill-ring | |
903 (buffer-substring | |
904 (overlay-start mouse-secondary-overlay) | 896 (overlay-start mouse-secondary-overlay) |
905 (overlay-end mouse-secondary-overlay))) | 897 (overlay-end mouse-secondary-overlay)) t) |
906 (if interprogram-cut-function | |
907 (funcall interprogram-cut-function (car kill-ring)))) | |
908 (copy-region-as-kill (overlay-start mouse-secondary-overlay) | 898 (copy-region-as-kill (overlay-start mouse-secondary-overlay) |
909 (overlay-end mouse-secondary-overlay)))) | 899 (overlay-end mouse-secondary-overlay)))) |
910 (if mouse-secondary-start | 900 (if mouse-secondary-start |
911 ;; All we have is one end of a selection, | 901 ;; All we have is one end of a selection, |
912 ;; so put the other end here. | 902 ;; so put the other end here. |