comparison yatexlib.el @ 80:9b4354af748c

Too many changes from 1.72. See yatex.new. (Japanese)
author yuuji
date Sun, 24 Dec 2006 06:16:52 +0000
parents 0734be649cb8
children f14ec50103d0
comparison
equal deleted inserted replaced
79:0734be649cb8 80:9b4354af748c
1 ;;; -*- Emacs-Lisp -*- 1 ;;; -*- Emacs-Lisp -*-
2 ;;; YaTeX and yahtml common libraries, general functions and definitions 2 ;;; YaTeX and yahtml common libraries, general functions and definitions
3 ;;; yatexlib.el 3 ;;; yatexlib.el
4 ;;; (c)1994-2002 by HIROSE Yuuji.[yuuji@yatex.org] 4 ;;; (c)1994-2006 by HIROSE Yuuji.[yuuji@yatex.org]
5 ;;; Last modified Tue Aug 19 22:20:40 2003 on firestorm 5 ;;; Last modified Sun Dec 24 15:12:20 2006 on firestorm
6 ;;; $Id$ 6 ;;; $Id$
7 7
8 ;; General variables 8 ;; General variables
9 (defvar YaTeX-dos (memq system-type '(ms-dos windows-nt OS/2))) 9 (defvar YaTeX-dos (memq system-type '(ms-dos windows-nt OS/2)))
10 (defvar YaTeX-macos (memq system-type '(darwin))) 10 (defvar YaTeX-macos (memq system-type '(darwin)))
29 (string-match "[Jj]apanese" current-language-environment))) 29 (string-match "[Jj]apanese" current-language-environment)))
30 "Whether yatex mode is running on Japanese environment or not.") 30 "Whether yatex mode is running on Japanese environment or not.")
31 31
32 ;; autoload from yahtml.el 32 ;; autoload from yahtml.el
33 (autoload 'yahtml-inner-environment-but "yahtml" "yahtml internal func." t) 33 (autoload 'yahtml-inner-environment-but "yahtml" "yahtml internal func." t)
34
35 (defvar latex-message-kanji-code 2
36 "*Kanji coding system latex command types out.
37 1 = Shift JIS, 2 = JIS, 3 = EUC. 4 = UTF-8")
34 38
35 (defvar YaTeX-kanji-code-alist 39 (defvar YaTeX-kanji-code-alist
36 (cond 40 (cond
37 ((boundp '*junet*) 41 ((boundp '*junet*)
38 (list '(0 . *noconv*) 42 (list '(0 . *noconv*)
41 (cond 45 (cond
42 (YaTeX-dos (if (boundp '*sjis-dos*) *sjis-dos* *sjis*dos)) 46 (YaTeX-dos (if (boundp '*sjis-dos*) *sjis-dos* *sjis*dos))
43 (YaTeX-macos (if (boundp '*sjis-mac*) *sjis-mac* *sjis*mac)) 47 (YaTeX-macos (if (boundp '*sjis-mac*) *sjis-mac* *sjis*mac))
44 (t *sjis*))) 48 (t *sjis*)))
45 '(2 . *junet*) '(3 . *euc-japan*))) 49 '(2 . *junet*) '(3 . *euc-japan*)))
46 (YaTeX-emacs-20 50 ((and YaTeX-emacs-20 (featurep 'mule))
47 ;;(cdr-safe(assq 'coding-system (assoc "Japanese" language-info-alist))) 51 ;;(cdr-safe(assq 'coding-system (assoc "Japanese" language-info-alist)))
48 (list '(0 . no-conversion) 52 (list '(0 . no-conversion)
49 (cons 53 (cons
50 1 (cond (YaTeX-dos 'shift_jis-dos) 54 1 (cond (YaTeX-dos 'shift_jis-dos)
51 (YaTeX-macos 'shift_jis-mac) 55 (YaTeX-macos 'shift_jis-mac)
52 ((member 'shift_jis (coding-system-list)) 'shift_jis-unix) 56 ((member 'shift_jis (coding-system-list)) 'shift_jis-unix)
53 (t 'sjis))) 57 (t 'sjis)))
54 '(2 . iso-2022-jp-unix) 58 '(2 . iso-2022-jp-unix)
55 '(3 . euc-jp-unix)))) 59 '(3 . euc-jp-unix)
60 '(4 . utf-8))))
56 "Kanji-code expression translation table.") 61 "Kanji-code expression translation table.")
57 (defvar YaTeX-inhibit-prefix-letter nil 62 (defvar YaTeX-inhibit-prefix-letter nil
58 "*T for changing key definitions from [prefix] Letter to [prefix] C-Letter.") 63 "*T for changing key definitions from [prefix] Letter to [prefix] C-Letter.")
59 64
60 (defvar YaTeX-no-begend-shortcut nil 65 (defvar YaTeX-no-begend-shortcut nil
77 "*Non-nil tries to find italic/bold fontset. 82 "*Non-nil tries to find italic/bold fontset.
78 This variable is effective when font-lock is used. 83 This variable is effective when font-lock is used.
79 \it, \bf 内部での日本語が□になってしまう場合はこれをnilにして下さい。") 84 \it, \bf 内部での日本語が□になってしまう場合はこれをnilにして下さい。")
80 85
81 ;----------- work variables ---------------------------------------- 86 ;----------- work variables ----------------------------------------
87 (defvar YaTeX-minibuffer-completion-map nil
88 "Minibuffer completion key map that allows comma completion.")
89 (if YaTeX-minibuffer-completion-map nil
90 (setq YaTeX-minibuffer-completion-map
91 (copy-keymap minibuffer-local-completion-map))
92 (define-key YaTeX-minibuffer-completion-map " "
93 'YaTeX-minibuffer-complete)
94 (define-key YaTeX-minibuffer-completion-map "\t"
95 'YaTeX-minibuffer-complete))
96
82 (defvar YaTeX-typesetting-mode-map nil 97 (defvar YaTeX-typesetting-mode-map nil
83 "Keymap used in YaTeX typesetting buffer") 98 "Keymap used in YaTeX typesetting buffer")
84 99
85 (if YaTeX-typesetting-mode-map nil 100 (if YaTeX-typesetting-mode-map nil
86 (setq YaTeX-typesetting-mode-map (make-keymap)) 101 (setq YaTeX-typesetting-mode-map (make-keymap))
125 (defvar YaTeX-user-table-is-read nil 140 (defvar YaTeX-user-table-is-read nil
126 "Flag that means whether user completion table has been read or not.") 141 "Flag that means whether user completion table has been read or not.")
127 ;;;###autoload 142 ;;;###autoload
128 (defun YaTeX-read-user-completion-table (&optional forcetoread) 143 (defun YaTeX-read-user-completion-table (&optional forcetoread)
129 "Append user completion table of LaTeX macros" 144 "Append user completion table of LaTeX macros"
145 (interactive)
130 (let*((user-table (expand-file-name YaTeX-user-completion-table)) 146 (let*((user-table (expand-file-name YaTeX-user-completion-table))
131 (local-table (expand-file-name (file-name-nondirectory user-table))) 147 (local-table (expand-file-name (file-name-nondirectory user-table)))
132 var localvar localbuf (curbuf (current-buffer)) sexp) 148 var localvar localbuf (curbuf (current-buffer)) sexp)
133 (if YaTeX-user-table-is-read nil 149 (if YaTeX-user-table-is-read nil
134 (message "Loading user completion table") 150 (message "Loading user completion table")
138 (cond 154 (cond
139 ((file-exists-p local-table) 155 ((file-exists-p local-table)
140 (set-buffer (setq localbuf (find-file-noselect local-table))) 156 (set-buffer (setq localbuf (find-file-noselect local-table)))
141 (widen) 157 (widen)
142 (goto-char (point-min)) 158 (goto-char (point-min))
143 (while (re-search-forward "(setq \\([^ ]+\\)" nil t) 159 (while (re-search-forward "(setq \\([^ \t\n]+\\)" nil t)
144 (setq var (intern (buffer-substring 160 (setq var (intern (buffer-substring
145 (match-beginning 1) (match-end 1))) 161 (match-beginning 1) (match-end 1)))
146 localvar (YaTeX-local-table-symbol var)) 162 localvar (YaTeX-local-table-symbol var))
147 (goto-char (match-beginning 0)) 163 (goto-char (match-beginning 0))
148 (setq sexp (buffer-substring (point) 164 (setq sexp (buffer-substring (point)
338 "Search REGEXP backward which is not commented out by regexp CMNTRX. 354 "Search REGEXP backward which is not commented out by regexp CMNTRX.
339 See also YaTeX-search-active-forward." 355 See also YaTeX-search-active-forward."
340 (YaTeX-search-active-forward 356 (YaTeX-search-active-forward
341 regexp cmntrx bound err cnt 're-search-backward)) 357 regexp cmntrx bound err cnt 're-search-backward))
342 358
359 (defun YaTeX-relative-path-p (path)
360 "Return non-nil if PATH is not absolute one."
361 (let ((md (match-data)))
362 (unwind-protect
363 (not (string-match "^\\(/\\|[a-z]:\\|\\\\\\).*/" file))
364 (store-match-data md))))
365
343 ;;;###autoload 366 ;;;###autoload
344 (defun YaTeX-switch-to-buffer (file &optional setbuf) 367 (defun YaTeX-switch-to-buffer (file &optional setbuf)
345 "Switch to buffer if buffer exists, find file if not. 368 "Switch to buffer if buffer exists, find file if not.
346 Optional second arg SETBUF t make use set-buffer instead of switch-to-buffer." 369 Optional second arg SETBUF t make use set-buffer instead of switch-to-buffer."
347 (interactive "Fswitch to file: ") 370 (interactive "Fswitch to file: ")
348 (if (bufferp file) 371 (if (bufferp file)
349 (setq file (buffer-file-name file)) 372 (setq file (buffer-file-name file))
350 (and (string-match "^[^/].*/" file) 373 (and (YaTeX-relative-path-p file)
351 (eq major-mode 'yatex-mode) 374 (eq major-mode 'yatex-mode)
352 YaTeX-search-file-from-top-directory 375 YaTeX-search-file-from-top-directory
353 (save-excursion 376 (save-excursion
354 (YaTeX-visit-main t) 377 (YaTeX-visit-main t)
355 (setq file (expand-file-name file))))) 378 (setq file (expand-file-name file)))))
371 (defun YaTeX-switch-to-buffer-other-window (file) 394 (defun YaTeX-switch-to-buffer-other-window (file)
372 "Switch to buffer if buffer exists, find file if not." 395 "Switch to buffer if buffer exists, find file if not."
373 (interactive "Fswitch to file: ") 396 (interactive "Fswitch to file: ")
374 (and (eq major-mode 'yatex-mode) 397 (and (eq major-mode 'yatex-mode)
375 (stringp file) 398 (stringp file)
376 (string-match "^[^/].*/" file) 399 (YaTeX-relative-path-p file)
377 YaTeX-search-file-from-top-directory 400 YaTeX-search-file-from-top-directory
378 (save-excursion 401 (save-excursion
379 (YaTeX-visit-main t) 402 (YaTeX-visit-main t)
380 (setq file (expand-file-name file)))) 403 (setq file (expand-file-name file))))
381 (if (bufferp file) (setq file (buffer-file-name file))) 404 (if (bufferp file) (setq file (buffer-file-name file)))
410 433
411 ;;;###autoload 434 ;;;###autoload
412 (defun YaTeX-replace-format (string format repl) 435 (defun YaTeX-replace-format (string format repl)
413 "In STRING, replace first appearance of FORMAT to REPL as if 436 "In STRING, replace first appearance of FORMAT to REPL as if
414 function `format' does. FORMAT does not contain `%'" 437 function `format' does. FORMAT does not contain `%'"
415 (let ((ans string)) 438 (let ((ans string) (case-fold-search nil))
416 (while (not (string= 439 (while (not (string=
417 ans (setq string (YaTeX-replace-format-sub ans format repl)))) 440 ans (setq string (YaTeX-replace-format-sub ans format repl))))
418 (setq ans string)) 441 (setq ans string))
419 string)) 442 string))
420 443
567 590
568 ;;;###autoload 591 ;;;###autoload
569 (defun YaTeX-match-string (n &optional m) 592 (defun YaTeX-match-string (n &optional m)
570 "Return (buffer-substring (match-beginning n) (match-beginning m))." 593 "Return (buffer-substring (match-beginning n) (match-beginning m))."
571 (if (match-beginning n) 594 (if (match-beginning n)
572 (buffer-substring (match-beginning n) 595 (YaTeX-buffer-substring (match-beginning n)
573 (match-end (or m n))))) 596 (match-end (or m n)))))
574 597
575 ;;;###autoload 598 ;;;###autoload
576 (defun YaTeX-minibuffer-complete () 599 (defun YaTeX-minibuffer-complete ()
577 "Complete in minibuffer. 600 "Complete in minibuffer.
977 (if (YaTeX-inner-environment limit-search-bound) 1000 (if (YaTeX-inner-environment limit-search-bound)
978 (progn 1001 (progn
979 (goto-char (get 'YaTeX-inner-environment 'point)) 1002 (goto-char (get 'YaTeX-inner-environment 'point))
980 (and end (YaTeX-goto-corresponding-environment)) 1003 (and end (YaTeX-goto-corresponding-environment))
981 (if (interactive-p) (push-mark op)) 1004 (if (interactive-p) (push-mark op))
982 t)))) 1005 (point)))))
983 1006
984 (defun YaTeX-end-of-environment (&optional limit-search-bound) 1007 (defun YaTeX-end-of-environment (&optional limit-search-bound)
985 "Goto the end of the current environment. 1008 "Goto the end of the current environment.
986 Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound 1009 Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound
987 to most recent sectioning command." 1010 to most recent sectioning command."
991 (defun YaTeX-mark-environment () 1014 (defun YaTeX-mark-environment ()
992 "Mark current position and move point to end of environment." 1015 "Mark current position and move point to end of environment."
993 (interactive) 1016 (interactive)
994 (let ((curp (point))) 1017 (let ((curp (point)))
995 (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) ;if on \\begin 1018 (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) ;if on \\begin
996 (forward-line 1) 1019 (progn (goto-char (match-end 0)))
997 (beginning-of-line)) 1020 (if (= (char-after (point)) ?\\) nil ;if on \\end
1021 (skip-chars-backward "^\n\\\\")
1022 (or (bolp) (forward-char -1))))
998 (if (not (YaTeX-end-of-environment)) ;arg1 turns to match-beginning 1 1023 (if (not (YaTeX-end-of-environment)) ;arg1 turns to match-beginning 1
999 (progn 1024 (progn
1000 (goto-char curp) 1025 (goto-char curp)
1001 (error "Cannot found the end of current environment.")) 1026 (error "Cannot found the end of current environment."))
1002 (YaTeX-goto-corresponding-environment) 1027 (YaTeX-goto-corresponding-environment)
1030 (insert (YaTeX-replace-format-args 1055 (insert (YaTeX-replace-format-args
1031 YaTeX-struct-begin env (YaTeX-addin env)))) 1056 YaTeX-struct-begin env (YaTeX-addin env))))
1032 ((eq what 'end) 1057 ((eq what 'end)
1033 (insert (YaTeX-replace-format-args YaTeX-struct-end env))) 1058 (insert (YaTeX-replace-format-args YaTeX-struct-end env)))
1034 (t nil))) 1059 (t nil)))
1060
1061 (defun YaTeX-string-width (str)
1062 "Return the display width of string."
1063 (if (fboundp 'string-width)
1064 (string-width str)
1065 (length str)))
1066 (defun YaTeX-truncate-string-width (str width)
1067 (cond
1068 ((fboundp 'truncate-string-to-width) (truncate-string-to-width str width))
1069 ((fboundp 'truncate-string) (truncate-string str width))
1070 (t (substring str 0 width))))
1035 1071
1036 ;;; Function for menu support 1072 ;;; Function for menu support
1037 (defun YaTeX-define-menu (keymap bindlist) 1073 (defun YaTeX-define-menu (keymap bindlist)
1038 "Define KEYMAP(symbol)'s menu-bindings according to BINDLIST. 1074 "Define KEYMAP(symbol)'s menu-bindings according to BINDLIST.
1039 KEYMAP should be a quoted symbol of newly allocated keymap. 1075 KEYMAP should be a quoted symbol of newly allocated keymap.
1091 1127
1092 (defun YaTeX-minibuffer-erase () 1128 (defun YaTeX-minibuffer-erase ()
1093 (if (eq (selected-window) (minibuffer-window)) 1129 (if (eq (selected-window) (minibuffer-window))
1094 (if (fboundp 'delete-field) (delete-field) (erase-buffer)))) 1130 (if (fboundp 'delete-field) (delete-field) (erase-buffer))))
1095 1131
1132 (fset 'YaTeX-buffer-substring
1133 (if (fboundp 'buffer-substring-no-properties)
1134 'buffer-substring-no-properties
1135 'buffer-substring))
1136
1096 ;;; 1137 ;;;
1097 ;; hilit19 vs. font-lock 1138 ;; hilit19 vs. font-lock
1098 ;;; 1139 ;;;
1140 (defvar YaTeX-19-functions-font-lock-direct
1141 '(YaTeX-19-re-search-in-env))
1142
1099 (defun YaTeX-convert-pattern-hilit2fontlock (h19pa) 1143 (defun YaTeX-convert-pattern-hilit2fontlock (h19pa)
1100 "Convert hilit19's H19PA patterns alist to font-lock's one. 1144 "Convert hilit19's H19PA patterns alist to font-lock's one.
1101 This function is a makeshift for YaTeX and yahtml." 1145 This function is a makeshift for YaTeX and yahtml."
1102 (let ((ignorecase (not (null (car h19pa)))) 1146 (let ((ignorecase (not (null (car h19pa))))
1103 (palist (cdr h19pa)) 1147 (palist (cdr h19pa))
1111 (decl . YaTeX-font-lock-declaration-face) 1155 (decl . YaTeX-font-lock-declaration-face)
1112 (label . YaTeX-font-lock-label-face) 1156 (label . YaTeX-font-lock-label-face)
1113 (crossref . YaTeX-font-lock-crossref-face) 1157 (crossref . YaTeX-font-lock-crossref-face)
1114 (include . YaTeX-font-lock-include-face) 1158 (include . YaTeX-font-lock-include-face)
1115 (formula . YaTeX-font-lock-formula-face) 1159 (formula . YaTeX-font-lock-formula-face)
1160 (delimiter . YaTeX-font-lock-delimiter-face)
1116 (string . ignore) (comment . ignore) 1161 (string . ignore) (comment . ignore)
1117 ))) 1162 )))
1118 (while (setq i (car palist)) 1163 (while (setq i (car palist))
1119 (setq newface (nth 2 i) 1164 (setq newface (nth 2 i)
1120 newface (or (cdr (assq newface mapping)) newface)) 1165 newface (or (cdr (assq newface mapping)) newface))
1136 ".*" 1181 ".*"
1137 (car (cdr i))) 1182 (car (cdr i)))
1138 0 (list 'quote newface) nil)) ;;'keep)) 1183 0 (list 'quote newface) nil)) ;;'keep))
1139 flpa))) 1184 flpa)))
1140 ((and (symbolp (car i)) (fboundp (car i))) 1185 ((and (symbolp (car i)) (fboundp (car i)))
1141 (setq flpa 1186 (if (memq (car i) YaTeX-19-functions-font-lock-direct)
1142 (cons 1187 ;; Put direct function call for it.
1143 (list (car (cdr i)) ;regexp 1188 ;; When calling this function, fontify entire matched string.
1144 (list 1189 (setq flpa
1145 (list 1190 (cons
1146 'lambda (list 'dummy) 1191 (list
1147 '(goto-char (match-beginning 0)) 1192 (list 'lambda (list 'dummy) ;dummy should be boundary
1148 '(remove-text-properties 1193 (list (car i) (list 'quote (car (cdr i)))))
1149 (point) (min (point-max) (1+ (point))) 1194 (list 0 newface))
1150 '(face nil font-lock-multiline nil)) 1195 flpa))
1196 (setq flpa
1197 (cons
1198 (list (car (cdr i)) ;regexp
1151 (list 1199 (list
1152 'let (list '(e (match-end 0))
1153 (list 'm (list (car i) (car (cdr i)))))
1154 (list 1200 (list
1155 'if 'm 1201 'lambda (list 'dummy)
1202 '(goto-char (match-beginning 0))
1203 (if (eq (nth 3 i) 'overwrite)
1204 nil
1205 '(remove-text-properties
1206 (point) (min (point-max) (1+ (point)))
1207 '(face nil font-lock-multiline nil)))
1156 (list 1208 (list
1157 'YaTeX-font-lock-fillin 1209 'let (list '(e (match-end 0))
1158 (list 'car 'm) 1210 (list 'm (list (car i) (car (cdr i)))))
1159 (list 'cdr 'm) 1211 (list
1160 (list 'quote 'face) 1212 'if 'm
1161 (list 'quote 'font-lock) 1213 (list
1162 (list 'quote newface)) 1214 'YaTeX-font-lock-fillin
1163 '(goto-char e) 1215 (list 'car 'm)
1164 )) 1216 (list 'cdr 'm)
1165 nil) ;retun nil to cheat font-lock 1217 (list 'quote 'face)
1166 nil nil)) ;pre-match, post-match both nil 1218 (list 'quote 'font-lock)
1167 flpa)))) 1219 (list 'quote newface))
1220 '(goto-char e)
1221 ))
1222 nil) ;retun nil to cheat font-lock
1223 nil nil)) ;pre-match, post-match both nil
1224 flpa)))))
1168 (setq palist (cdr palist)));while 1225 (setq palist (cdr palist)));while
1169 (if (featurep 'xemacsp) 1226 (if (featurep 'xemacsp)
1170 (nreverse flpa) 1227 (nreverse flpa)
1171 flpa))) 1228 flpa)))
1172 1229
1212 (t (:bold t :underline t))) 1269 (t (:bold t :underline t)))
1213 "Font Lock mode face used to highlight formula." 1270 "Font Lock mode face used to highlight formula."
1214 :group 'font-lock-faces) 1271 :group 'font-lock-faces)
1215 (defvar YaTeX-font-lock-formula-face 'YaTeX-font-lock-formula-face) 1272 (defvar YaTeX-font-lock-formula-face 'YaTeX-font-lock-formula-face)
1216 1273
1274 (defface YaTeX-font-lock-delimiter-face
1275 '((((class static-color)) (:bold t))
1276 (((type tty)) (:bold t))
1277 (((class color) (background dark))
1278 (:foreground "saddlebrown" :background "ivory" :bold t))
1279 (((class color) (background light)) (:foreground "red"))
1280 (t (:bold t :underline t)))
1281 "Font Lock mode face used to highlight delimiters."
1282 :group 'font-lock-faces)
1283 (defvar YaTeX-font-lock-delimiter-face 'YaTeX-font-lock-delimiter-face)
1284
1285 (defface YaTeX-font-lock-math-sub-face
1286 '((((class static-color)) (:bold t))
1287 (((type tty)) (:bold t))
1288 (((class color) (background dark))
1289 (:foreground "khaki" :bold t :underline t))
1290 (((class color) (background light))
1291 (:foreground "Goldenrod" :underline t))
1292 (t (:bold t :underline t)))
1293 "Font Lock mode face used to highlight subscripts in formula."
1294 :group 'font-lock-faces)
1295 (defvar YaTeX-font-lock-math-sub-face 'YaTeX-font-lock-math-sub-face)
1296
1297 (defface YaTeX-font-lock-math-sup-face
1298 '((((class static-color)) (:bold t))
1299 (((type tty)) (:bold t))
1300 (((class color) (background dark))
1301 (:bold nil :foreground "ivory" :background "lightyellow4"))
1302 (((class color) (background light))
1303 (:underline t :foreground "gold"))
1304 (t (:bold t :underline t)))
1305 "Font Lock mode face used to highlight superscripts in formula."
1306 :group 'font-lock-faces)
1307 (defvar YaTeX-font-lock-math-sup-face 'YaTeX-font-lock-math-sup-face)
1308
1217 (defface YaTeX-font-lock-crossref-face 1309 (defface YaTeX-font-lock-crossref-face
1218 '((((class color) (background dark)) (:foreground "lightgoldenrod")) 1310 '((((class color) (background dark)) (:foreground "lightgoldenrod"))
1219 (((class color) (background light)) (:foreground "DarkGoldenrod")) 1311 (((class color) (background light)) (:foreground "DarkGoldenrod"))
1220 (t (:bold t :underline t))) 1312 (t (:bold t :underline t)))
1221 "Font Lock mode face used to highlight cress references." 1313 "Font Lock mode face used to highlight cross references."
1222 :group 'font-lock-faces) 1314 :group 'font-lock-faces)
1223 (defvar YaTeX-font-lock-crossref-face 'YaTeX-font-lock-crossref-face) 1315 (defvar YaTeX-font-lock-crossref-face 'YaTeX-font-lock-crossref-face)
1224 1316
1225 (defface YaTeX-font-lock-bold-face 1317 (defface YaTeX-font-lock-bold-face
1226 '((t (:bold t))) 1318 '((t (:bold t)))
1298 "\t(put 'yahtml-mode 'font-lock-keywords 'html-mode)\n" 1390 "\t(put 'yahtml-mode 'font-lock-keywords 'html-mode)\n"
1299 "in your ~/.emacs file. Thank you."))) (point)) 1391 "in your ~/.emacs file. Thank you."))) (point))
1300 (select-window sw))) 1392 (select-window sw)))
1301 )) 1393 ))
1302 1394
1395 (defun YaTeX-assoc-regexp (elt alist)
1396 "Like assoc, return a list of whose car match with ELT. Search from ALIST.
1397 Note that each car of cons-cell is regexp. ELT is a plain text to be
1398 compared by regexp."
1399 (let (x)
1400 (catch 'found
1401 (while alist
1402 (setq x (car (car alist)))
1403 (if (string-match x elt)
1404 (throw 'found (car alist)))
1405 (setq alist (cdr alist))))))
1303 1406
1304 ;;; 1407 ;;;
1305 ;; Functions for the Installation time 1408 ;; Functions for the Installation time
1306 ;;; 1409 ;;;
1307 1410
1313 (featurep 'mule) 1416 (featurep 'mule)
1314 (set-language-environment "Japanese")) 1417 (set-language-environment "Japanese"))
1315 (mapcar 'byte-compile-file command-line-args-left) 1418 (mapcar 'byte-compile-file command-line-args-left)
1316 (kill-emacs)))) 1419 (kill-emacs))))
1317 1420
1421 (defun tfb-and-exit ()
1422 "Texinfo-format-buffer and kill-emacs."
1423 (if command-line-args-left
1424 (let ((load-path (cons ".." load-path)))
1425 (and (fboundp 'set-language-environment)
1426 (featurep 'mule)
1427 (set-language-environment "Japanese"))
1428 (mapcar (function
1429 (lambda (arg)
1430 (find-file arg)
1431 (texinfo-format-buffer)
1432 (basic-save-buffer)))
1433 command-line-args-left)
1434 (kill-emacs))))
1435
1318 (provide 'yatexlib) 1436 (provide 'yatexlib)
1319 ; Local variables: 1437 ; Local variables:
1320 ; fill-prefix: ";;; " 1438 ; fill-prefix: ";;; "
1321 ; paragraph-start: "^$\\| \\|;;;$" 1439 ; paragraph-start: "^$\\| \\|;;;$"
1322 ; paragraph-separate: "^$\\| \\|;;;$" 1440 ; paragraph-separate: "^$\\| \\|;;;$"
1323 ; buffer-file-coding-system: sjis 1441 ; coding: sjis
1324 ; End: 1442 ; End:

yatex.org