Mercurial > emacs
comparison lisp/mouse.el @ 15941:f063cae001ee
(mouse-region-delete-keys): New variable.
(mouse-show-mark): If one of those keys is next, delete the region.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 27 Aug 1996 01:03:35 +0000 |
parents | 2fe76a330b1e |
children | 2ee7579db4a9 |
comparison
equal
deleted
inserted
replaced
15940:5f980c3b53e0 | 15941:f063cae001ee |
---|---|
730 t | 730 t |
731 (setcar last event) | 731 (setcar last event) |
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 |
738 (delete-overlay mouse-drag-overlay)) | 742 (delete-overlay mouse-drag-overlay)) |
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 |
754 (goto-char (mark t)) | 765 (goto-char (mark t)) |
755 (sit-for 1))))) | 766 (sit-for 1))))) |