]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/auctex/tex-jp.el
Reverted commits 312, 313, and 315.
[gnu-emacs-elpa] / packages / auctex / tex-jp.el
index d5bb0b88a691c57aac2c322a8bc1d66d1f366741..6af377a809756db91574ee99b21d2298f8e3343a 100644 (file)
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 1999, 2001-2007, 2012  Free Software Foundation, Inc.
 
-;; Author:     KOBAYASHI Shinji <koba@flab.fujitsu.co.jp>
+;; Author:     KOBAYASHI Shinji <koba@flab.fujitsu.co.jp>,
 ;;             Hidenobu Nabetani <nabe@debian.or.jp>
 ;; Maintainer: Masayuki Ataka <masayuki.ataka@gmail.com>
 ;; Keywords: tex
   "Japanese support in AUCTeX."
   :group 'AUCTeX)
 
-(defcustom japanese-TeX-engine-default 'ptex
-  "Default TeX engine for Japanese TeX."
-  :group 'AUCTeX-jp
-  :type '(choice (const :tag "pTeX" ptex)
-                (const :tag "jTeX" jtex)
-                (const :tag "upTeX" uptex)))
-
-(setq TeX-engine-alist-builtin
-      (append TeX-engine-alist-builtin
-             '((ptex "pTeX" "ptex %(kanjiopt)" "platex %(kanjiopt)" "eptex")
-               (jtex "jTeX" "jtex" "jlatex" nil)
-               (uptex "upTeX" "euptex" "uplatex" "euptex"))))
-
-;; \e$B=gD4$K9T$1$PITMW$K$J$k!#\e(B
 (defcustom japanese-TeX-command-list
   ;; Changed to double quotes for Windows afflicted people.  I don't
   ;; use the %(latex) and %(tex) shorthands here because I have not
      TeX-run-TeX nil (plain-tex-mode) :help "Run NTT jTeX")
     ("jLaTeX" "%(PDF)jlatex %`%S%(PDFout)%(mode)%' %t"
      TeX-run-TeX nil (latex-mode) :help "Run NTT jLaTeX")
-    ("pTeX" "%(PDF)ptex %(kanjiopt)%`%S%(PDFout)%(mode)%' %t"
+    ("pTeX" "%(PDF)ptex %`%S%(PDFout)%(mode)%' %t"
      TeX-run-TeX nil (plain-tex-mode) :help "Run ASCII pTeX")
-    ("pLaTeX" "%(PDF)platex %(kanjiopt)%`%S%(PDFout)%(mode)%' %t"
+    ("pLaTeX" "%(PDF)platex %`%S%(PDFout)%(mode)%' %t"
      TeX-run-TeX nil (latex-mode) :help "Run ASCII pLaTeX")
-    ("Mendex" "mendex %(mendexkopt)%s" TeX-run-command nil t :help "Create index file with mendex")
-    ("jBibTeX" "jbibtex %s" TeX-run-BibTeX nil t :help "Run jBibTeX")
-    ("pBibTeX" "pbibtex %(kanjiopt)%s" TeX-run-BibTeX nil t :help "Run pBibTeX"))
+    ("Mendex" "mendex %s" TeX-run-command nil t :help "Create index file with mendex")
+    ("jBibTeX" "jbibtex %s" TeX-run-BibTeX nil t :help "Run jBibTeX"))
   "Additional list of commands, especially for Japanese.
-For detail, see `TeX-command-list', to which this list is appended."
+For detail, see `TeX-command-list', which this list is appended to."
   :group 'AUCTeX-jp
   :type '(repeat (group :value ("" "" TeX-run-command nil t)
                        (string :tag "Name")
@@ -89,7 +74,6 @@ For detail, see `TeX-command-list', to which this list is appended."
                                (function-item TeX-run-silent)
                                (function-item TeX-run-discard-foreground)
                                (function-item TeX-run-function)
-                               (function-item TeX-run-discard-or-function)
                                (function :tag "Other"))
                        (boolean :tag "Prompt")
                        (choice :tag "Modes"
@@ -102,155 +86,16 @@ For detail, see `TeX-command-list', to which this list is appended."
                                     (const :tag "AmSTeX" ams-tex-mode)))
                        (repeat :tag "Menu elements" :inline t sexp))))
 
