Mercurial > emacs
comparison lisp/mouse.el @ 16318:86f1da650461
(mouse-drag-secondary): Make sure to return nil
if we don't make a selection.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 25 Sep 1996 03:27:04 +0000 |
parents | ba59fb4dd237 |
children | a0cfcb9f8033 |
comparison
equal
deleted
inserted
replaced
16317:763b3b143ed6 | 16318:86f1da650461 |
---|---|
1019 (overlay-put mouse-secondary-overlay 'face 'secondary-selection)))) | 1019 (overlay-put mouse-secondary-overlay 'face 'secondary-selection)))) |
1020 | 1020 |
1021 (defun mouse-drag-secondary (start-event) | 1021 (defun mouse-drag-secondary (start-event) |
1022 "Set the secondary selection to the text that the mouse is dragged over. | 1022 "Set the secondary selection to the text that the mouse is dragged over. |
1023 Highlight the drag area as you move the mouse. | 1023 Highlight the drag area as you move the mouse. |
1024 This must be bound to a button-down mouse event." | 1024 This must be bound to a button-down mouse event. |
1025 The function returns a non-nil value if it creates a secondary selection." | |
1025 (interactive "e") | 1026 (interactive "e") |
1026 (mouse-minibuffer-check start-event) | 1027 (mouse-minibuffer-check start-event) |
1027 (let* ((echo-keystrokes 0) | 1028 (let* ((echo-keystrokes 0) |
1028 (start-posn (event-start start-event)) | 1029 (start-posn (event-start start-event)) |
1029 (start-point (posn-point start-posn)) | 1030 (start-point (posn-point start-posn)) |
1090 ((>= mouse-row bottom) | 1091 ((>= mouse-row bottom) |
1091 (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) | 1092 (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) |
1092 mouse-secondary-overlay start-point))))))))) | 1093 mouse-secondary-overlay start-point))))))))) |
1093 | 1094 |
1094 (if (consp event) | 1095 (if (consp event) |
1095 ;;; (eq (get (event-basic-type event) 'event-kind) 'mouse-click) | |
1096 ;;; (eq (posn-window (event-end event)) start-window) | |
1097 ;;; (numberp (posn-point (event-end event))) | |
1098 (if (marker-position mouse-secondary-start) | 1096 (if (marker-position mouse-secondary-start) |
1099 (save-window-excursion | 1097 (save-window-excursion |
1100 (delete-overlay mouse-secondary-overlay) | 1098 (delete-overlay mouse-secondary-overlay) |
1101 (x-set-selection 'SECONDARY nil) | 1099 (x-set-selection 'SECONDARY nil) |
1102 (select-window start-window) | 1100 (select-window start-window) |
1103 (save-excursion | 1101 (save-excursion |
1104 (goto-char mouse-secondary-start) | 1102 (goto-char mouse-secondary-start) |
1105 (sit-for 1))) | 1103 (sit-for 1) |
1104 nil)) | |
1106 (x-set-selection | 1105 (x-set-selection |
1107 'SECONDARY | 1106 'SECONDARY |
1108 (buffer-substring (overlay-start mouse-secondary-overlay) | 1107 (buffer-substring (overlay-start mouse-secondary-overlay) |
1109 (overlay-end mouse-secondary-overlay))))))))) | 1108 (overlay-end mouse-secondary-overlay))))))))) |
1110 | 1109 |