yatex

diff yatexgen.el @ 623:6a0fea36298f

Code cleaning for Emacs31
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 01 Aug 2026 13:51:09 +0900
parents 2011de73a671
children
line diff
     1.1 --- a/yatexgen.el	Tue Feb 21 15:46:12 2017 +0859
     1.2 +++ b/yatexgen.el	Sat Aug 01 13:51:09 2026 +0900
     1.3 @@ -1,7 +1,7 @@
     1.4 -;;; yatexgen.el --- YaTeX add-in function generator(rev.5)
     1.5 +;;; yatexgen.el --- YaTeX add-in function generator(rev.5) -*- lexical-binding: nil -*-
     1.6  
     1.7 -;;; (c)1991-1995,1999,2000,2017 by HIROSE Yuuji.[yuuji@yatex.org]
     1.8 -;;; Last modified Sun Dec 21 14:04:49 2014 on firestorm
     1.9 +;;; (c)1991-1995,1999,2000,2017,2026 by HIROSE Yuuji.[yuuji@yatex.org]
    1.10 +;;; Last modified Sat Aug  1 12:17:51 2026 on firestorm
    1.11  ;;; $Id$
    1.12  
    1.13  ;;; Code:
    1.14 @@ -13,14 +13,15 @@
    1.15  
    1.16  (put 'YaTeX-setq 'lisp-indent-hook 1)
    1.17  
    1.18 +(defvar YaTeX-generate-initial-message nil)
    1.19  (YaTeX-setq YaTeX-generate-initial-message
    1.20    "             自動生成モードへようこそ!!
    1.21  
    1.22 -初めてやる人はこのバッファの例にしたがって指示通りにやって練習してね。
    1.23 -本番の時もこのバッファに出るメッセージを *よく読んで* 操作しないとう
    1.24 -まく関数が作れないよ!!
    1.25 +初めてやる人はこのバッファの例にしたがって指示通りにやって練習するよろし。
    1.26 +本番の時もこのバッファに出る案内を *よく読んで* 操作されたし。
    1.27 +さらば具合よき関数は得られぬ!!
    1.28  
    1.29 -  ではリターンキーを押して下さい。"
    1.30 +  ではEnterを。"
    1.31    "             Welcome to auto-generation mode!!
    1.32  
    1.33  If this is your first trial, exercise this according to example and
    1.34 @@ -30,68 +31,79 @@
    1.35  
    1.36    Hit return key!")
    1.37  
    1.38 +(defvar YaTeX-generate-start-message nil)
    1.39  (YaTeX-setq YaTeX-generate-start-message
    1.40 -  "さぁはじめるよ.\n1.登録したい補完をやってみて.
    1.41 +  "ではとりかかろう.\n1.アドインを登録したい補完を入力されたし.
    1.42  たとえば section 型補完の \\documentstyle だったら \\documentstyle{}
    1.43 -だけをいれてみてね. ちゃんと『〜型補完』を使わないとダメよ!。
    1.44 -で、おわったらりたーん!!"
    1.45 +だけを入れることになる. ぬかりなく『〜型補完』を使わねばならぬ!。
    1.46 +その上でEnter!!"
    1.47    "Let's begin completion for which you want to make add-in function.
    1.48  If you want to make add-in function for \\documentstyle input only
    1.49  `\\documentstyle{}' *with* completion of yatex-mode.
    1.50  If you finish this, please press RET.")
    1.51  
    1.52 +(defvar YaTeX-generate-abort-message nil)
    1.53  (YaTeX-setq YaTeX-generate-abort-message
    1.54 -  "やめた、やめた〜いめんどくせ〜"
    1.55 +  "もはや撤退のときである、しからばごめん"
    1.56    "Aborted.")
    1.57  
    1.58 +(defvar YaTeX-generate-same-message nil)
    1.59  (YaTeX-setq YaTeX-generate-same-message
    1.60 -  "それじゃ、なにも変わってねぇだろーが! やめた。"
    1.61 +  "なにも変わってないでござるな! 中止にて候。"
    1.62    "I found no difference between them.  So I'm quitting.")
    1.63  
    1.64 +(defvar YaTeX-generate-invalid-message nil)
    1.65  (YaTeX-setq YaTeX-generate-invalid-message
    1.66    "それは、ちと無理というものじゃ."
    1.67    "It's impossible.")
    1.68  
    1.69 +(defvar YaTeX-generate-idontknow-message nil)
    1.70  (YaTeX-setq YaTeX-generate-idontknow-message
    1.71 -  "う〜ん、難しくてよくわからないなぁ。ばかでごめんねェ〜"
    1.72 +  "ぐぬぬ、難しくてよくわからんでござる。拙者には四千年早かったようだ。"
    1.73    "Sorry I can't tell your adding method.")
    1.74  
    1.75 +(defvar YaTeX-generate-confirm-message nil)
    1.76  (YaTeX-setq YaTeX-generate-confirm-message
    1.77 -  "ということは、付け足したい部分はこれでいいのね"
    1.78 +  "さすれば、付け足したい部分はこれでよかろうか"
    1.79    "Is it additional string of add-in function?")
    1.80  
    1.81 +(defvar YaTeX-generate-output-message nil)
    1.82  (YaTeX-setq YaTeX-generate-output-message
    1.83 -  "2.じゃ、それにくっつけたいものを *カーソルの位置に* 足してみて. 
    1.84 -さっきの \\documentstyle{} の例だと \\documentstyle[12pt]{} とかにするの。
    1.85 -しつこいようだけど、今の位置からカーソル動かしちゃダメよ!!
    1.86 -で、またおわったらりたーん!!"
    1.87 +  "2.せば、それに結合したきものを *カーソルの位置に* 足されよ。
    1.88 +先刻の \\documentstyle{} の例だと \\documentstyle[12pt]{} となろう。
    1.89 +執拗御免被りたいが、今の位置からカーソル動かすのは御法度でござるぞ!!
    1.90 +しこうして、完了後にEnterじゃ!!"
    1.91    "2.Then input additional string *at CURSOR POSITION*
    1.92  According to last example \\documentstyle{},
    1.93  modify it \\documentstyle[12pt]{}.  RET to finish.")
    1.94  
    1.95 +(defvar YaTeX-generate-put-arg-message nil)
    1.96  (YaTeX-setq YaTeX-generate-put-arg-message
    1.97 -  "3.このうち、キーボードから読み込んで欲しい文字列を順に入れて。
    1.98 -さっきの \\documentstyle[12pt]{} だったら、付加する文字は[12pt]だけど
    1.99 -手で入れたいのは 12pt の部分だけですね。
   1.100 -で、全部入れ終ったら、りたーんだけうってね!!"
   1.101 +  "3.これのうち、キーボードから読み込んで欲しい文字列を順に入れてくだされ。
   1.102 +先刻の \\documentstyle[12pt]{} であらば、付加する文字は[12pt]じゃが
   1.103 +手で入れたいのは 12pt の部分だけであろう。
   1.104 +全部入れ終ったら、Enterで完了である!!"
   1.105    "3.In this string, extract string which you want to input from key
   1.106  board with quiry afterwards.  For example, though additional string is
   1.107  \\documentstyle[12pt]{}, but you want enter only `12pt' by hand.
   1.108  RET to finish!")
   1.109  
   1.110 +(defvar YaTeX-generate-read-prompt-message nil)
   1.111  (YaTeX-setq YaTeX-generate-read-prompt-message
   1.112 -  "4.では、あとでこれらの文字列を読み込む時に、どういうプロンプトを
   1.113 -出したいですか? 順に入れて下さい。面倒なら単にリターンを打ってね。
   1.114 -さっきの 12pt の部分だったら、『サイズは』とかがおすすめ。"
   1.115 +  "4.では、後にこれらの文字列を読み込む時に、案内として出すべきプロンプトを
   1.116 +順に入れてくだされ。面倒なら単にEnterでよき。
   1.117 +先の 12pt の部分だったら、『サイズは』とかを推奨致す。"
   1.118    "4.When you use this add-in function afterwards, what message
   1.119  do you like to be prompted with to enter these values.  In last
   1.120  example `12pt', typical prompt string may be `Size?: '.")
   1.121  
   1.122 +(defvar YaTeX-generate-done-message nil)
   1.123  (YaTeX-setq YaTeX-generate-done-message
   1.124 -  "よし! これが、君の作りたかった関数だ。~/.emacs にでも入れてせいぜい
   1.125 -楽してくれ。このバッファ(*ご案内*)を yatex-mode にしておくから
   1.126 -できた関数が本当にお望みの動作をするか確かめてみるといいかもね。
   1.127 -  ところで、この関数こんなに簡単だろう? そろそろ自分で書いたらどう?
   1.128 +  "よし! これが、うぬの作りたかった関数だ。~/.emacs にでも入れてせいぜい
   1.129 +楽するがよかろう。このバッファ(*ご案内*)を yatex-mode にしておくゆえ
   1.130 +できた関数が本当にお望みの動作をするか確かめてみるがよかろう。
   1.131 +  ところで、この関数こんなに簡単と察せられたのではなかろうか?
   1.132 +そろそろ自分で書いたら如何であるか?
   1.133  "
   1.134    "OK! This is the definition of function you want to make!  Add
   1.135  this description to your ~/.emacs or so.  Use this buffer(*Guide*)
   1.136 @@ -100,26 +112,31 @@
   1.137  write your most favorite add-in function yourself!
   1.138  ")
   1.139  
   1.140 +(defvar YaTeX-generate-nomatch-message nil)
   1.141  (YaTeX-setq YaTeX-generate-nomatch-message
   1.142 -  "こらこら、そんな文字列どこにもねーぞ!!"
   1.143 +  "こらこら、そんな文字列どこにも見当たらぬ。!!"
   1.144    "No such string in additional string.")
   1.145  
   1.146 +(defvar YaTeX-generate-buffer nil)
   1.147  (YaTeX-setq YaTeX-generate-buffer
   1.148    "*付加関数生成バッファ*"
   1.149    "*Generate-add-in-function*")
   1.150  
   1.151 +(defvar YaTeX-generate-message-buffer nil)
   1.152  (YaTeX-setq YaTeX-generate-message-buffer
   1.153    "*ご案内*"
   1.154    "*Guide*")
   1.155  
   1.156 +(defvar YaTeX-generate-bug-message nil)
   1.157  (YaTeX-setq YaTeX-generate-bug-message
   1.158 -  "ごめ〜ん!! ちょっと、このアドイン関数つくるの失敗しちゃったみたい!!
   1.159 -作者まで連絡してくださ〜〜〜い!"
   1.160 +  "これは痛恨の極み!! 拙者、このアドイン関数作成をし損なったようである!!
   1.161 +何卒作者まで連絡してくださらぬか!"
   1.162    "Sorry I failed to make add-in function for you...
   1.163  Send bug report to me.")
   1.164  
   1.165 +(defvar YaTeX-generate-narrow-message nil)
   1.166  (YaTeX-setq YaTeX-generate-narrow-message
   1.167 -  "画面がせますぎるような気がします。"
   1.168 +  "画面が窮屈である。広げてはくださらぬか。"
   1.169    "Too narrow screen height.")
   1.170  
   1.171  (defvar YaTeX-generate-message-height
   1.172 @@ -127,8 +144,8 @@
   1.173  
   1.174  ;; Do you need learning for generated function?
   1.175  ;; If you need, please tell me (yuuji@yatex.org)
   1.176 -;;(defvar YaTeX-generate-variables-for-learning nil)
   1.177 -;;(defvar YaTeX-generate-current-completion-table nil)
   1.178 +(defvar YaTeX-generate-variables-for-learning nil)
   1.179 +(defvar YaTeX-generate-current-completion-table nil)
   1.180  
   1.181  ;;;
   1.182  ;Generate mode.
   1.183 @@ -231,7 +248,7 @@
   1.184    (YaTeX-generate-display-message YaTeX-generate-done-message)
   1.185    (switch-to-buffer YaTeX-generate-buffer)
   1.186    (condition-case error
   1.187 -      (eval-current-buffer)
   1.188 +      (YaTeX-eval-buffer)
   1.189      (error (insert YaTeX-generate-bug-message)))
   1.190    (pop-to-buffer YaTeX-generate-message-buffer))
   1.191  
   1.192 @@ -520,7 +537,7 @@
   1.193      (insert "))\n")			;close defun
   1.194      (goto-char (point-min))
   1.195      (while (not (eobp)) (lisp-indent-line) (forward-line 1))
   1.196 -    (eval-current-buffer)
   1.197 +    (YaTeX-eval-buffer)
   1.198      buf))
   1.199  
   1.200  (defun YaTeX-generate-argument-type (command argc)
   1.201 @@ -551,7 +568,7 @@
   1.202      (insert "))\n")
   1.203      (goto-char (point-min))
   1.204      (while (not (eobp)) (lisp-indent-line) (forward-line 1))
   1.205 -    (eval-current-buffer)
   1.206 +    (YaTeX-eval-buffer)
   1.207      (set-buffer cb)
   1.208      (YaTeX-update-table
   1.209       (if (> argc 1) (list command argc) (list command))