aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader1996-07-07 01:59:10 +0000
committerMiles Bader1996-07-07 01:59:10 +0000
commit98aac09d3aabc7efa4fb216181abc9c5daab4529 (patch)
tree8df515f3f7811619374e0e39cf0a1f5d07214122
parentb64451351167ead8202f2856dd1a160ede3714dc (diff)
downloademacs-98aac09d3aabc7efa4fb216181abc9c5daab4529.tar.gz
emacs-98aac09d3aabc7efa4fb216181abc9c5daab4529.zip
(mouse-show-mark): In transient mark mode, delete mouse-drag-overlay.
(mouse-undouble-last-event): New function. (mouse-show-mark): Call mouse-undouble-last-event.
-rw-r--r--lisp/mouse.el52
1 files changed, 36 insertions, 16 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 23f5c192e3f..1f99e41840d 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -704,25 +704,45 @@ If DIR is positive skip forward; if negative, skip backward."
704 (if (numberp (posn-point posn)) 704 (if (numberp (posn-point posn))
705 (push-mark (posn-point posn) t t)))) 705 (push-mark (posn-point posn) t t))))
706 706
707(defun mouse-undouble-last-event (events)
708 (let* ((index (1- (length events)))
709 (last (nthcdr index events))
710 (event (car last))
711 (basic (event-basic-type event))
712 (modifiers (delq 'double (delq 'triple (copy-sequence (event-modifiers event)))))
713 (new
714 (if (consp event)
715 (cons (event-convert-list (nreverse (cons basic modifiers)))
716 (cdr event))
717 event)))
718 (setcar last new)
719 (if (key-binding (apply 'vector events))
720 t
721 (setcar last event)
722 nil)))
723
707;; Momentarily show where the mark is, if highlighting doesn't show it. 724;; Momentarily show where the mark is, if highlighting doesn't show it.
708(defun mouse-show-mark () 725(defun mouse-show-mark ()
709 (or transient-mark-mode 726 (if transient-mark-mode
710 (if window-system 727 (if window-system
711 (let ((inhibit-quit t) 728 (delete-overlay mouse-drag-overlay))
712 (echo-keystrokes 0) 729 (if window-system
713 event events) 730 (let ((inhibit-quit t)
714 (move-overlay mouse-drag-overlay (point) (mark t)) 731 (echo-keystrokes 0)
715 (while (progn (setq event (read-event)) 732 event events)
716 (setq events (append events (list event))) 733 (move-overlay mouse-drag-overlay (point) (mark t))
717 (and (memq 'down (event-modifiers event)) 734 (while (progn (setq event (read-event))
718 (not (key-binding (apply 'vector events)))))) 735 (setq events (append events (list event)))
719 (setq unread-command-events 736 (and (memq 'down (event-modifiers event))
720 (nconc events unread-command-events)) 737 (not (key-binding (apply 'vector events)))
721 (setq quit-flag nil) 738 (not (mouse-undouble-last-event events)))))
722 (delete-overlay mouse-drag-overlay)) 739 (setq unread-command-events
723 (save-excursion 740 (nconc events unread-command-events))
724 (goto-char (mark t)) 741 (setq quit-flag nil)
725 (sit-for 1))))) 742 (delete-overlay mouse-drag-overlay))
743 (save-excursion
744 (goto-char (mark t))
745 (sit-for 1)))))
726 746
727(defun mouse-set-mark (click) 747(defun mouse-set-mark (click)
728 "Set mark at the position clicked on with the mouse. 748 "Set mark at the position clicked on with the mouse.