/[emacs]/emacs/lisp/mouse.el
ViewVC logotype

Diff of /emacs/lisp/mouse.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.241.8.4 by miles, Fri Oct 22 10:13:29 2004 UTC revision 1.241.8.5 by miles, Thu Nov 4 08:55:37 2004 UTC
# Line 1025  If MODE is 2 then do the same for lines. Line 1025  If MODE is 2 then do the same for lines.
1025    "List of keys which shall cause the mouse region to be deleted.")    "List of keys which shall cause the mouse region to be deleted.")
1026    
1027  (defun mouse-show-mark ()  (defun mouse-show-mark ()
1028    (if transient-mark-mode    (let ((inhibit-quit t)
1029        (delete-overlay mouse-drag-overlay)          (echo-keystrokes 0)
1030      (let ((inhibit-quit t)          event events key ignore
1031            (echo-keystrokes 0)          (x-lost-selection-functions
1032            event events key ignore           (when (boundp 'x-lost-selection-functions)
1033            x-lost-selection-hooks)             (copy-sequence x-lost-selection-functions))))
1034        (add-hook 'x-lost-selection-hooks      (add-hook 'x-lost-selection-functions
1035                  (lambda (seltype)                (lambda (seltype)
1036                    (if (eq seltype 'PRIMARY)                  (when (eq seltype 'PRIMARY)
1037                        (progn (setq ignore t)                    (setq ignore t)
1038                               (throw 'mouse-show-mark t)))))                    (throw 'mouse-show-mark t))))
1039        (move-overlay mouse-drag-overlay (point) (mark t))      (if transient-mark-mode
1040        (catch 'mouse-show-mark          (delete-overlay mouse-drag-overlay)
1041          ;; In this loop, execute scroll bar and switch-frame events.        (move-overlay mouse-drag-overlay (point) (mark t)))
1042          ;; Also ignore down-events that are undefined.      (catch 'mouse-show-mark
1043          (while (progn (setq event (read-event))        ;; In this loop, execute scroll bar and switch-frame events.
1044                        (setq events (append events (list event)))        ;; Also ignore down-events that are undefined.
1045                        (setq key (apply 'vector events))        (while (progn (setq event (read-event))
1046                        (or (and (consp event)                      (setq events (append events (list event)))
1047                                 (eq (car event) 'switch-frame))                      (setq key (apply 'vector events))
1048                            (and (consp event)                      (or (and (consp event)
1049                                 (eq (posn-point (event-end event))                               (eq (car event) 'switch-frame))
1050                                     'vertical-scroll-bar))                          (and (consp event)
1051                            (and (memq 'down (event-modifiers event))                               (eq (posn-point (event-end event))
1052                                 (not (key-binding key))                                   'vertical-scroll-bar))
1053                                 (not (mouse-undouble-last-event events))                          (and (memq 'down (event-modifiers event))
1054                                 (not (member key mouse-region-delete-keys)))))                               (not (key-binding key))
1055            (and (consp event)                               (not (mouse-undouble-last-event events))
1056                 (or (eq (car event) 'switch-frame)                               (not (member key mouse-region-delete-keys)))))
1057                     (eq (posn-point (event-end event))          (and (consp event)
1058                         'vertical-scroll-bar))               (or (eq (car event) 'switch-frame)
1059                 (let ((keys (vector 'vertical-scroll-bar event)))                   (eq (posn-point (event-end event))
1060                   (and (key-binding keys)                       'vertical-scroll-bar))
1061                        (progn               (let ((keys (vector 'vertical-scroll-bar event)))
1062                          (call-interactively (key-binding keys)                 (and (key-binding keys)
1063                                              nil keys)                      (progn
1064                          (setq events nil)))))))                        (call-interactively (key-binding keys)
1065        ;; If we lost the selection, just turn off the highlighting.                                            nil keys)
1066        (if ignore                        (setq events nil)))))))
1067            nil      ;; If we lost the selection, just turn off the highlighting.
1068          ;; For certain special keys, delete the region.      (unless ignore
1069          (if (member key mouse-region-delete-keys)        ;; For certain special keys, delete the region.
1070              (delete-region (overlay-start mouse-drag-overlay)        (if (member key mouse-region-delete-keys)
1071                             (overlay-end mouse-drag-overlay))            (delete-region (overlay-start mouse-drag-overlay)
1072            ;; Otherwise, unread the key so it gets executed normally.                           (overlay-end mouse-drag-overlay))
1073            (setq unread-command-events          ;; Otherwise, unread the key so it gets executed normally.
1074                  (nconc events unread-command-events))))          (setq unread-command-events
1075        (setq quit-flag nil)                (nconc events unread-command-events))))
1076        (setq quit-flag nil)
1077        (unless transient-mark-mode
1078        (delete-overlay mouse-drag-overlay))))        (delete-overlay mouse-drag-overlay))))
1079    
1080  (defun mouse-set-mark (click)  (defun mouse-set-mark (click)
# Line 1110  and set mark at the beginning. Line 1112  and set mark at the beginning.
1112  Prefix arguments are interpreted as with \\[yank].  Prefix arguments are interpreted as with \\[yank].
1113  If `mouse-yank-at-point' is non-nil, insert at point  If `mouse-yank-at-point' is non-nil, insert at point
1114  regardless of where you click."  regardless of where you click."
1115    (interactive "*e\nP")    (interactive "e\nP")
1116    ;; Give temporary modes such as isearch a chance to turn off.    ;; Give temporary modes such as isearch a chance to turn off.
1117    (run-hooks 'mouse-leave-buffer-hook)    (run-hooks 'mouse-leave-buffer-hook)
1118    (or mouse-yank-at-point (mouse-set-point click))    (or mouse-yank-at-point (mouse-set-point click))
# Line 1412  The function returns a non-nil value if Line 1414  The function returns a non-nil value if
1414  Move point to the end of the inserted text.  Move point to the end of the inserted text.
1415  If `mouse-yank-at-point' is non-nil, insert at point  If `mouse-yank-at-point' is non-nil, insert at point
1416  regardless of where you click."  regardless of where you click."
1417    (interactive "*e")    (interactive "e")
1418    ;; Give temporary modes such as isearch a chance to turn off.    ;; Give temporary modes such as isearch a chance to turn off.
1419    (run-hooks 'mouse-leave-buffer-hook)    (run-hooks 'mouse-leave-buffer-hook)
1420    (or mouse-yank-at-point (mouse-set-point click))    (or mouse-yank-at-point (mouse-set-point click))

Legend:
Removed from v.1.241.8.4  
changed lines
  Added in v.1.241.8.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26