Mercurial > emacs
comparison lisp/mouse.el @ 16016:2ee7579db4a9
(mouse-show-mark): Detect loss of selection
while we are showing it highlighted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 01 Sep 1996 02:42:04 +0000 |
parents | f063cae001ee |
children | 26b552f014ff |
comparison
equal
deleted
inserted
replaced
16015:f51aa92862ac | 16016:2ee7579db4a9 |
---|---|
741 (if window-system | 741 (if window-system |
742 (delete-overlay mouse-drag-overlay)) | 742 (delete-overlay mouse-drag-overlay)) |
743 (if window-system | 743 (if window-system |
744 (let ((inhibit-quit t) | 744 (let ((inhibit-quit t) |
745 (echo-keystrokes 0) | 745 (echo-keystrokes 0) |
746 event events key) | 746 event events key ignore |
747 x-lost-selection-hooks) | |
748 (add-hook 'x-lost-selection-hooks | |
749 '(lambda (seltype) | |
750 (if (eq seltype 'PRIMARY) | |
751 (progn (setq ignore t) | |
752 (throw 'mouse-show-mark t))))) | |
747 (move-overlay mouse-drag-overlay (point) (mark t)) | 753 (move-overlay mouse-drag-overlay (point) (mark t)) |
748 (while (progn (setq event (read-event)) | 754 (catch 'mouse-show-mark |
749 (setq events (append events (list event))) | 755 (while (progn (setq event (read-event)) |
750 (setq key (apply 'vector events)) | 756 (setq events (append events (list event))) |
751 (and (memq 'down (event-modifiers event)) | 757 (setq key (apply 'vector events)) |
752 (not (key-binding key)) | 758 (and (memq 'down (event-modifiers event)) |
753 (not (member key mouse-region-delete-keys)) | 759 (not (key-binding key)) |
754 (not (mouse-undouble-last-event events))))) | 760 (not (member key mouse-region-delete-keys)) |
755 ;; For certain special keys, delete the region. | 761 (not (mouse-undouble-last-event events)))))) |
756 (if (member key mouse-region-delete-keys) | 762 ;; If we lost the selection, just turn off the highlighting. |
757 (delete-region (overlay-start mouse-drag-overlay) | 763 (if ignore |
758 (overlay-end mouse-drag-overlay)) | 764 nil |
759 ;; Otherwise, unread the key so it gets executed normally. | 765 ;; For certain special keys, delete the region. |
760 (setq unread-command-events | 766 (if (member key mouse-region-delete-keys) |
761 (nconc events unread-command-events))) | 767 (delete-region (overlay-start mouse-drag-overlay) |
768 (overlay-end mouse-drag-overlay)) | |
769 ;; Otherwise, unread the key so it gets executed normally. | |
770 (setq unread-command-events | |
771 (nconc events unread-command-events)))) | |
762 (setq quit-flag nil) | 772 (setq quit-flag nil) |
763 (delete-overlay mouse-drag-overlay)) | 773 (delete-overlay mouse-drag-overlay)) |
764 (save-excursion | 774 (save-excursion |
765 (goto-char (mark t)) | 775 (goto-char (mark t)) |
766 (sit-for 1))))) | 776 (sit-for 1))))) |