Mercurial > hg > xemacs-beta
comparison lisp/mouse.el @ 375:a300bb07d72d r21-2b3
Import from CVS: tag r21-2b3
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:04:51 +0200 |
parents | cc15677e0335 |
children | 8626e4521993 |
comparison
equal
deleted
inserted
replaced
374:4ebeb1a5388b | 375:a300bb07d72d |
---|---|
778 (forward-char)))))) | 778 (forward-char)))))) |
779 | 779 |
780 ;; Decide what will be the SYMBOLP argument to | 780 ;; Decide what will be the SYMBOLP argument to |
781 ;; default-mouse-track-{beginning,end}-of-word, according to the | 781 ;; default-mouse-track-{beginning,end}-of-word, according to the |
782 ;; syntax of the current character and value of mouse-highlight-text. | 782 ;; syntax of the current character and value of mouse-highlight-text. |
783 (defsubst default-mouse-symbolp (syntax) | 783 (defsubst default-mouse-track-symbolp (syntax) |
784 (cond ((eq mouse-highlight-text 'context) | 784 (cond ((eq mouse-highlight-text 'context) |
785 (eq syntax ?_)) | 785 (eq syntax ?_)) |
786 ((eq mouse-highlight-text 'symbol) | 786 ((eq mouse-highlight-text 'symbol) |
787 t) | 787 t) |
788 (t | 788 (t |
789 nil))) | 789 nil))) |
790 | 790 |
791 ;; Return t if point is at an opening quote character. This is | |
792 ;; determined by testing whether the syntax of the following character | |
793 ;; is `string', which will always be true for opening quotes and | |
794 ;; always false for closing quotes. | |
795 (defun default-mouse-track-point-at-opening-quote-p () | |
796 (save-excursion | |
797 (forward-char 1) | |
798 (eq (buffer-syntactic-context) 'string))) | |
799 | |
791 (defun default-mouse-track-normalize-point (type forwardp) | 800 (defun default-mouse-track-normalize-point (type forwardp) |
792 (cond ((eq type 'word) | 801 (cond ((eq type 'word) |
793 ;; trap the beginning and end of buffer errors | 802 ;; trap the beginning and end of buffer errors |
794 (ignore-errors | 803 (ignore-errors |
795 (setq type (char-syntax (char-after (point)))) | 804 (setq type (char-syntax (char-after (point)))) |
796 (if forwardp | 805 (if forwardp |
797 (if (= type ?\() | 806 (if (or (= type ?\() |
807 (and (= type ?\") | |
808 (default-mouse-track-point-at-opening-quote-p))) | |
798 (goto-char (scan-sexps (point) 1)) | 809 (goto-char (scan-sexps (point) 1)) |
799 (if (= type ?\)) | 810 (default-mouse-track-end-of-word |
800 (forward-char 1) | 811 (default-mouse-track-symbolp type))) |
801 (default-mouse-track-end-of-word | 812 (if (or (= type ?\)) |
802 (default-mouse-symbolp type)))) | 813 (and (= type ?\") |
803 (if (= type ?\)) | 814 (not (default-mouse-track-point-at-opening-quote-p)))) |
804 (goto-char (scan-sexps (1+ (point)) -1)) | 815 (goto-char (scan-sexps (1+ (point)) -1)) |
805 (default-mouse-track-beginning-of-word | 816 (default-mouse-track-beginning-of-word |
806 (default-mouse-symbolp type)))))) | 817 (default-mouse-track-symbolp type)))))) |
807 ((eq type 'line) | 818 ((eq type 'line) |
808 (if forwardp (end-of-line) (beginning-of-line))) | 819 (if forwardp (end-of-line) (beginning-of-line))) |
809 ((eq type 'buffer) | 820 ((eq type 'buffer) |
810 (if forwardp (end-of-buffer) (beginning-of-buffer))))) | 821 (if forwardp (end-of-buffer) (beginning-of-buffer))))) |
811 | 822 |