From d3d3d650eff1be4272aa06978a1e59c249e1e104 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 27 Oct 2004 17:44:59 +0000 Subject: (mouse-show-mark): Do most processing the same regardless of transient-mark-mode. --- lisp/mouse.el | 97 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 49 insertions(+), 48 deletions(-) (limited to 'lisp') diff --git a/lisp/mouse.el b/lisp/mouse.el index abf62a9783..8632cceb19 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1025,54 +1025,55 @@ If MODE is 2 then do the same for lines." "List of keys which shall cause the mouse region to be deleted.") (defun mouse-show-mark () - (if transient-mark-mode - (delete-overlay mouse-drag-overlay) - (let ((inhibit-quit t) - (echo-keystrokes 0) - event events key ignore - x-lost-selection-hooks) - (add-hook 'x-lost-selection-hooks - (lambda (seltype) - (if (eq seltype 'PRIMARY) - (progn (setq ignore t) - (throw 'mouse-show-mark t))))) - (move-overlay mouse-drag-overlay (point) (mark t)) - (catch 'mouse-show-mark - ;; In this loop, execute scroll bar and switch-frame events. - ;; Also ignore down-events that are undefined. - (while (progn (setq event (read-event)) - (setq events (append events (list event))) - (setq key (apply 'vector events)) - (or (and (consp event) - (eq (car event) 'switch-frame)) - (and (consp event) - (eq (posn-point (event-end event)) - 'vertical-scroll-bar)) - (and (memq 'down (event-modifiers event)) - (not (key-binding key)) - (not (mouse-undouble-last-event events)) - (not (member key mouse-region-delete-keys))))) - (and (consp event) - (or (eq (car event) 'switch-frame) - (eq (posn-point (event-end event)) - 'vertical-scroll-bar)) - (let ((keys (vector 'vertical-scroll-bar event))) - (and (key-binding keys) - (progn - (call-interactively (key-binding keys) - nil keys) - (setq events nil))))))) - ;; If we lost the selection, just turn off the highlighting. - (if ignore - nil - ;; For certain special keys, delete the region. - (if (member key mouse-region-delete-keys) - (delete-region (overlay-start mouse-drag-overlay) - (overlay-end mouse-drag-overlay)) - ;; Otherwise, unread the key so it gets executed normally. - (setq unread-command-events - (nconc events unread-command-events)))) - (setq quit-flag nil) + (let ((inhibit-quit t) + (echo-keystrokes 0) + event events key ignore + (x-lost-selection-hooks (copy-sequence x-lost-selection-hooks))) + (add-hook 'x-lost-selection-hooks + (lambda (seltype) + (if (eq seltype 'PRIMARY) + (progn (setq ignore t) + (throw 'mouse-show-mark t))))) + (if transient-mark-mode + (delete-overlay mouse-drag-overlay) + (move-overlay mouse-drag-overlay (point) (mark t))) + (catch 'mouse-show-mark + ;; In this loop, execute scroll bar and switch-frame events. + ;; Also ignore down-events that are undefined. + (while (progn (setq event (read-event)) + (setq events (append events (list event))) + (setq key (apply 'vector events)) + (or (and (consp event) + (eq (car event) 'switch-frame)) + (and (consp event) + (eq (posn-point (event-end event)) + 'vertical-scroll-bar)) + (and (memq 'down (event-modifiers event)) + (not (key-binding key)) + (not (mouse-undouble-last-event events)) + (not (member key mouse-region-delete-keys))))) + (and (consp event) + (or (eq (car event) 'switch-frame) + (eq (posn-point (event-end event)) + 'vertical-scroll-bar)) + (let ((keys (vector 'vertical-scroll-bar event))) + (and (key-binding keys) + (progn + (call-interactively (key-binding keys) + nil keys) + (setq events nil))))))) + ;; If we lost the selection, just turn off the highlighting. + (if ignore + nil + ;; For certain special keys, delete the region. + (if (member key mouse-region-delete-keys) + (delete-region (overlay-start mouse-drag-overlay) + (overlay-end mouse-drag-overlay)) + ;; Otherwise, unread the key so it gets executed normally. + (setq unread-command-events + (nconc events unread-command-events)))) + (setq quit-flag nil) + (unless transient-mark-mode (delete-overlay mouse-drag-overlay)))) (defun mouse-set-mark (click) -- cgit v1.2.3