Mercurial > hg > xemacs-beta
comparison lisp/viper/viper-mous.el @ 163:0132846995bd r20-3b8
Import from CVS: tag r20-3b8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:43:35 +0200 |
parents | 6a378aca36af |
children | 2d532a89d707 |
comparison
equal
deleted
inserted
replaced
162:4de2936b4e77 | 163:0132846995bd |
---|---|
30 (defvar vip-local-search-start-marker) | 30 (defvar vip-local-search-start-marker) |
31 (defvar vip-search-history) | 31 (defvar vip-search-history) |
32 (defvar vip-s-string) | 32 (defvar vip-s-string) |
33 (defvar vip-re-search) | 33 (defvar vip-re-search) |
34 | 34 |
35 (eval-when-compile | 35 ;; loading happens only in non-interactive compilation |
36 (let ((load-path (cons (expand-file-name ".") load-path))) | 36 ;; in order to spare non-viperized emacs from being viperized |
37 (or (featurep 'viper-util) | 37 (if noninteractive |
38 (load "viper-util.el" nil nil 'nosuffix)) | 38 (eval-when-compile |
39 (or (featurep 'viper) | 39 (let ((load-path (cons (expand-file-name ".") load-path))) |
40 (load "viper.el" nil nil 'nosuffix)) | 40 (or (featurep 'viper-util) |
41 )) | 41 (load "viper-util.el" nil nil 'nosuffix)) |
42 (or (featurep 'viper-cmd) | |
43 (load "viper-cmd.el" nil nil 'nosuffix)) | |
44 ))) | |
42 ;; end pacifier | 45 ;; end pacifier |
43 | 46 |
44 (require 'viper-util) | 47 (require 'viper-util) |
45 | 48 |
46 | 49 |
61 and CLICK-COUNT, telling whether this is the first click, a double-click, | 64 and CLICK-COUNT, telling whether this is the first click, a double-click, |
62 or a tripple-click.") | 65 or a tripple-click.") |
63 | 66 |
64 ;; time interval in millisecond within which successive clicks are | 67 ;; time interval in millisecond within which successive clicks are |
65 ;; considered related | 68 ;; considered related |
66 (defconst vip-multiclick-timeout (if vip-xemacs-p | 69 (defconst vip-multiclick-timeout (if (vip-window-display-p) |
67 mouse-track-multi-click-time | 70 (if vip-xemacs-p |
68 double-click-time) | 71 mouse-track-multi-click-time |
72 double-click-time) | |
73 500) | |
69 "*Time interval in millisecond within which successive clicks are | 74 "*Time interval in millisecond within which successive clicks are |
70 considered related.") | 75 considered related.") |
71 | 76 |
72 ;; current event click count; XEmacs only | 77 ;; current event click count; XEmacs only |
73 (defvar vip-current-click-count 0) | 78 (defvar vip-current-click-count 0) |
394 ))) | 399 ))) |
395 | 400 |
396 (defun vip-mouse-catch-frame-switch (event arg) | 401 (defun vip-mouse-catch-frame-switch (event arg) |
397 "Catch the event of switching frame. | 402 "Catch the event of switching frame. |
398 Usually is bound to a 'down-mouse' event to work properly. See sample | 403 Usually is bound to a 'down-mouse' event to work properly. See sample |
399 bindings in viper.el and in the Viper manual." | 404 bindings in the Viper manual." |
400 (interactive "e\nP") | 405 (interactive "e\nP") |
401 (setq vip-frame-of-focus nil) | 406 (setq vip-frame-of-focus nil) |
402 ;; pass prefix arg along to vip-mouse-click-search/insert-word | 407 ;; pass prefix arg along to vip-mouse-click-search/insert-word |
403 (setq prefix-arg arg) | 408 (setq prefix-arg arg) |
404 (if (eq last-command 'handle-switch-frame) | 409 (if (eq last-command 'handle-switch-frame) |
425 (defsubst vip-remember-current-frame (frame) | 430 (defsubst vip-remember-current-frame (frame) |
426 (setq last-command 'handle-switch-frame | 431 (setq last-command 'handle-switch-frame |
427 vip-current-frame-saved (selected-frame))) | 432 vip-current-frame-saved (selected-frame))) |
428 | 433 |
429 | 434 |
430 (cond ((vip-window-display-p) | |
431 (let* ((search-key (if vip-xemacs-p | |
432 [(meta shift button1up)] [M-S-mouse-1])) | |
433 (search-key-catch (if vip-xemacs-p | |
434 [(meta shift button1)] [M-S-down-mouse-1])) | |
435 (insert-key (if vip-xemacs-p | |
436 [(meta shift button2up)] [M-S-mouse-2])) | |
437 (insert-key-catch (if vip-xemacs-p | |
438 [(meta shift button2)] [M-S-down-mouse-2])) | |
439 (search-key-unbound (and (not (key-binding search-key)) | |
440 (not (key-binding search-key-catch)))) | |
441 (insert-key-unbound (and (not (key-binding insert-key)) | |
442 (not (key-binding insert-key-catch)))) | |
443 ) | |
444 | |
445 (if search-key-unbound | |
446 (global-set-key search-key 'vip-mouse-click-search-word)) | |
447 (if insert-key-unbound | |
448 (global-set-key insert-key 'vip-mouse-click-insert-word)) | |
449 | |
450 ;; The following would be needed if you want to use the above two | |
451 ;; while clicking in another frame. If you only want to use them | |
452 ;; by clicking in another window, not frame, the bindings below | |
453 ;; aren't necessary. | |
454 | |
455 ;; These must be bound to mouse-down event for the same mouse | |
456 ;; buttons as 'vip-mouse-click-search-word and | |
457 ;; 'vip-mouse-click-insert-word | |
458 (if search-key-unbound | |
459 (global-set-key search-key-catch 'vip-mouse-catch-frame-switch)) | |
460 (if insert-key-unbound | |
461 (global-set-key insert-key-catch 'vip-mouse-catch-frame-switch)) | |
462 | |
463 (if vip-xemacs-p | |
464 (add-hook 'mouse-leave-frame-hook | |
465 'vip-remember-current-frame) | |
466 (defadvice handle-switch-frame (before vip-frame-advice activate) | |
467 "Remember the selected frame before the switch-frame event." | |
468 (vip-remember-current-frame (selected-frame)))) | |
469 ))) | |
470 | |
471 | 435 |
472 ;;; viper-mous.el ends here | 436 ;;; viper-mous.el ends here |