• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/emulation/

Lines Matching defs:mouse

1 ;;; viper-mous.el --- mouse support for Viper
33 (defvar mouse-track-multi-click-time)
55 (defgroup viper-mouse nil
56 "Support for Viper special mouse-bound commands."
66 ;; one. Used by viper-mouse-click-get-word. Not a user option.
78 :group 'viper-mouse)
84 mouse-track-multi-click-time
87 "*Time interval in millisecond within which successive mouse clicks are
90 :group 'viper-mouse)
98 (viper-deflocalvar viper-mouse-click-search-noerror t)
101 (viper-deflocalvar viper-mouse-click-search-limit nil)
111 (defvar viper-mouse-up-search-key-parsed nil)
112 (defvar viper-mouse-down-search-key-parsed nil)
113 (defvar viper-mouse-up-insert-key-parsed nil)
114 (defvar viper-mouse-down-insert-key-parsed nil)
126 (defun viper-mouse-click-window (click)
136 (defsubst viper-mouse-click-frame (click)
137 (window-frame (viper-mouse-click-window click)))
140 (defsubst viper-mouse-click-window-buffer (click)
141 (window-buffer (viper-mouse-click-window click)))
144 (defsubst viper-mouse-click-window-buffer-name (click)
145 (buffer-name (viper-mouse-click-window-buffer click)))
148 (defsubst viper-mouse-click-posn (click)
238 (defun viper-mouse-click-get-word (click count click-count)
239 "Returns word surrounding the position of a mouse click.
245 (click-pos (viper-mouse-click-posn click))
246 (click-buf (viper-mouse-click-window-buffer click)))
263 (defun viper-mouse-click-insert-word (click arg)
266 This command must be bound to a mouse click.
267 The double-click action of the same mouse button must not be bound
274 (or (not (eq (key-binding viper-mouse-down-insert-key-parsed)
275 'viper-mouse-catch-frame-switch))
276 (not (eq (key-binding viper-mouse-up-insert-key-parsed)
277 'viper-mouse-click-insert-word))
287 (if (not (eq (key-binding viper-mouse-down-insert-key-parsed)
288 'viper-mouse-catch-frame-switch))
293 ;; This trick checks if there is a pending mouse event if so, we
294 ;; use this latter event and discard the current mouse click If
295 ;; the next pending event is not a mouse event, we execute the
296 ;; current mouse event
299 (viper-mouse-event-p last-input-event)))
304 ;; uninterrupted wait or the interrupting event wasn't a mouse event
309 (insert (viper-mouse-click-get-word click arg click-count))
312 (not (viper-mouse-event-p interrupting-event)))
317 (defun viper-mouse-event-p (event)
319 (string-match "\\(mouse-\\|frame\\|screen\\|track\\)"
354 (defun viper-mouse-click-search-word (click arg)
357 This command must be bound to a mouse click. The double-click action of the
365 (or (not (eq (key-binding viper-mouse-down-search-key-parsed)
366 'viper-mouse-catch-frame-switch))
367 (not (eq (key-binding viper-mouse-up-search-key-parsed)
368 'viper-mouse-click-search-word))
376 ;; This trick checks if there is a pending mouse event if so, we use
377 ;; this latter event and discard the current mouse click If the next
378 ;; pending event is not a mouse event, we execute the current mouse
382 (viper-mouse-event-p last-input-event)))
392 (setq click-word (viper-mouse-click-get-word click nil click-count))
404 (not (eq last-command 'viper-mouse-click-search-word)))
408 viper-mouse-click-search-noerror t
409 viper-mouse-click-search-limit nil)
426 click-word viper-mouse-click-search-limit
427 viper-mouse-click-search-noerror))
429 (setq viper-mouse-click-search-noerror nil)
430 (setq viper-mouse-click-search-limit
440 viper-mouse-click-search-limit nil)))
450 (not (eq last-command 'viper-mouse-click-search-word)))
458 (setq viper-mouse-click-search-noerror t)
459 (setq viper-mouse-click-search-limit nil)
466 (defun viper-mouse-catch-frame-switch (event arg)
468 Usually is bound to a `down-mouse' event to work properly. See sample
472 ;; pass prefix arg along to viper-mouse-click-search/insert-word
476 ;; make Emacs forget that it executed viper-mouse-catch-frame-switch
483 ;; In Emacs, if you select-frame A while mouse is over frame B and then
490 ;; viper-mouse-click-* commands when you click in a frame other than the one
492 ;; until you do something other than viper-mouse-click-* command.
493 ;; In XEmacs, you have to manually select frame B (with the mouse click) in
501 ;; Converts into a valid mouse button spec for the appropriate version of
504 (defun viper-parse-mouse-key (key-var event-type)
514 "mouse-1" "down-mouse-1")
520 "mouse-2" "down-mouse-2")
526 "mouse-3" "down-mouse-3")
556 (defun viper-unbind-mouse-search-key ()
557 (if viper-mouse-up-search-key-parsed
558 (global-unset-key viper-mouse-up-search-key-parsed))
559 (if viper-mouse-down-search-key-parsed
560 (global-unset-key viper-mouse-down-search-key-parsed))
561 (setq viper-mouse-up-search-key-parsed nil
562 viper-mouse-down-search-key-parsed nil))
564 (defun viper-unbind-mouse-insert-key ()
565 (if viper-mouse-up-insert-key-parsed
566 (global-unset-key viper-mouse-up-insert-key-parsed))
567 (if viper-mouse-down-insert-key-parsed
568 (global-unset-key viper-mouse-down-insert-key-parsed))
569 (setq viper-mouse-up-insert-key-parsed nil
570 viper-mouse-down-insert-key-parsed nil))
572 ;; If FORCE, bind even if this mouse action is already bound to something else
573 (defun viper-bind-mouse-search-key (&optional force)
574 (setq viper-mouse-up-search-key-parsed
575 (viper-parse-mouse-key 'viper-mouse-search-key 'up)
576 viper-mouse-down-search-key-parsed
577 (viper-parse-mouse-key 'viper-mouse-search-key 'down))
578 (cond ((or (null viper-mouse-up-search-key-parsed)
579 (null viper-mouse-down-search-key-parsed))
582 (key-binding viper-mouse-up-search-key-parsed)
583 (not (eq (key-binding viper-mouse-up-search-key-parsed)
584 'viper-mouse-click-search-word)))
586 "%S already bound to a mouse event. Viper mouse-search feature disabled"
587 viper-mouse-up-search-key-parsed))
589 (key-binding viper-mouse-down-search-key-parsed)
590 (not (eq (key-binding viper-mouse-down-search-key-parsed)
591 'viper-mouse-catch-frame-switch)))
593 "%S already bound to a mouse event. Viper mouse-search feature disabled"
594 viper-mouse-down-search-key-parsed))
596 (global-set-key viper-mouse-up-search-key-parsed
597 'viper-mouse-click-search-word)
598 (global-set-key viper-mouse-down-search-key-parsed
599 'viper-mouse-catch-frame-switch))))
601 ;; If FORCE, bind even if this mouse action is already bound to something else
602 (defun viper-bind-mouse-insert-key (&optional force)
603 (setq viper-mouse-up-insert-key-parsed
604 (viper-parse-mouse-key 'viper-mouse-insert-key 'up)
605 viper-mouse-down-insert-key-parsed
606 (viper-parse-mouse-key 'viper-mouse-insert-key 'down))
607 (cond ((or (null viper-mouse-up-insert-key-parsed)
608 (null viper-mouse-down-insert-key-parsed))
611 (key-binding viper-mouse-up-insert-key-parsed)
612 (not (eq (key-binding viper-mouse-up-insert-key-parsed)
613 'viper-mouse-click-insert-word)))
615 "%S already bound to a mouse event. Viper mouse-insert feature disabled"
616 viper-mouse-up-insert-key-parsed))
618 (key-binding viper-mouse-down-insert-key-parsed)
619 (not (eq (key-binding viper-mouse-down-insert-key-parsed)
620 'viper-mouse-catch-frame-switch)))
622 "%S already bound to a mouse event. Viper mouse-insert feature disabled"
623 viper-mouse-down-insert-key-parsed))
625 (global-set-key viper-mouse-up-insert-key-parsed
626 'viper-mouse-click-insert-word)
627 (global-set-key viper-mouse-down-insert-key-parsed
628 'viper-mouse-catch-frame-switch))))
630 (defun viper-reset-mouse-search-key (symb val)
631 (viper-unbind-mouse-search-key)
633 (viper-bind-mouse-search-key 'force))
635 (defun viper-reset-mouse-insert-key (symb val)
636 (viper-unbind-mouse-insert-key)
638 (viper-bind-mouse-insert-key 'force))
641 (defcustom viper-mouse-search-key '(meta shift 1)
643 This must be a list that specifies the mouse button and modifiers.
646 keys down and clicking on a word with mouse button 1
654 :set 'viper-reset-mouse-search-key
655 :group 'viper-mouse)
657 (defcustom viper-mouse-insert-key '(meta shift 2)
659 Must be a list that specifies the mouse button and modifiers.
662 down, and clicking on a word with mouse button 2, will insert that word
670 :set 'viper-reset-mouse-insert-key
671 :group 'viper-mouse)