diff options
| author | Richard M. Stallman | 1996-06-03 17:21:03 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-06-03 17:21:03 +0000 |
| commit | c8f264ae68e5fd7ad3657953514247d77b282a8a (patch) | |
| tree | 0d6fbfa40a0fed1744b3b86d7e0b013dda8abc2a | |
| parent | 662463d904ef88b85055490ffb4a8b6b4d3d07df (diff) | |
| download | emacs-c8f264ae68e5fd7ad3657953514247d77b282a8a.tar.gz emacs-c8f264ae68e5fd7ad3657953514247d77b282a8a.zip | |
(mouse-show-mark): Use temporary highlighting if possible instead of a pause.
(mouse-drag-region): Use mouse-show-mark to do temp highlighting.
(mouse-save-then-kill): Call mouse-show-mark for a new selection
if we have a window system.
| -rw-r--r-- | lisp/mouse.el | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 00a53d6c8fc..351d9fcd1a9 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -578,12 +578,8 @@ remains active. Otherwise, it remains until the next input event." | |||
| 578 | (push-mark (overlay-start mouse-drag-overlay) t t) | 578 | (push-mark (overlay-start mouse-drag-overlay) t t) |
| 579 | (goto-char (overlay-end mouse-drag-overlay)) | 579 | (goto-char (overlay-end mouse-drag-overlay)) |
| 580 | (copy-region-as-kill (point) (mark t)) | 580 | (copy-region-as-kill (point) (mark t)) |
| 581 | (let ((inhibit-quit t)) | 581 | (mouse-show-mark) |
| 582 | (setq unread-command-events | 582 | (mouse-set-region-1)) |
| 583 | (cons (read-event) unread-command-events)) | ||
| 584 | (setq quit-flag nil)) | ||
| 585 | (mouse-set-region-1) | ||
| 586 | (delete-overlay mouse-drag-overlay)) | ||
| 587 | (goto-char (overlay-end mouse-drag-overlay)) | 583 | (goto-char (overlay-end mouse-drag-overlay)) |
| 588 | (setq this-command 'mouse-set-point) | 584 | (setq this-command 'mouse-set-point) |
| 589 | (delete-overlay mouse-drag-overlay)))) | 585 | (delete-overlay mouse-drag-overlay)))) |
| @@ -673,9 +669,22 @@ If DIR is positive skip forward; if negative, skip backward." | |||
| 673 | ;; Momentarily show where the mark is, if highlighting doesn't show it. | 669 | ;; Momentarily show where the mark is, if highlighting doesn't show it. |
| 674 | (defun mouse-show-mark () | 670 | (defun mouse-show-mark () |
| 675 | (or transient-mark-mode | 671 | (or transient-mark-mode |
| 676 | (save-excursion | 672 | (if window-system |
| 677 | (goto-char (mark t)) | 673 | (let ((inhibit-quit t) |
| 678 | (sit-for 1)))) | 674 | (echo-keystrokes 0) |
| 675 | event events) | ||
| 676 | (move-overlay mouse-drag-overlay (point) (mark t)) | ||
| 677 | (while (progn (setq event (read-event)) | ||
| 678 | (setq events (append events (list event))) | ||
| 679 | (and (memq 'down (event-modifiers event)) | ||
| 680 | (not (key-binding (apply 'vector events)))))) | ||
| 681 | (setq unread-command-events | ||
| 682 | (nconc events unread-command-events)) | ||
| 683 | (setq quit-flag nil) | ||
| 684 | (delete-overlay mouse-drag-overlay)) | ||
| 685 | (save-excursion | ||
| 686 | (goto-char (mark t)) | ||
| 687 | (sit-for 1))))) | ||
| 679 | 688 | ||
| 680 | (defun mouse-set-mark (click) | 689 | (defun mouse-set-mark (click) |
| 681 | "Set mark at the position clicked on with the mouse. | 690 | "Set mark at the position clicked on with the mouse. |
| @@ -833,6 +842,8 @@ If you do this twice in the same position, the selection is killed." | |||
| 833 | (mouse-save-then-kill-delete-region (point) (mark)) | 842 | (mouse-save-then-kill-delete-region (point) (mark)) |
| 834 | ;; After we kill, another click counts as "the first time". | 843 | ;; After we kill, another click counts as "the first time". |
| 835 | (setq mouse-save-then-kill-posn nil)) | 844 | (setq mouse-save-then-kill-posn nil)) |
| 845 | ;; This is not a repetition. | ||
| 846 | ;; We are adjusting an old selection or creating a new one. | ||
| 836 | (if (or (and (eq last-command 'mouse-save-then-kill) | 847 | (if (or (and (eq last-command 'mouse-save-then-kill) |
| 837 | mouse-save-then-kill-posn) | 848 | mouse-save-then-kill-posn) |
| 838 | (and mark-active transient-mark-mode) | 849 | (and mark-active transient-mark-mode) |
| @@ -859,7 +870,9 @@ If you do this twice in the same position, the selection is killed." | |||
| 859 | (if before-scroll | 870 | (if before-scroll |
| 860 | (goto-char before-scroll)) | 871 | (goto-char before-scroll)) |
| 861 | (exchange-point-and-mark) | 872 | (exchange-point-and-mark) |
| 862 | (kill-new (buffer-substring (point) (mark t)))) | 873 | (kill-new (buffer-substring (point) (mark t))) |
| 874 | (if window-system | ||
| 875 | (mouse-show-mark))) | ||
| 863 | (mouse-set-region-1) | 876 | (mouse-set-region-1) |
| 864 | (setq mouse-save-then-kill-posn | 877 | (setq mouse-save-then-kill-posn |
| 865 | (list (car kill-ring) (point) click-posn))))))) | 878 | (list (car kill-ring) (point) click-posn))))))) |