comparison lisp/prim/mouse.el @ 116:9f59509498e1 r20-1b10

Import from CVS: tag r20-1b10
author cvs
date Mon, 13 Aug 2007 09:23:06 +0200
parents fe104dbd9147
children cca96a509cfe
comparison
equal deleted inserted replaced
115:f109f7dabbe2 116:9f59509498e1
397 397
398 398
399 399
400 ;;; mouse/selection tracking 400 ;;; mouse/selection tracking
401 ;;; generalized mouse-track 401 ;;; generalized mouse-track
402
403 (defvar default-mouse-track-normalize-point-function
404 'default-mouse-track-normalize-point
405 "Function called to normalize position of point.
406 Called with two arguments: TYPE depends on the number of times that the
407 mouse has been clicked and is a member of `default-mouse-track-type-list',
408 FORWARDP determines the direction in which the point should be moved.")
402 409
403 (defvar mouse-track-down-hook nil 410 (defvar mouse-track-down-hook nil
404 "Function or functions called when the user presses the mouse. 411 "Function or functions called when the user presses the mouse.
405 This hook is invoked by `mouse-track'; thus, it will not be called 412 This hook is invoked by `mouse-track'; thus, it will not be called
406 for any buttons with a different binding. The functions will be 413 for any buttons with a different binding. The functions will be
788 ((eq type 'buffer) 795 ((eq type 'buffer)
789 (if forwardp (end-of-buffer) (beginning-of-buffer))))) 796 (if forwardp (end-of-buffer) (beginning-of-buffer)))))
790 797
791 (defun default-mouse-track-next-move (min-anchor max-anchor extent) 798 (defun default-mouse-track-next-move (min-anchor max-anchor extent)
792 (let ((anchor (if (<= (point) min-anchor) max-anchor min-anchor))) 799 (let ((anchor (if (<= (point) min-anchor) max-anchor min-anchor)))
793 (default-mouse-track-normalize-point 800 (funcall default-mouse-track-normalize-point-function
794 default-mouse-track-type (> (point) anchor)) 801 default-mouse-track-type (> (point) anchor))
795 (if (consp extent) 802 (if (consp extent)
796 (default-mouse-track-next-move-rect anchor (point) extent) 803 (default-mouse-track-next-move-rect anchor (point) extent)
797 (if extent 804 (if extent
798 (if (<= anchor (point)) 805 (if (<= anchor (point))
799 (set-extent-endpoints extent anchor (point)) 806 (set-extent-endpoints extent anchor (point))
1013 ;; 1020 ;;
1014 ;; adjust point to a word or line boundary if appropriate 1021 ;; adjust point to a word or line boundary if appropriate
1015 (let ((anchor (default-mouse-track-anchor adjust previous-point))) 1022 (let ((anchor (default-mouse-track-anchor adjust previous-point)))
1016 (setq default-mouse-track-min-anchor 1023 (setq default-mouse-track-min-anchor
1017 (save-excursion (goto-char anchor) 1024 (save-excursion (goto-char anchor)
1018 (default-mouse-track-normalize-point 1025 (funcall
1026 default-mouse-track-normalize-point-function
1019 default-mouse-track-type nil) 1027 default-mouse-track-type nil)
1020 (point))) 1028 (point)))
1021 (setq default-mouse-track-max-anchor 1029 (setq default-mouse-track-max-anchor
1022 (save-excursion (goto-char anchor) 1030 (save-excursion (goto-char anchor)
1023 (default-mouse-track-normalize-point 1031 (funcall
1032 default-mouse-track-normalize-point-function
1024 default-mouse-track-type t) 1033 default-mouse-track-type t)
1025 (point)))) 1034 (point))))
1026 ;; 1035 ;;
1027 ;; remove the existing selection to unclutter the display 1036 ;; remove the existing selection to unclutter the display
1028 (if (not adjust) 1037 (if (not adjust)