diff options
| author | Richard M. Stallman <rms@gnu.org> | 1993-01-13 01:31:45 +0000 | 
|---|---|---|
| committer | Richard M. Stallman <rms@gnu.org> | 1993-01-13 01:31:45 +0000 | 
| commit | 40a45a9f94ff359b1285cc8720a55ee9a98c5972 (patch) | |
| tree | b78d9981fd422d81461b7c5dee5d5efbd3206fbf /lisp | |
| parent | 0601fd3d8f9dab900b9fdd7d840837a24530c138 (diff) | |
| download | emacs-40a45a9f94ff359b1285cc8720a55ee9a98c5972.tar.gz | |
(mouse-save-then-kill): When deleting, avoid delay
and don't set the mark.  Replace obsolete fn event-point.
(mouse-kill): Replace obsolete fn event-point.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/mouse.el | 34 | 
1 files changed, 19 insertions, 15 deletions
| diff --git a/lisp/mouse.el b/lisp/mouse.el index 810022e6463..27db7536758 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -154,7 +154,7 @@ This must be bound to a mouse click."    "Kill the region between point and the mouse click.  The text is saved in the kill ring, as with \\[kill-region]."    (interactive "e") -  (let ((click-posn (event-point click))) +  (let ((click-posn (posn-point (event-start click))))      (if (numberp click-posn)  	(kill-region (min (point) click-posn)  		     (max (point) click-posn))))) @@ -174,21 +174,25 @@ This does not delete the region; it acts like \\[kill-ring-save]."    (call-interactively 'kill-ring-save))  (defun mouse-save-then-kill (click) -  "Copy the region between point and the mouse click in the kill ring. -This does not delete the region; it acts like \\[kill-ring-save]." +  "Save text to point in kill ring; the second time, kill the text. +If the text between point and the mouse is the same as what's +at the front of the kill ring, this deletes the text. +Otherwise, it adds the text to the kill ring, like \\[kill-ring-save], +which prepares for a second click to delete the text."    (interactive "e") -  (mouse-set-mark click) -  (if (string= (buffer-substring (point) (mark)) (car kill-ring)) -      ;; If this text was already saved in kill ring, -      ;; now delete it from the buffer. -      (progn -	(let ((buffer-undo-list t)) -	  (delete-region (point) (mark))) -	;; Make the undo list by hand so it is shared. -	(setq buffer-undo-list -	      (cons (cons (car kill-ring) (point)) buffer-undo-list))) -    ;; Otherwise, save this region. -    (call-interactively 'kill-ring-save))) +  (let ((click-posn (posn-point (event-start click)))) +    (if (string= (buffer-substring (point) click-posn) (car kill-ring)) +	;; If this text was already saved in kill ring, +	;; now delete it from the buffer. +	(progn +	  (let ((buffer-undo-list t)) +	    (delete-region (point) (mark))) +	  ;; Make the undo list by hand so it is shared. +	  (setq buffer-undo-list +		(cons (cons (car kill-ring) (point)) buffer-undo-list))) +      ;; Otherwise, save this region. +      (mouse-set-mark click) +      (call-interactively 'kill-ring-save))))  (defun mouse-buffer-menu (event)    "Pop up a menu of buffers for selection with the mouse. | 
