summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-08-27 01:03:35 +0000
committerRichard M. Stallman <rms@gnu.org>1996-08-27 01:03:35 +0000
commit7156c08ca87960234176ec308da58e4a2b2c5c3a (patch)
treed42fcfd806826e355160728f4ce0cc39717c1b5d /lisp/mouse.el
parent11e5349264beaae43e67ec264e9a11c9daace4e0 (diff)
downloademacs-7156c08ca87960234176ec308da58e4a2b2c5c3a.tar.gz
(mouse-region-delete-keys): New variable.
(mouse-show-mark): If one of those keys is next, delete the region.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el19
1 files changed, 15 insertions, 4 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index c10101bf64b..3a2ad550ead 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -732,6 +732,10 @@ If DIR is positive skip forward; if negative, skip backward."
nil)))
;; Momentarily show where the mark is, if highlighting doesn't show it.
+
+(defvar mouse-region-delete-keys '([delete])
+ "List of keys which shall cause the mouse region to be deleted.")
+
(defun mouse-show-mark ()
(if transient-mark-mode
(if window-system
@@ -739,15 +743,22 @@ If DIR is positive skip forward; if negative, skip backward."
(if window-system
(let ((inhibit-quit t)
(echo-keystrokes 0)
- event events)
+ event events key)
(move-overlay mouse-drag-overlay (point) (mark t))
(while (progn (setq event (read-event))
(setq events (append events (list event)))
+ (setq key (apply 'vector events))
(and (memq 'down (event-modifiers event))
- (not (key-binding (apply 'vector events)))
+ (not (key-binding key))
+ (not (member key mouse-region-delete-keys))
(not (mouse-undouble-last-event events)))))
- (setq unread-command-events
- (nconc events unread-command-events))
+ ;; 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)
(delete-overlay mouse-drag-overlay))
(save-excursion