Index: mouse.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/mouse.el,v retrieving revision 1.292 diff -b -c -c -r1.292 mouse.el *** mouse.el 1 Jan 2006 07:55:12 -0000 1.292 --- mouse.el 2 Jan 2006 21:06:17 -0000 *************** *** 765,771 **** (display-buffer (current-buffer))) ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) ! (mouse-drag-region-1 start-event)))) (defun mouse-on-link-p (pos) --- 765,771 ---- (display-buffer (current-buffer))) ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) ! (mouse-drag-track start-event t)))) (defun mouse-on-link-p (pos) *************** *** 865,871 **** (let ((range (mouse-start-end start end mode))) (move-overlay ol (car range) (nth 1 range)))) ! (defun mouse-drag-region-1 (start-event) (mouse-minibuffer-check start-event) (setq mouse-selection-click-count-buffer (current-buffer)) (let* ((original-window (selected-window)) --- 865,879 ---- (let ((range (mouse-start-end start end mode))) (move-overlay ol (car range) (nth 1 range)))) ! (defun mouse-drag-track (start-event &optional handle-terminating-event) ! "Track mouse drags by highlighting area between point and cursor. ! The region will be defined with mark and point. If ! HANDLE-TERMINATING-EVENT is set, after the drag completes, wait ! for and handle an additional terminating event (keypress, etc.), ! delete or copy the selected region to the kill buffer, follow ! links, etc. When HANDLE-TERMINATING-EVENT is nil, returns ! immediately after the drag completes, removing the ! overlay (unless transient mark mode is active)." (mouse-minibuffer-check start-event) (setq mouse-selection-click-count-buffer (current-buffer)) (let* ((original-window (selected-window)) *************** *** 949,959 **** (integer-or-marker-p end-point)) (mouse-move-drag-overlay mouse-drag-overlay start-point end-point click-count)) (if (consp event) (let* ((fun (key-binding (vector (car event)))) (do-multi-click (and (> (event-click-count event) 0) (functionp fun) ! (not (memq fun '(mouse-set-point mouse-set-region)))))) ;; Run the binding of the terminating up-event, if possible. (if (and (not (= (overlay-start mouse-drag-overlay) (overlay-end mouse-drag-overlay))) --- 957,970 ---- (integer-or-marker-p end-point)) (mouse-move-drag-overlay mouse-drag-overlay start-point end-point click-count)) + ;; Handle the terminating event (if (consp event) (let* ((fun (key-binding (vector (car event)))) (do-multi-click (and (> (event-click-count event) 0) (functionp fun) ! (not (memq fun ! '(mouse-set-point ! mouse-set-region)))))) ;; Run the binding of the terminating up-event, if possible. (if (and (not (= (overlay-start mouse-drag-overlay) (overlay-end mouse-drag-overlay))) *************** *** 977,982 **** --- 988,997 ---- last-command this-command) (push-mark region-commencement t t) (goto-char region-termination) + (if (not handle-terminating-event) + ;; Skip all post-event handling, return immediately. + (unless transient-mark-mode + (delete-overlay mouse-drag-overlay)) ;; Don't let copy-region-as-kill set deactivate-mark. (when mouse-drag-copy-region (let (deactivate-mark) *************** *** 989,995 **** ;; avoid trying to use the region. (and (mark t) mark-active (eq buffer (current-buffer)) ! (mouse-set-region-1)))) ;; Run the binding of the terminating up-event. ;; If a multiple click is not bound to mouse-set-point, ;; cancel the effects of mouse-move-drag-overlay to --- 1004,1010 ---- ;; avoid trying to use the region. (and (mark t) mark-active (eq buffer (current-buffer)) ! (mouse-set-region-1))))) ;; Run the binding of the terminating up-event. ;; If a multiple click is not bound to mouse-set-point, ;; cancel the effects of mouse-move-drag-overlay to