-;; \e$B=gD4$K9T$1$PITMW$K$J$k!#\e(B
 (setq TeX-command-list
       (append japanese-TeX-command-list
              '(("-" "" ignore nil t)) ;; separator for command menu
              TeX-command-list))
 
-;; \e$B;CDj=hCV!#\e(Btex.el \e$B$K<h$j9~$s$G$b$i$($k$H$h$$!#\e(B
-(setcar (cdr (assoc "BibTeX" TeX-command-list)) "%(bibtex) %s")
-(setcar (cdr (assoc "Index" TeX-command-list)) "%(makeindex) %s")
-
-;; \e$B;CDj=hCV!#\e(Btex.el \e$B$K<h$j9~$s$G$b$i$($k$H$h$$!#\e(B
-(setq TeX-expand-list
-      (append
-       TeX-expand-list
-       '(
-        ;; -kanji \e$B%*%W%7%g%s$NJ8;zNs$r:n$k!#\e(B
-        ("%(kanjiopt)" (lambda ()
-                         (if (and
-                              ;; non-mule \e$B$J\e(B emacsen \e$B$O$=$b$=$bF|K\8l\e(B
-                              ;; \e$BJ8=q$r\e(B typeset \e$B$9$k$3$H$O9M$($J$/$F$b\e(B
-                              ;; \e$B$$$$$@$m$&!"$H$O;W$&$1$I0l1~!D!#\e(B
-                              (featurep 'mule)
-                              japanese-TeX-use-kanji-opt-flag)
-                             (let ((str (japanese-TeX-get-encoding-string)))
-                               (if str (format " -kanji=%s " str) ""))
-                           "")))
-        ;; pbibtex, jbibtex, upbibtex, bibtex \e$B$NCf$+$iE,@Z$J$b$N$rA*Br$9$k!#\e(B
-        ("%(bibtex)" (lambda ()
-                       (cond
-                        ((eq TeX-engine 'ptex)
-                         ;; pLaTeX \e$BMQF|K\8l\e(B BibTeX \e$B$,\e(B pbibtex \e$B$K$J$C$?\e(B
-                         ;; \e$B$N$OHf3SE*:G6a$J$N$G!"$^$@\e(B jbibtex \e$B$N?M$b$=\e(B
-                         ;; \e$B$l$J$j$K$$$k$@$m$&!#\e(B
-                         (if (executable-find "pbibtex")
-                             "pbibtex %(kanjiopt)" "jbibtex"))
-                        ((eq TeX-engine 'jtex) "jbibtex")
-                        ((eq TeX-engine 'uptex) "upbibtex")
-                        (t "bibtex"))))
-        ;; mendex \e$B$H\e(B makeindex \e$B$NE,@Z$JJ}$rA*Br$9$k!#\e(B
-        ("%(makeindex)" (lambda ()
-                          (if (memq TeX-engine '(ptex uptex))
-                              "mendex %(mendexkopt)" "makeindex")))
-        ;; mendex \e$BMQF|K\8l%3!<%I%*%W%7%g%s!#\e(B
-        ("%(mendexkopt)" (lambda ()
-                           (if (and (featurep 'mule)
-                                    japanese-TeX-use-kanji-opt-flag)
-                               (let ((str (japanese-TeX-get-encoding-string)))
-                                 ;; \e$B#1J8;zL\$rBgJ8;z$K!#\e(B
-                                 (if str (format " -%c " (upcase (aref str 0)))
-                                   ""))
-                             "")))
-        ;; pxdvi \e$B$H\e(B %(o?)xdvi \e$B$NE,@Z$JJ}$rA*Br$9$k!#\e(B
-        ("%(xdvi)" (lambda ()
-                     ;; pxdvi \e$B$O\e(B ptex, jtex \e$B6&MQ$J$N$G!"\e(B
-                     ;; japanese mode \e$B$+$I$&$+$GH=Dj$9$l$P\e(B OK\e$B!#\e(B
-                     (if (and japanese-TeX-mode (executable-find "pxdvi"))
-                         "pxdvi" "%(o?)xdvi"))))))
-
-;;; Viewing (new implementation)
-
-(unless (get 'TeX-view-predicate-list 'saved-value)
-  (setq TeX-view-predicate-list
-       '((paper-a4
-          (TeX-match-style
-           "\\`\\(a4j\\|a4paper\\|a4dutch\\|a4wide\\|sem-a4\\)\\'"))
-         (paper-a5
-          (TeX-match-style
-           "\\`\\(a5j\\|a5paper\\|a5comb\\)\\'"))
-         ;; jarticle \e$B$J$I$@$H\e(B b4paper, b5paper \e$B$O\e(B JIS B \e$B7ONs!#\e(B
-         ;; j-article \e$B$J$I$NJ}$K$O\e(B a4j, b5j \e$B$H$$$C$?%*%W%7%g%s$O$J$$!#\e(B
-         (paper-b5    ; ISO B5
-          (and (TeX-match-style "\\`b5paper\\'")
-               (not (memq TeX-engine '(ptex uptex)))))
-         (paper-b5jis ; JIS B5
-          (or (TeX-match-style "\\`b5j\\'")
-              (and (TeX-match-style "\\`b5paper\\'")
-                   (memq TeX-engine '(ptex uptex)))))
-         ;; article \e$B$J$I$K$O\e(B b4paper \e$B$H$$$&%*%W%7%g%s$O$J$$!#\e(B
-         ;; b4paper \e$B$H$$$&%*%W%7%g%s$,$"$C$?$i\e(B JIS B4 \e$B$H8+$J$9!#\e(B
-         (paper-b4jis
-          (TeX-match-style "\\`\\(b4j\\|b4paper\\)\\'")))))
-;; jsarticle \e$B$@$HB>$K$b$b$C$HH=7?$N%*%W%7%g%s$,$"$k$,!"\e(B
-;; \e$BA4ItLLE]8+$F$k$H%-%j$,$J$$$N$G!"$3$l$/$i$$$G$$$$$@$m$&!#\e(B
-;; jsarticle.el \e$B$d\e(B jsbook.el \e$B$GDI2CJ,$N=hM}$r;E9~$a$P$$$$$N$+$bCN$l$J$$!#\e(B
-
-;; \e$B;CDj=hCV!#\e(Btex.el \e$B$K<h$j9~$s$G$b$i$($k$H$h$$!#\e(B
-(unless (get 'TeX-view-program-list 'saved-value)
-  (setq TeX-view-program-list
-       (cond
-        ;; http://oku.edu.mie-u.ac.jp/~okumura/texwiki/?AUCTeX
-        ;; \e$B$r;29M$K$7$F$_$?!#\e(B
-        ((eq system-type 'windows-nt)
-         '(("Dviout" ("dviout -1 "
-                      ((paper-a4 paper-portrait) " -y=A4 ")
-                      ((paper-a4 paper-landscape) " -y=A4L ")
-                      ((paper-a5 paper-portrait) " -y=A5 ")
-                      ((paper-a5 paper-landscape) " -y=A5L ")
-                      ((paper-b5 paper-portrait) " -y=E5 ")
-                      ((paper-b5 paper-landscape) " -y=E5L ")
-                      ((paper-b4jis paper-portrait) " -y=B4 ")
-                      ((paper-b4jis paper-landscape) " -y=B4L ")
-                      ((paper-b5jis paper-portrait) " -y=B5 ")
-                      ((paper-b5jis paper-landscape) " -y=B5L ")
-                      (paper-legal " -y=Legal ")
-                      (paper-letter " -y=Letter ")
-                      (paper-executive " -y=Exective ")
-                      "%o" (mode-io-correlate " \"# %n '%b'\"")))
-           ("TeXworks" "TeXworks %o")
-           ("SumatraPDF" "SumatraPDF -reuse-instance %o"
-            (mode-io-correlate " -forward-search \"%b\" %n"))
-           ("MuPDF" "mupdf %o")))
-        ;; \e$B$3$l$G$$$$$N$+$I$&$+$OIT0B!#\e(B
-        ((eq system-type 'darwin)
-         '(("Preview" "open -a Preview.app %o")
-           ("TeXShop" "open -a TeXShop.app %o")
-           ("TeXworks" "open -a TeXworks.app %o")
-           ("Skim" "open -a Skim.app %o")
-           ("displayline" "displayline %n %o %b")
-           ("PictPrinter" "open -a PictPrinter.app %d")
-           ("Mxdvi" "open -a Mxdvi.app %d")
-           ("open" "open %o")))
-        (t
-         (setcar (cadr (assoc "xdvi" TeX-view-program-list-builtin))
-                 "%(xdvi) -unique")
-         '(("TeXworks" "texworks %o")
-           ("zathura" "zathura %o")
-           ("MuPDF" "mupdf %o"))))))
-
-;; \e$B$3$l$O\e(B tex.el \e$B$K<h$jF~$l$F$b$i$&$N$OFq$7$$$+!)\e(B
-;; tex-jp.el \e$B$,FI$_9~$^$l$k$@$1$G!"\e(Bdvi viewer \e$B$N%G%U%)%k%H$,\e(B dviout \e$B$K\e(B
-;; \e$B$J$C$F$7$^$&$N$ODq93$,Bg$-$$$+$b!#\e(B
-(unless (get 'TeX-view-program-selection 'saved-value)
-  (setq TeX-view-program-selection
-       (append
-        (cond
-         ((eq system-type 'windows-nt)
-          '((output-dvi "Dviout")
-            (output-pdf "TeXworks")))
-         ((eq system-type 'darwin)
-          '((output-pdf "Preview")))
-         (t
-          nil))
-        TeX-view-program-selection)))
-
 (mapc (lambda (dir) (add-to-list 'TeX-macro-global dir t))
       (or (TeX-tree-expand
           '("$SYSTEXMF" "$TEXMFLOCAL" "$TEXMFMAIN" "$TEXMFDIST")
-          "platex" '("/ptex/" "/pbibtex/bst/"))
-         '("/usr/share/texmf/ptex/" "/usr/share/texmf/pbibtex/bst/")))
+          "platex" '("/ptex/" "/jbibtex/bst/"))
+         '("/usr/share/texmf/ptex/" "/usr/share/texmf/jbibtex/bst/")))
 
 (mapc (lambda (dir) (add-to-list 'TeX-macro-global dir t))
       (or (TeX-tree-expand
@@ -258,14 +103,13 @@ For detail, see `TeX-command-list', to which this list is appended."
           "jlatex" '("/jtex/" "/jbibtex/bst/"))
          '("/usr/share/texmf/jtex/" "/usr/share/texmf/jbibtex/bst/")))
 
-;; \e$B=gD4$K9T$1$PITMW$K$J$k!#\e(B
+;; Menus
+
 (setq LaTeX-command-style
-      (append '(("\\`u[jt]\\(article\\|report\\|book\\)\\'\\|\\`uplatex\\'"
-                "%(PDF)uplatex %(kanjiopt)%S%(PDFout)")
-               ("\\`[jt]s?\\(article\\|report\\|book\\)\\'"
-                "%(PDF)platex %(kanjiopt)%S%(PDFout)")
-               ("\\`j-\\(article\\|report\\|book\\)\\'"
-                "%(PDF)jlatex %(kanjiopt)%S%(PDFout)"))
+      (append '(("^j-\\(article\\|report\\|book\\)$"
+                "%(PDF)jlatex %S%(PDFout)")
+               ("^[jt]s?\\(article\\|report\\|book\\)$"
+                "%(PDF)platex %S%(PDFout)"))
              LaTeX-command-style))
 
 (defcustom japanese-TeX-error-messages t
@@ -276,7 +120,7 @@ For detail, see `TeX-command-list', to which this list is appended."
 (when (featurep 'mule)
 
 ;; FIX-ME (2007-02-09) The default coding system in recent Unix (like Fedora and
-;; Ubuntu) is utf-8.  But Japanese TeX system does not support utf-8 yet
+;; Ubuntu) is utf-8.  But Japanese TeX system is not support utf-8 yet
 ;; (platex-utf is under development, may be alpha phase).  So,
 ;; process-coding-system for Japanese TeX is not defined from
 ;; default-coding-system.  When platex-utf is out, we should look this setting,
@@ -300,14 +144,12 @@ For detail, see `TeX-command-list', to which this list is appended."
 
 )
 
-;; \e$B=gD4$K9T$1$PITMW$K$J$k!#\e(B
 (defcustom japanese-TeX-command-default "pTeX"
   "*The default command for `TeX-command' in the japanese-TeX mode."
   :group 'AUCTeX-jp
   :type 'string)
   (make-variable-buffer-local 'japanese-TeX-command-default)
 
-;; \e$B=gD4$K9T$1$PITMW$K$J$k!#\e(B
 (defcustom japanese-LaTeX-command-default "LaTeX"
   "*The default command for `TeX-command' in the japanese-LaTeX mode."
   :group 'AUCTeX-jp
@@ -351,55 +193,6 @@ For detail, see `TeX-command-list', to which this list is appended."
                                 TeX-japanese-process-input-coding-system)))
 (setq TeX-after-start-process-function
       'japanese-TeX-set-process-coding-system)
-
-(defcustom japanese-TeX-use-kanji-opt-flag t
-  "Add kanji option to Japanese pTeX family if non-nil."
-  :group 'AUCTeX-jp
-  :type 'boolean)
-
-(defun japanese-TeX-coding-ejsu (coding-system)
-  "Convert japanese CODING-SYSTEM to mnemonic string.
-euc-jp:    \"euc\"
-jis:       \"jis\"
-shift_jis: \"sjis\"
-utf-8:     \"utf8\"
-Return nil otherwise."
-  (let ((base (coding-system-base coding-system)))
-    (cdr (assq base
-              '((japanese-iso-8bit . "euc")
-                (iso-2022-jp . "jis")
-                (japanese-shift-jis . "sjis")
-                (utf-8 . "utf8")
-
-                ;; xemacs \e$B$@$H0J2<$NL>A0$O0c$&$+$b!D!#\e(B
-                (euc-jis-2004 . "euc")
-                (iso-2022-jp-2004 . "jis")
-                (japanese-shift-jis-2004 . "sjis")
-
-                (japanese-cp932 . "sjis")
-                (eucjp-ms . "euc"))))))
-
-(defun japanese-TeX-get-encoding-string ()
-  "Return coding option string for Japanese pTeX family.
-For inappropriate encoding, nil instead."
-  (or (japanese-TeX-coding-ejsu buffer-file-coding-system)
-
-      ;; \e$BJ#?t%U%!%$%k$KJ,3d$7$?J8=q$N>l9g!"\e(Bemacs \e$B$G3+$$$?%U%!%$%k$,F|K\\e(B
-      ;; \e$B8l$r#1;z$b4^$^$J$$$3$H$,$"$k!#$3$N$?$a!"$=$N%U%!%$%k$N\e(B
-      ;; buffer-file-coding-system \e$B$OF|K\8l%3!<%I$,ITDj$KN1$^$C$F\e(B
-      ;; \e$B$7$^$&2DG=@-$,$"$k!#$=$N$h$&$J>l9g!"\e(Bmaster file \e$B$N\e(B
-      ;; buffer-file-coding-system \e$B$r;H$&!#\e(B
-      (if (stringp TeX-master) ; \e$B<+J,$,;R%U%!%$%k$N$H$-\e(B
-         (let ((buf (get-file-buffer (TeX-master-file t))))
-           (if buf
-               (japanese-TeX-coding-ejsu
-                (with-current-buffer buf buffer-file-coding-system)))))
-
-      ;; \e$B$=$l$G$b7h$a$i$l$J$$>l9g$O\e(B buffer-file-coding-system \e$B$N\e(B
-      ;; default \e$BCM$r;H$&!#\e(B
-      (japanese-TeX-coding-ejsu
-       (default-value 'buffer-file-coding-system))))
-
 )
 
 ;;; Japanese TeX modes
@@ -420,8 +213,7 @@ Set `japanese-TeX-mode' to t, and enter `TeX-plain-tex-mode'."
 (defun japanese-plain-tex-mode-initialization ()
   "Japanese plain-TeX specific initializations."
   (when japanese-TeX-mode
-;    (setq TeX-command-default japanese-TeX-command-default)
-    (TeX-engine-set japanese-TeX-engine-default)))
+    (setq TeX-command-default japanese-TeX-command-default)))
 
 (add-hook 'plain-TeX-mode-hook 'japanese-plain-tex-mode-initialization)
 
@@ -436,24 +228,9 @@ Set `japanese-TeX-mode' to t, and enter `TeX-latex-mode'."
 (defun japanese-latex-mode-initialization ()
   "Japanese LaTeX specific initializations."
   (when japanese-TeX-mode
-;    (setq TeX-command-default japanese-LaTeX-command-default)
-    (TeX-engine-set
-     ;; class file \e$BL>$KMj$k$N$O@5$7$$$N$+!)\e(B
-     ;; jLaTeX \e$B$K$b\e(B jarticle \e$B$O0l1~$"$k$7!"\e(BpLaTeX \e$B$G$b<+J,$G\e(B j-article \e$B$r\e(B
-     ;; \e$B%$%s%9%H!<%k$7$F;H$C$F$$$1$J$$K!$O$J$$!#\e(B
-     (cond
-      ((TeX-match-style "\\`u[jt]\\(article\\|report\\|book\\)\\'\\|\\`uplatex\\'")
-       'uptex)
-      ((TeX-match-style "\\`[jt]s?\\(article\\|report\\|book\\)\\'")
-       'ptex)
-      ((TeX-match-style "\\`j-\\(article\\|report\\|book\\)\\'")
-       'jtex)
-      (t japanese-TeX-engine-default)))
+    (setq TeX-command-default japanese-LaTeX-command-default)
     (setq LaTeX-default-style japanese-LaTeX-default-style)
-;    (setq TeX-command-BibTeX
-;        (if (and (eq TeX-engine 'ptex) (executable-find "pbibtex"))
-;            "pBibTeX" "jBibTeX"))
-))
+    (setq TeX-command-BibTeX "jBibTeX")))
 
 (add-hook 'LaTeX-mode-hook 'japanese-latex-mode-initialization)
 
@@ -599,10 +376,10 @@ thebibliography\e$B4D6-$G0z?t$rK:$l$?>l9g$K$b@8$8$^$9!%\e(B")
 \e$B$K@8$8$^$9!%$3$NLdBj$O4D6-$N$&$A$N$$$/$D$+$rJ8=q$N=*$o$j$NJ}$K0\F0$9$l\e(B
 \e$B$P2r7h$G$-$^$9!%$^$?!$$3$N%(%i!<$O\e(B``logjam''\e$B$K$h$C$F@8$8$k$3$H$b$"$j$^\e(B
 \e$B$9!%\e(B``logjam''\e$B$H$O!$\e(BLaTeX\e$B$,=P8==g=xDL$j$K$7$+?^I=$r=PNO$G$-$J$$$;$$$G!$\e(B
-\e$B?^I=$N=PNO$,\e(B1\e$B%v=j$G$b$D$^$k$H$=$N8e$m$N?^I=$,8.JB$_$9$Y$F$D$C$+$($F$7$^\e(B
-\e$B$&$3$H$r$$$$$^$9!%$3$N%8%c%`$N860x$O!$Bg$-$9$.$F\e(B1\e$B%Z!<%8$J$$$7$O%*%W%7%g\e(B
-\e$B%s0z?t$G;XDj$5$l$?0LCV$K<}$^$i$J$$$h$&$J?^$dI=$G$"$k2DG=@-$,$"$j$^$9!%$3\e(B
-\e$B$l$O!$0z?t$K\e(Bp\e$B%*%W%7%g%s$,;XDj$5$l$F$$$J$$$H5/$-$d$9$/$J$j$^$9!%\e(B")
+\e$B$D$^$C$F$$$k8e$m$N?^I=$N$?$a$KA0$N?^I=$r=PNO$G$-$J$/$J$k$3$H$r$$$$$^$9!%\e(B
+\e$B$3$N%8%c%`$N860x$O!$Bg$-$9$.$F\e(B1\e$B%Z!<%8$J$$$7$O;XDj$5$l$?NN0h$K<}$^$i$J\e(B
+\e$B$$$h$&$J?^$dI=$G$"$k2DG=@-$,$"$j$^$9!%$3$l$O!$0z?t$K\e(Bp\e$B%*%W%7%g%s$,;XDj\e(B
+\e$B$5$l$F$$$J$$$H5/$-$d$9$/$J$j$^$9!%\e(B")
 
     ("Undefined tab position." .
 "\\>\e$B!&\e(B\\+\e$B!&\e(B\\-\e$B$^$?$O\e(B\\<\e$BL?Na$G!$B8:_$7$J$$%?%V0LCV!$$9$J$o$A\e(B\\=\e$BL?Na$GDj\e(B