Mercurial > emacs
comparison lisp/mouse.el @ 12436:ffd777dc7d29
(mouse-selection-click-count-buffer): New variable.
(mouse-drag-region): Set it.
(mouse-save-then-kill): Test it.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 29 Jun 1995 22:19:13 +0000 |
parents | 8d2679d3f095 |
children | ce881909d36a |
comparison
equal
deleted
inserted
replaced
12435:44ef5c322c24 | 12436:ffd777dc7d29 |
---|---|
378 (delete-overlay mouse-drag-overlay) | 378 (delete-overlay mouse-drag-overlay) |
379 (overlay-put mouse-drag-overlay 'face 'region) | 379 (overlay-put mouse-drag-overlay 'face 'region) |
380 | 380 |
381 (defvar mouse-selection-click-count 0) | 381 (defvar mouse-selection-click-count 0) |
382 | 382 |
383 (defvar mouse-selection-click-count-buffer nil) | |
384 | |
383 (defun mouse-drag-region (start-event) | 385 (defun mouse-drag-region (start-event) |
384 "Set the region to the text that the mouse is dragged over. | 386 "Set the region to the text that the mouse is dragged over. |
385 Highlight the drag area as you move the mouse. | 387 Highlight the drag area as you move the mouse. |
386 This must be bound to a button-down mouse event. | 388 This must be bound to a button-down mouse event. |
387 In Transient Mark mode, the highlighting remains once you | 389 In Transient Mark mode, the highlighting remains once you |
398 (nth 3 bounds) | 400 (nth 3 bounds) |
399 ;; Don't count the mode line. | 401 ;; Don't count the mode line. |
400 (1- (nth 3 bounds)))) | 402 (1- (nth 3 bounds)))) |
401 (click-count (1- (event-click-count start-event)))) | 403 (click-count (1- (event-click-count start-event)))) |
402 (setq mouse-selection-click-count click-count) | 404 (setq mouse-selection-click-count click-count) |
405 (setq mouse-selection-click-count-buffer (current-buffer)) | |
403 (mouse-set-point start-event) | 406 (mouse-set-point start-event) |
404 (let ((range (mouse-start-end start-point start-point click-count))) | 407 (let ((range (mouse-start-end start-point start-point click-count))) |
405 (move-overlay mouse-drag-overlay (car range) (nth 1 range) | 408 (move-overlay mouse-drag-overlay (car range) (nth 1 range) |
406 (window-buffer start-window))) | 409 (window-buffer start-window))) |
407 (deactivate-mark) | 410 (deactivate-mark) |
653 (mouse-minibuffer-check click) | 656 (mouse-minibuffer-check click) |
654 (let ((click-posn (posn-point (event-start click))) | 657 (let ((click-posn (posn-point (event-start click))) |
655 ;; Don't let a subsequent kill command append to this one: | 658 ;; Don't let a subsequent kill command append to this one: |
656 ;; prevent setting this-command to kill-region. | 659 ;; prevent setting this-command to kill-region. |
657 (this-command this-command)) | 660 (this-command this-command)) |
658 (if (and (mark t) (> (mod mouse-selection-click-count 3) 0)) | 661 (if (and (save-excursion |
662 (set-buffer (window-buffer (posn-window (event-start click)))) | |
663 (and (mark t) (> (mod mouse-selection-click-count 3) 0) | |
664 ;; Don't be fooled by a recent click in some other buffer. | |
665 (eq mouse-selection-click-count-buffer | |
666 (current-buffer))))) | |
659 (if (not (and (eq last-command 'mouse-save-then-kill) | 667 (if (not (and (eq last-command 'mouse-save-then-kill) |
660 (equal click-posn | 668 (equal click-posn |
661 (car (cdr-safe (cdr-safe mouse-save-then-kill-posn)))))) | 669 (car (cdr-safe (cdr-safe mouse-save-then-kill-posn)))))) |
662 ;; Find both ends of the object selected by this click. | 670 ;; Find both ends of the object selected by this click. |
663 (let* ((range | 671 (let* ((range |