yatex
changeset 189:8abdd3cc87d0 dev
Fix merge conflict
author | yuuji@gentei.org |
---|---|
date | Sat, 17 Dec 2011 12:54:25 +0900 |
parents | 9828ebe7b545 |
children | 3db120d6b7d1 |
files | yahtml.el yatex.el yatexmth.el |
diffstat | 3 files changed, 96 insertions(+), 70 deletions(-) [+] |
line diff
1.1 --- a/yahtml.el Sat Dec 17 12:46:27 2011 +0900 1.2 +++ b/yahtml.el Sat Dec 17 12:54:25 2011 +0900 1.3 @@ -1,6 +1,6 @@ 1.4 ;;; -*- Emacs-Lisp -*- 1.5 ;;; (c) 1994-2011 by HIROSE Yuuji [yuuji(@)yatex.org] 1.6 -;;; Last modified Sat Dec 17 11:17:59 2011 on roy 1.7 +;;; Last modified Mon May 16 15:49:38 2011 on firestorm 1.8 ;;; $Id$ 1.9 1.10 (defconst yahtml-revision-number "1.74.2" 1.11 @@ -250,8 +250,7 @@ 1.12 %x: width, %y: height, %s: size in bytes, %c: first comment string, 1.13 %f: filename") 1.14 1.15 -(defvar yahtml-faithful-to-htmllint (not yahtml-always-/li) 1.16 - "*Non-nil doesn't put space after opening tags.") 1.17 +(defvar yahtml-faithful-to-htmllint nil) 1.18 (defvar yahtml-error-line-regexp 1.19 "^\\(.*\\)(\\([0-9]+\\)):\\|^line \\([0-9]+\\)" 1.20 "*Regexp of error position which is produced by lint program.") 1.21 @@ -756,29 +755,29 @@ 1.22 (strong "Strong" . 1.23 (lambda () (interactive) (yahtml-insert-tag nil "STRONG"))) 1.24 (VAR "Variable notation" . 1.25 - (lambda () (interactive) (yahtml-insert-tag nil "VAR")))))) 1.26 + (lambda () (interactive) (yahtml-insert-tag nil "var")))))) 1.27 (setq yahtml-menu-map-typeface (make-sparse-keymap "typeface tags")) 1.28 (YaTeX-define-menu 1.29 'yahtml-menu-map-typeface 1.30 (nreverse 1.31 '((b "Bold" . 1.32 - (lambda () (interactive) (yahtml-insert-tag nil "B"))) 1.33 + (lambda () (interactive) (yahtml-insert-tag nil "b"))) 1.34 (i "Italic" . 1.35 - (lambda () (interactive) (yahtml-insert-tag nil "I"))) 1.36 + (lambda () (interactive) (yahtml-insert-tag nil "i"))) 1.37 (tt "Typewriter" . 1.38 - (lambda () (interactive) (yahtml-insert-tag nil "TT"))) 1.39 + (lambda () (interactive) (yahtml-insert-tag nil "tt"))) 1.40 (u "Underlined" . 1.41 - (lambda () (interactive) (yahtml-insert-tag nil "U")))))) 1.42 + (lambda () (interactive) (yahtml-insert-tag nil "u")))))) 1.43 (setq yahtml-menu-map-listing (make-sparse-keymap "listing")) 1.44 (YaTeX-define-menu 1.45 'yahtml-menu-map-listing 1.46 (nreverse 1.47 '((ul "Unordered" . 1.48 - (lambda () (interactive) (yahtml-insert-begend nil "UL"))) 1.49 + (lambda () (interactive) (yahtml-insert-begend nil "ul"))) 1.50 (ol "Ordered" . 1.51 - (lambda () (interactive) (yahtml-insert-begend nil "OL"))) 1.52 + (lambda () (interactive) (yahtml-insert-begend nil "ol"))) 1.53 (dl "Definition" . 1.54 - (lambda () (interactive) (yahtml-insert-begend nil "DL")))))) 1.55 + (lambda () (interactive) (yahtml-insert-begend nil "dl")))))) 1.56 (setq yahtml-menu-map-item (make-sparse-keymap "item")) 1.57 (YaTeX-define-menu 1.58 'yahtml-menu-map-item 1.59 @@ -833,7 +832,7 @@ 1.60 (or (cdr (assoc yahtml-last-begend yahtml-env-table)) 1.61 yahtml-last-begend)) 1.62 (setq cmd yahtml-last-begend) 1.63 - (if yahtml-prefer-upcases (setq cmd (upcase cmd))) 1.64 + (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase) cmd)) 1.65 (if region 1.66 ;; We want to keep region effective for new tagged environment 1.67 ;; to enable continuous regioning by another environment 1.68 @@ -2510,11 +2509,11 @@ 1.69 (yahtml-indent-line-real)))) 1.70 1.71 (defun yahtml-this-indent () 1.72 - (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir\\|d[td]\\|li") 1.73 - (itemizing-envs "^\\([uod]l\\|menu\\|dir\\|li\\|d[td]\\)$") 1.74 + (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir\\|font") 1.75 + (itemizing-envs "^\\([uod]l\\|menu\\|dir\\)$") 1.76 (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\|option\\)\\b") 1.77 (excludes 1.78 - "\\b\\(a\\|p\\|span\\|code\\|tt\\|em\\|u\\|i\\|big\\|small\\|font\\)\\b") 1.79 + "\\(a\\|p\\|span\\|code\\|tt\\|em\\|u\\|i\\|big\\|small\\|font\\)\\b") 1.80 inenv p col peol (case-fold-search t)) 1.81 (save-excursion 1.82 (beginning-of-line)
2.1 --- a/yatex.el Sat Dec 17 12:46:27 2011 +0900 2.2 +++ b/yatex.el Sat Dec 17 12:54:25 2011 +0900 2.3 @@ -1,15 +1,15 @@ 2.4 ;;; -*- Emacs-Lisp -*- 2.5 ;;; Yet Another tex-mode for emacs - //–ì’¹// 2.6 -;;; yatex.el rev. 1.74.4 2.7 +;;; yatex.el rev. 1.74.6 2.8 ;;; (c)1991-2011 by HIROSE Yuuji.[yuuji@yatex.org] 2.9 -;;; Last modified Mon Mar 28 23:43:16 2011 on firestorm 2.10 +;;; Last modified Thu Dec 15 13:37:47 2011 on firestorm 2.11 ;;; $Id$ 2.12 ;;; The latest version of this software is always available at; 2.13 ;;; http://www.yatex.org/ 2.14 2.15 (require 'comment) 2.16 (require 'yatexlib) 2.17 -(defconst YaTeX-revision-number "1.74.4" 2.18 +(defconst YaTeX-revision-number "1.74.6" 2.19 "Revision number of running yatex.el") 2.20 2.21 ;---------- Local variables ---------- 2.22 @@ -510,7 +510,7 @@ 2.23 (if YaTeX-dos 2.24 (define-key YaTeX-prefix-map "\C-r" 2.25 '(lambda () (interactive) 2.26 - (set-screen-height YaTeX-saved-screen-height) (recenter))))) 2.27 + (YaTeX-set-screen-height YaTeX-saved-screen-height) (recenter))))) 2.28 2.29 (defvar YaTeX-section-completion-map nil 2.30 "*Key map used at YaTeX completion in the minibuffer.") 2.31 @@ -692,7 +692,7 @@ 2.32 )) 2.33 (use-local-map YaTeX-mode-map) 2.34 (set-syntax-table YaTeX-mode-syntax-table) 2.35 - (if YaTeX-dos (setq YaTeX-saved-screen-height (screen-height))) 2.36 + (if YaTeX-dos (setq YaTeX-saved-screen-height (YaTeX-screen-height))) 2.37 (YaTeX-read-user-completion-table) 2.38 (and (fboundp 'YaTeX-hilit-setup-alist) (YaTeX-hilit-setup-alist)) 2.39 (makunbound 'inenv) 2.40 @@ -1198,9 +1198,9 @@ 2.41 (interactive "r") 2.42 (save-excursion 2.43 (goto-char end) 2.44 - (insert (or close "}")) 2.45 + (YaTeX-insert-inherit (or close "}")) 2.46 (goto-char beg) 2.47 - (insert (or open "{")))) 2.48 + (YaTeX-insert-inherit (or open "{")))) 2.49 2.50 (defun YaTeX-insert-braces (arg &optional open close) 2.51 (interactive "p") 2.52 @@ -1257,7 +1257,7 @@ 2.53 (defun YaTeX-jmode () 2.54 (or (and (boundp 'canna:*japanese-mode*) canna:*japanese-mode*) 2.55 (and (boundp 'egg:*mode-on*) egg:*mode-on* egg:*input-mode*) 2.56 - (and (boundp 'skk-mode) skk-mode) 2.57 + (and (boundp 'skk-mode) skk-mode (not skk-latin-mode)) 2.58 (and (boundp 'default-input-method) default-input-method 2.59 current-input-method))) 2.60 2.61 @@ -1269,7 +1269,17 @@ 2.62 (egg:toggle-egg-mode-on-off) t) 2.63 ((and (fboundp 'skk-mode) (boundp 'skk-mode) skk-mode) 2.64 (cond 2.65 - ((fboundp 'skk-latin-mode) (skk-latin-mode t)) 2.66 + ((fboundp 'skk-latin-mode) 2.67 + (or (and (boundp 'skk-henkan-mode) skk-henkan-mode) 2.68 + (and (boundp 'skk-henkan-on) 2.69 + (or skk-henkan-mode skk-henkan-active)) 2.70 + (and (boundp 'j-henkan-on) 2.71 + (or j-henkan-on j-henkan-active)) 2.72 + ;; Deactivate jmode if henkan-mode is not running. 2.73 + ;; Suggested by tt.tetsuo.tsukamoto. 2.74 + (progn 2.75 + (put 'YaTeX-jmode-on 'skkkata skk-katakana) 2.76 + (skk-latin-mode t)))) 2.77 ((fboundp 'skk-mode-off) (skk-mode-off)) 2.78 (t (j-mode-off))) 2.79 t) 2.80 @@ -1286,7 +1296,10 @@ 2.81 (and (not egg:*mode-on*) (not egg:*input-mode*) 2.82 (egg:toggle-egg-mode-on-off))) 2.83 ((and (fboundp 'skk-mode) (boundp 'skk-mode)) 2.84 - (if (not skk-mode) (skk-mode 1))) 2.85 + (if (get 'YaTeX-jmode-on 'skkkata) 2.86 + (skk-j-mode-on t) 2.87 + (skk-mode 1)) 2.88 + (put 'YaTeX-jmode-on 'skkkata nil)) 2.89 ((fboundp 'toggle-input-method) 2.90 (if (not current-input-method) (toggle-input-method))) 2.91 ((and (fboundp 'fep-force-on) (fep-force-on))))) 2.92 @@ -1298,6 +1311,9 @@ 2.93 2.94 (defun YaTeX-self-insert (arg) 2.95 (call-interactively (global-key-binding (char-to-string last-command-char)))) 2.96 +(defun YaTeX-insert-inherit (&rest args) 2.97 + (apply (if (fboundp 'insert-and-inherit) 'insert-and-inherit 'insert) 2.98 + args)) 2.99 2.100 (defun YaTeX-insert-brackets (arg) 2.101 "Insert Kagi-kakko or \\ [ \\] pair or simply \[." 2.102 @@ -1310,35 +1326,35 @@ 2.103 ((save-excursion 2.104 (and (> (- (point) (point-min)) 5) (forward-char -5)) 2.105 (looking-at "\\\\left")) 2.106 - (insert "[\\right]") 2.107 + (YaTeX-insert-inherit "[\\right]") 2.108 (forward-char -7)) 2.109 ((save-excursion ;from matsu@math.s.chiba-u.ac.jp 2.110 (and (> (- (point) (point-min)) 5) (forward-char -5)) 2.111 (looking-at "\\\\[bB]igl")) 2.112 - (insert 2.113 + (YaTeX-insert-inherit 2.114 (concat 2.115 "[" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r]")) 2.116 (forward-char -6)) 2.117 ((save-excursion 2.118 (and (> (- (point) (point-min)) 6) (forward-char -6)) 2.119 (looking-at "\\\\[bB]iggl")) 2.120 - (insert 2.121 + (YaTeX-insert-inherit 2.122 (concat 2.123 "[" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r]")) 2.124 (forward-char -7)) ;matsu's hack ends here 2.125 ((and (= (preceding-char) ?\\ ) 2.126 (/= (char-after (- (point) 2)) ?\\ ) 2.127 (not (YaTeX-in-math-mode-p))) 2.128 - (insert last-command-char "\n") 2.129 + (YaTeX-insert-inherit last-command-char "\n") 2.130 (indent-to (max 0 col)) 2.131 - (insert "\\]") 2.132 + (YaTeX-insert-inherit "\\]") 2.133 (beginning-of-line) 2.134 (open-line 1) 2.135 (delete-region (point) (progn (beginning-of-line) (point))) 2.136 (indent-to (+ YaTeX-environment-indent (max 0 col))) 2.137 (or YaTeX-auto-math-mode YaTeX-math-mode (YaTeX-toggle-math-mode 1))) 2.138 ((YaTeX-closable-p) 2.139 - (insert "[]") 2.140 + (YaTeX-insert-inherit "[]") 2.141 (backward-char 1)) 2.142 (t (YaTeX-self-insert arg))))) 2.143 2.144 @@ -1355,27 +1371,27 @@ 2.145 ((save-excursion 2.146 (and (> (- (point) (point-min)) 5) (forward-char -5)) 2.147 (looking-at "\\\\left")) 2.148 - (insert "(\\right)") 2.149 + (YaTeX-insert-inherit "(\\right)") 2.150 (forward-char -7)) 2.151 ((save-excursion ;from matsu@math.s.chiba-u.ac.jp 2.152 (and (> (- (point) (point-min)) 5) (forward-char -5)) 2.153 (looking-at "\\\\[bB]igl")) 2.154 - (insert 2.155 + (YaTeX-insert-inherit 2.156 (concat 2.157 "(" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r)")) 2.158 (forward-char -6)) 2.159 ((save-excursion 2.160 (and (> (- (point) (point-min)) 6) (forward-char -6)) 2.161 (looking-at "\\\\[bB]iggl")) 2.162 - (insert 2.163 + (YaTeX-insert-inherit 2.164 (concat 2.165 "(" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r)")) 2.166 (forward-char -7)) 2.167 ((= (preceding-char) ?\\ ) ;matsu's hack ends here 2.168 - (insert "(\\)") 2.169 + (YaTeX-insert-inherit "(\\)") 2.170 (backward-char 2)) 2.171 ((YaTeX-closable-p) 2.172 - (insert "()") 2.173 + (YaTeX-insert-inherit "()") 2.174 (backward-char 1)) 2.175 (t (YaTeX-self-insert arg)))) 2.176 2.177 @@ -1392,7 +1408,7 @@ 2.178 ((save-excursion 2.179 (and (> (- (point) (point-min)) 5) (forward-char -5)) 2.180 (looking-at "\\\\left")) 2.181 - (insert "|\\right|") 2.182 + (YaTeX-insert-inherit "|\\right|") 2.183 (forward-char -7)) 2.184 ((save-excursion ;from matsu@math.s.chiba-u.ac.jp 2.185 (and (> (- (point) (point-min)) 5) (forward-char -5)) 2.186 @@ -1411,7 +1427,7 @@ 2.187 ((save-excursion ; added by Jin <MAF01011@nifty.ne.jp> 2.188 (and (> (- (point) (point-min)) 6) (forward-char -6)) 2.189 (looking-at "\\\\left\\\\")) 2.190 - (insert "|\\right\\|") 2.191 + (YaTeX-insert-inherit "|\\right\\|") 2.192 (forward-char -8)) 2.193 ((save-excursion 2.194 (and (> (- (point) (point-min)) 6) (forward-char -6)) 2.195 @@ -1428,51 +1444,59 @@ 2.196 "|" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\|")) 2.197 (forward-char -8)) ; added by Jin up to here. 2.198 ((= (preceding-char) ?\\ ) 2.199 - (insert "|\\|") 2.200 + (YaTeX-insert-inherit "|\\|") 2.201 (backward-char 2)) 2.202 ; ((and (YaTeX-closable-p) 2.203 ; (/= (preceding-char) ?|) 2.204 ; (/= (following-char) ?|)) 2.205 -; (insert "||") 2.206 +; (YaTeX-insert-inherit "||") 2.207 ; (backward-char 1)) 2.208 (t (YaTeX-self-insert arg)))) 2.209 2.210 (defun YaTeX-jmode-hook (old new) 2.211 "A hook controling jmode on/off." 2.212 + ;; This function is called via point-entered/leave hook, so that 2.213 + ;; codes in it is evaluated on such emacsen as having text-properties. 2.214 (let ((inhibit-point-motion-hooks t) 2.215 (oldp (plist-get (text-properties-at old) 'point-left)) 2.216 (newp (plist-get (text-properties-at new) 'point-left)) 2.217 (lnew (plist-get (text-properties-at new) 'last-new)) 2.218 - (bmp (buffer-modified-p)) ;(endc ?x) 2.219 + (mjmode (plist-get (text-properties-at new) 'mjmode)) 2.220 + (bmp (buffer-modified-p)) 2.221 (jm (YaTeX-jmode)) b e) 2.222 - ;;(if (eq 'YaTeX-jmode-hook newp) 2.223 - ;; (setq endc (char-after (next-single-property-change new 'point-left)))) 2.224 - ;;(message "n[%c]=%s o[%c]=%s end=[%c] jm=%s" 2.225 - ;; (char-after new) newp (char-after old) oldp endc jm) 2.226 - (cond 2.227 - ((eq lnew new) nil) ;Do nothing if continuous entry 2.228 - ((and (not (eq newp 'YaTeX-jmode-hook)) 2.229 - (eq oldp 'YaTeX-jmode-hook)) 2.230 - ;; leave 2.231 - (remove-text-properties 2.232 - (1+ (or (previous-single-property-change old 'point-left) 2.233 - (1- (point)))) 2.234 - (1- (or (next-single-property-change old 'point-left) 2.235 - (1+ (point)))) 2.236 - (list 'last-new nil)) 2.237 - (if (plist-get (text-properties-at old) 'jmode) 2.238 - (YaTeX-jmode-on))) 2.239 - ((and (not (eq oldp 'YaTeX-jmode-hook)) 2.240 - (eq newp 'YaTeX-jmode-hook)) 2.241 - ;; enter 2.242 - (add-text-properties 2.243 - (1+ (or (previous-single-property-change new 'point-left) 2.244 - (1- (point)))) 2.245 - (1- (or (next-single-property-change new 'point-left) 2.246 - (1+ (point)))) 2.247 - (list 'jmode jm 'last-new new)) 2.248 - (set-buffer-modified-p bmp) 2.249 - (YaTeX-jmode-off))))) 2.250 + (unwind-protect 2.251 + (cond 2.252 + ((eq lnew new) nil) ;Do nothing if continuous entry 2.253 + ((and (not (eq newp 'YaTeX-jmode-hook)) 2.254 + (eq oldp 'YaTeX-jmode-hook) 2.255 + (plist-get (text-properties-at old) 'entered)) 2.256 + ;; leave 2.257 + (remove-text-properties 2.258 + (setq b (1+ (or (previous-single-property-change old 'point-left) 2.259 + (1- (point))))) 2.260 + (setq e (1- (or (next-single-property-change old 'point-left) 2.261 + (1+ (point))))) 2.262 + (list 'last-new nil 'entered nil)) 2.263 + (add-text-properties b e (list 'mjmode jm)) 2.264 + (if (boundp 'skk-katakana) 2.265 + (put 'YaTeX-jmode-on 'skkkata skk-katakana)) 2.266 + (if (plist-get (text-properties-at old) 'jmode) 2.267 + (YaTeX-jmode-on))) 2.268 + ((and (not (eq oldp 'YaTeX-jmode-hook)) 2.269 + (eq newp 'YaTeX-jmode-hook) 2.270 + (not (plist-get (text-properties-at new) 'entered))) 2.271 + ;; enter 2.272 + (add-text-properties 2.273 + (1+ (or (previous-single-property-change new 'point-left) 2.274 + (1- (point)))) 2.275 + (1- (or (next-single-property-change new 'point-left) 2.276 + (1+ (point)))) 2.277 + (list 'jmode jm 'last-new new 'entered t)) 2.278 + (if (boundp 'skk-katakana) ;care for skk katakana mode 2.279 + (put 'YaTeX-jmode-on 'skkkata skk-katakana)) 2.280 + (if mjmode (YaTeX-jmode-on) (YaTeX-jmode-off)))) 2.281 + ;;unwind job 2.282 + (set-buffer-modified-p bmp)))) 2.283 2.284 (defun YaTeX-insert-dollar () 2.285 (interactive) 2.286 @@ -1488,6 +1512,9 @@ 2.287 (1- (point)) (1+ (point)) 2.288 (list 'point-left 'YaTeX-jmode-hook 2.289 'point-entered 'YaTeX-jmode-hook 2.290 + 'front-sticky t 2.291 + 'rear-nonsticky t 2.292 + 'mjmode nil 2.293 'jmode (YaTeX-jmode)))) 2.294 (YaTeX-jmode-off) 2.295 (or YaTeX-auto-math-mode YaTeX-math-mode (YaTeX-toggle-math-mode 1))))
3.1 --- a/yatexmth.el Sat Dec 17 12:46:27 2011 +0900 3.2 +++ b/yatexmth.el Sat Dec 17 12:54:25 2011 +0900 3.3 @@ -2,7 +2,7 @@ 3.4 ;;; YaTeX math-mode-specific functions. 3.5 ;;; yatexmth.el 3.6 ;;; (c)1993-2010 by HIROSE Yuuji [yuuji@yatex.org] 3.7 -;;; Last modified Thu Mar 24 10:30:18 2011 on firestorm 3.8 +;;; Last modified Fri Oct 7 15:53:34 2011 on firestorm 3.9 ;;; $Id$ 3.10 3.11 ;;; [Customization guide]