aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1996-08-27 01:03:35 +0000
committerRichard M. Stallman1996-08-27 01:03:35 +0000
commit7aeb7370f3e160c4c39a594b257c43e871ec1d36 (patch)
tree0821e8a9e82d82cff1bed4744ff5be44a2e5d615 /lisp
parent2eb394c2cc0490d39119838f7d4d85b428a16fcb (diff)
downloademacs-7aeb7370f3e160c4c39a594b257c43e871ec1d36.tar.gz
emacs-7aeb7370f3e160c4c39a594b257c43e871ec1d36.zip
(mouse-region-delete-keys): New variable.
(mouse-show-mark): If one of those keys is next, delete the region.
Diffstat (limited to 'lisp')
-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."
732 nil))) 732 nil)))
733 733
734;; Momentarily show where the mark is, if highlighting doesn't show it. 734;; Momentarily show where the mark is, if highlighting doesn't show it.
735
736(defvar mouse-region-delete-keys '([delete])
737 "List of keys which shall cause the mouse region to be deleted.")
738
735(defun mouse-show-mark () 739(defun mouse-show-mark ()
736 (if transient-mark-mode 740 (if transient-mark-mode
737 (if window-system 741 (if window-system
@@ -739,15 +743,22 @@ If DIR is positive skip forward; if negative, skip backward."
739 (if window-system 743 (if window-system
740 (let ((inhibit-quit t) 744 (let ((inhibit-quit t)
741 (echo-keystrokes 0) 745 (echo-keystrokes 0)
742 event events) 746 event events key)
743 (move-overlay mouse-drag-overlay (point) (mark t)) 747 (move-overlay mouse-drag-overlay (point) (mark t))
744 (while (progn (setq event (read-event)) 748 (while (progn (setq event (read-event))
745 (setq events (append events (list event))) 749 (setq events (append events (list event)))
750 (setq key (apply 'vector events))
746 (and (memq 'down (event-modifiers event)) 751 (and (memq 'down (event-modifiers event))
747 (not (key-binding (apply 'vector events))) 752 (not (key-binding key))
753 (not (member key mouse-region-delete-keys))
748 (not (mouse-undouble-last-event events))))) 754 (not (mouse-undouble-last-event events)))))
749 (setq unread-command-events 755 ;; For certain special keys, delete the region.
750 (nconc events unread-command-events)) 756 (if (member key mouse-region-delete-keys)
757 (delete-region (overlay-start mouse-drag-overlay)
758 (overlay-end mouse-drag-overlay))
759 ;; Otherwise, unread the key so it gets executed normally.
760 (setq unread-command-events
761 (nconc events unread-command-events)))
751 (setq quit-flag nil) 762 (setq quit-flag nil)
752 (delete-overlay mouse-drag-overlay)) 763 (delete-overlay mouse-drag-overlay))
753 (save-excursion 764 (save-excursion