yatex
changeset 184:bdc00b25045d dev
The text-property for math-mode should be front-sticky and rear-nonsticky.
author | HIROSE Yuuji <yuuji@koeki-u.ac.jp> |
---|---|
date | Wed, 30 Nov 2011 14:21:28 +0900 |
parents | ab7cd5129797 |
children | 85e57c4b27a2 |
files | yatex.el |
diffstat | 1 files changed, 23 insertions(+), 18 deletions(-) [+] |
line diff
1.1 --- a/yatex.el Fri Oct 07 16:00:52 2011 +0900 1.2 +++ b/yatex.el Wed Nov 30 14:21:28 2011 +0900 1.3 @@ -2,7 +2,7 @@ 1.4 ;;; Yet Another tex-mode for emacs - //–ì’¹// 1.5 ;;; yatex.el rev. 1.74.4 1.6 ;;; (c)1991-2011 by HIROSE Yuuji.[yuuji@yatex.org] 1.7 -;;; Last modified Fri Oct 7 15:58:31 2011 on firestorm 1.8 +;;; Last modified Wed Nov 30 14:20:13 2011 on duke 1.9 ;;; $Id$ 1.10 ;;; The latest version of this software is always available at; 1.11 ;;; http://www.yatex.org/ 1.12 @@ -1198,9 +1198,9 @@ 1.13 (interactive "r") 1.14 (save-excursion 1.15 (goto-char end) 1.16 - (insert (or close "}")) 1.17 + (YaTeX-insert-inherit (or close "}")) 1.18 (goto-char beg) 1.19 - (insert (or open "{")))) 1.20 + (YaTeX-insert-inherit (or open "{")))) 1.21 1.22 (defun YaTeX-insert-braces (arg &optional open close) 1.23 (interactive "p") 1.24 @@ -1298,6 +1298,9 @@ 1.25 1.26 (defun YaTeX-self-insert (arg) 1.27 (call-interactively (global-key-binding (char-to-string last-command-char)))) 1.28 +(defun YaTeX-insert-inherit (&rest args) 1.29 + (apply (if (fboundp 'insert-and-inherit) 'insert-and-inherit 'insert) 1.30 + args)) 1.31 1.32 (defun YaTeX-insert-brackets (arg) 1.33 "Insert Kagi-kakko or \\ [ \\] pair or simply \[." 1.34 @@ -1310,35 +1313,35 @@ 1.35 ((save-excursion 1.36 (and (> (- (point) (point-min)) 5) (forward-char -5)) 1.37 (looking-at "\\\\left")) 1.38 - (insert "[\\right]") 1.39 + (YaTeX-insert-inherit "[\\right]") 1.40 (forward-char -7)) 1.41 ((save-excursion ;from matsu@math.s.chiba-u.ac.jp 1.42 (and (> (- (point) (point-min)) 5) (forward-char -5)) 1.43 (looking-at "\\\\[bB]igl")) 1.44 - (insert 1.45 + (YaTeX-insert-inherit 1.46 (concat 1.47 "[" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r]")) 1.48 (forward-char -6)) 1.49 ((save-excursion 1.50 (and (> (- (point) (point-min)) 6) (forward-char -6)) 1.51 (looking-at "\\\\[bB]iggl")) 1.52 - (insert 1.53 + (YaTeX-insert-inherit 1.54 (concat 1.55 "[" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r]")) 1.56 (forward-char -7)) ;matsu's hack ends here 1.57 ((and (= (preceding-char) ?\\ ) 1.58 (/= (char-after (- (point) 2)) ?\\ ) 1.59 (not (YaTeX-in-math-mode-p))) 1.60 - (insert last-command-char "\n") 1.61 + (YaTeX-insert-inherit last-command-char "\n") 1.62 (indent-to (max 0 col)) 1.63 - (insert "\\]") 1.64 + (YaTeX-insert-inherit "\\]") 1.65 (beginning-of-line) 1.66 (open-line 1) 1.67 (delete-region (point) (progn (beginning-of-line) (point))) 1.68 (indent-to (+ YaTeX-environment-indent (max 0 col))) 1.69 (or YaTeX-auto-math-mode YaTeX-math-mode (YaTeX-toggle-math-mode 1))) 1.70 ((YaTeX-closable-p) 1.71 - (insert "[]") 1.72 + (YaTeX-insert-inherit "[]") 1.73 (backward-char 1)) 1.74 (t (YaTeX-self-insert arg))))) 1.75 1.76 @@ -1355,27 +1358,27 @@ 1.77 ((save-excursion 1.78 (and (> (- (point) (point-min)) 5) (forward-char -5)) 1.79 (looking-at "\\\\left")) 1.80 - (insert "(\\right)") 1.81 + (YaTeX-insert-inherit "(\\right)") 1.82 (forward-char -7)) 1.83 ((save-excursion ;from matsu@math.s.chiba-u.ac.jp 1.84 (and (> (- (point) (point-min)) 5) (forward-char -5)) 1.85 (looking-at "\\\\[bB]igl")) 1.86 - (insert 1.87 + (YaTeX-insert-inherit 1.88 (concat 1.89 "(" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r)")) 1.90 (forward-char -6)) 1.91 ((save-excursion 1.92 (and (> (- (point) (point-min)) 6) (forward-char -6)) 1.93 (looking-at "\\\\[bB]iggl")) 1.94 - (insert 1.95 + (YaTeX-insert-inherit 1.96 (concat 1.97 "(" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r)")) 1.98 (forward-char -7)) 1.99 ((= (preceding-char) ?\\ ) ;matsu's hack ends here 1.100 - (insert "(\\)") 1.101 + (YaTeX-insert-inherit "(\\)") 1.102 (backward-char 2)) 1.103 ((YaTeX-closable-p) 1.104 - (insert "()") 1.105 + (YaTeX-insert-inherit "()") 1.106 (backward-char 1)) 1.107 (t (YaTeX-self-insert arg)))) 1.108 1.109 @@ -1392,7 +1395,7 @@ 1.110 ((save-excursion 1.111 (and (> (- (point) (point-min)) 5) (forward-char -5)) 1.112 (looking-at "\\\\left")) 1.113 - (insert "|\\right|") 1.114 + (YaTeX-insert-inherit "|\\right|") 1.115 (forward-char -7)) 1.116 ((save-excursion ;from matsu@math.s.chiba-u.ac.jp 1.117 (and (> (- (point) (point-min)) 5) (forward-char -5)) 1.118 @@ -1411,7 +1414,7 @@ 1.119 ((save-excursion ; added by Jin <MAF01011@nifty.ne.jp> 1.120 (and (> (- (point) (point-min)) 6) (forward-char -6)) 1.121 (looking-at "\\\\left\\\\")) 1.122 - (insert "|\\right\\|") 1.123 + (YaTeX-insert-inherit "|\\right\\|") 1.124 (forward-char -8)) 1.125 ((save-excursion 1.126 (and (> (- (point) (point-min)) 6) (forward-char -6)) 1.127 @@ -1428,12 +1431,12 @@ 1.128 "|" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\|")) 1.129 (forward-char -8)) ; added by Jin up to here. 1.130 ((= (preceding-char) ?\\ ) 1.131 - (insert "|\\|") 1.132 + (YaTeX-insert-inherit "|\\|") 1.133 (backward-char 2)) 1.134 ; ((and (YaTeX-closable-p) 1.135 ; (/= (preceding-char) ?|) 1.136 ; (/= (following-char) ?|)) 1.137 -; (insert "||") 1.138 +; (YaTeX-insert-inherit "||") 1.139 ; (backward-char 1)) 1.140 (t (YaTeX-self-insert arg)))) 1.141 1.142 @@ -1490,6 +1493,8 @@ 1.143 (1- (point)) (1+ (point)) 1.144 (list 'point-left 'YaTeX-jmode-hook 1.145 'point-entered 'YaTeX-jmode-hook 1.146 + 'front-sticky t 1.147 + 'rear-nonsticky t 1.148 'jmode (YaTeX-jmode)))) 1.149 (YaTeX-jmode-off) 1.150 (or YaTeX-auto-math-mode YaTeX-math-mode (YaTeX-toggle-math-mode 1))))