# HG changeset patch
# User yuuji
# Date 882278918 0
# Node ID 36a48185b95a30b617a1c8c91fb2eb1567a32f15
# Parent 6ad4a239973177a53c82fe942e8e32a47505b613
Changes are listed in yatex.new.
Major one is supporing GNU Emacs20 and XEmacs.
diff -r 6ad4a2399731 -r 36a48185b95a docs/htmlqa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/htmlqa Tue Dec 16 13:28:38 1997 +0000
@@ -0,0 +1,98 @@
+%%
+%% Q and A on yahtml
+%%
+%% C-u C-x $ とすると質問項目だけ表示されます。C-x $ で元に戻ります。
+%%
+
+
+■インストール関連
+・LaTeX使わないんだけど野鳥も入れなきゃダメですか?
+
+ そうなにょ。野鳥のライブラリ関数を使っているので野鳥も棲まわせて
+ やって下さいまし。
+
+■カスタマイズ関連
+・いつもは EUC にしてたまに JIS コードのファイルを作りたいんだけど。
+
+ ~/.emacs で
+ (setq yahtml-kanji-code 3) ;3はEUC
+ しておけば普段のhtmlコードはEUCになります。JISにしたいときは、
+ htmlソースのお尻に、
+
+
+
+
+
+ と書いておけばそのファイルだけJISになります。
+
+■どうにかならんかなあ関連
+・長い文書の下の方だとインデントがめちゃ遅いんだけど。
+
+ 今は直ってるはずです…。
+
+・いつも雛型として使っている template.html を簡単に入れたい
+
+ autoinsert.el (Emacs19/Mule2付属)を使いましょう。もしくは、それ
+ の機能強化版 auto-insert-tkld を使いましょう。後者は、
+ ftp://ftp.ae.keio.ac.jp/pub/emacs-lisp/util/auto-inset-tkld.tar.Z
+ で入手できます。
+ http://www-nagao.kuee.kyoto-u.ac.jp/member/tsuchiya/elisp-tips.html#yahtml-mode-hook
+ に設定例が書いてあります。
+
+■その他
+・yahtmlってなんてよむの?
+
+ がーん、良く聞かれます。
+ 作者も良く分かってません。えへん。
+ というかかちょいい読み方が思い浮かばないもので。
+ なんかいい読み方ないすか?
+ 突然思い付きました。正しい呼称は
+
+ 『HTML屋』
+
+ とします。
+
+・メイリングリストはないんですか?
+
+ っていう質問項目があるくらいだからあります。「yahtml」およびそのVz
+ への移植版「laihtml」(by katsura@prc.tsukuba.ac.jp)、Wzへの移植版
+ 「hackhtml」(by lh57024@hongo.ecc.u-tokyo.ac.jp) に関する情報交換の
+ ためのメイリングリスト「fj野鳥の会」がそれです。
+
+ To: yatex-control@jaist.ac.jp
+ Subject: append
+ -----
+ たぐでーし。明けましておめでとうございまーす。
+
+ のようにメイルを送れば加入できます。この時本文に書いた内容がプロ
+ フィールとして登録されます(変更可)。手続きは全て自動で行われ、登
+ 録が完了すると確認とともに、参加/休止/脱会等の制御コマンドの利用
+ 方法が返送されます。是非参加して一緒に野鳥/雷鳥/白鳥を育ててくだ
+ さい。
+
+・yahtmlの最新情報は?
+
+ もしあなたが、WWWにアクセスできるなら、
+ http://www.comp.ae.keio.ac.jp/~yuuji/yatex/
+ を覗いてみて下さい。このなかの、「yatex-current」というリンクを
+ たどると最新版の野鳥を入手することができます。ただし、正式リリー
+ ス版ではなく、作者がデバッグ中だったりして正常に動作しない可能性
+ があるので、current版に関する問い合わせは受けかねますのでご注意
+ 下さい。
+
+・とにかくわかりませーん!
+
+ 回答を得るまでの早い順に
+
+ ・近くにいる詳しい人に聞く
+ ・メイリングリストに質問を出す
+ ・yuuji@ae.keio.ac.jp に質問を出す
+
+ でしょうか。お好きな方法でどうぞ。
+
+
+Local Variables:
+mode: indented-text
+fill-column: 72
+fill-prefix: " "
+End:
diff -r 6ad4a2399731 -r 36a48185b95a docs/yatexj.tex
--- a/docs/yatexj.tex Sat Dec 13 12:41:43 1997 +0000
+++ b/docs/yatexj.tex Tue Dec 16 13:28:38 1997 +0000
@@ -5,6 +5,9 @@
@iftex
@c @syncodeindex fn cp
+@c いつも忘れるのでここに書いとくか。
+@c ノードいじったら C-l C-u C-e
+@c メニュー増やしたら C-l C-u C-m
@syncodeindex vr cp
@end iftex
@@ -14,7 +17,7 @@
@subtitle Yet Another tex-mode for emacs
@title 『野鳥』
@subtitle // YaTeX //
-@author @copyright{} 1991-1996 by HIROSE, Yuuji [yuuji@@ae.keio.ac.jp]
+@author @copyright{} 1991-1997 by HIROSE, Yuuji [yuuji@@ae.keio.ac.jp]
@end titlepage
@node Top, Intro, (dir), (dir)
@@ -227,7 +230,9 @@
@item dvi2-command
@dots{} 起動するプレヴューアのコマンド名
@item NTT-jTeX
- @dots{} NTT jTeX を使用するなら t
+ @dots{} 改行+インデントによって、タイプセット後の字間が空いてしま
+ うのを抑制する場合にtにする(古いNTT-jTeXで顕著に現れる)。具体的には、
+ fillするときに各行の終わりに%を付加するようになる。
@item YaTeX-kanji-code
@dots{} 文書を作成する時の漢字コード
@item dviprint-command-format
@@ -1247,7 +1252,7 @@
いる拡張子を「ファイル名」の後ろに足したファイルが存在するか順次調べて、存
在した場合car部に入っているコマンドを起動する。
@item
-以上どれかにマッチしなければあきる。
+以上どれかにマッチしなければあきらめる。
@end enumerate
@@ -1865,7 +1870,9 @@
@end defvar
@defvar NTT-jTeX
-NTT-j@TeX{}使用時は@code{t}にする (@code{nil})
+古いNTT-j@TeX{}使用時のようにインデントした行の先頭と前の行の
+(タイプセット後の)字間が空いてしまうのを嫌う場合は@code{t}にする
+(@code{nil})
@end defvar
@defvar YaTeX-item-regexp
@@ -1976,6 +1983,10 @@
AMS-LaTeX を使用する場合は @code{t} に設定する (@code{nil})
@end defvar
+@defvar YaTeX-template-file
+新規ファイル作成時に自動挿入するファイル名 (@code{~/work/template.tex})
+@end defvar
+
@node Sample definitions, Hook variables, All customizable variables, Lisp variables
@comment node-name, next, previous, up
@subsection カスタマイズ変数設定例
diff -r 6ad4a2399731 -r 36a48185b95a yahtml.el
--- a/yahtml.el Sat Dec 13 12:41:43 1997 +0000
+++ b/yahtml.el Tue Dec 16 13:28:38 1997 +0000
@@ -1,6 +1,6 @@
;;; -*- Emacs-Lisp -*-
;;; (c ) 1994-1997 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
-;;; Last modified Mon Apr 7 16:58:32 1997 on crx
+;;; Last modified Tue Dec 16 21:10:05 1997 on crx
;;; $Id$
;;;[Installation]
@@ -18,6 +18,22 @@
;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji")))
;;; ;Write correspondence alist from ABSOLUTE unix path name to URL path.
;;;
+;;;[インストール方法]
+;;;
+;;; yahtml.el, yatexlib.el, yatexprc.el を load-path の通ったディレクト
+;;; リにインストールしてください。その後、以下を参考に ~/.emacs に設定を
+;;; 追加して下さい。
+;;;
+;;; (setq auto-mode-alist
+;;; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist))
+;;; (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t)
+;;; (setq yahtml-www-browser "netscape")
+;;; ;お気に入りのブラウザを書いて下さい。netscapeが便利です。
+;;; (setq yahtml-path-url-alist
+;;; '(("/home/yuuji/public_html" . "http://www.mynet/~yuuji")
+;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji")))
+;;; ;UNIXの絶対パスと対応するURLのリストを書いて下さい。
+;;;
;;;[Commentary]
;;;
;;; It is assumed you are already familiar with YaTeX. The following
@@ -29,15 +45,16 @@
;;; this group
;;; When input `href=...', you can complete file
;;; name or label(href="#foo") by typing TAB.
-;;; * [prefix] s Complete declarative notations such as
-;;; `'
-;;; `'
;;; * [prefix] l Complete typeface-changing commands such as
;;; ` ... ' or ` ... '
;;; This completion can be used to make in-line
;;; tags which is normally completed with [prefix] b.
+;;; * [prefix] s Complete declarative notations such as
+;;; `'
+;;; `'
;;; * [prefix] m Complete single commands such as
;;; `
' or `
with
set this to t.") + +(defvar yahtml-p-prefered-env-regexp "^\\(body\\|dl\\)" + "*Regexp of envs where paragraphed sentences are prefered.") + +(defvar yahtml-template-file "~/http/template.html" + "*Template HTML file. It'll be inserted to empty file.") + ;;; --- customizable variable ends here --- - (defvar yahtml-prefix-map nil) (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.") (defvar yahtml-lint-buffer-map nil "Keymap used in lint buffer.") @@ -121,7 +219,7 @@ (if yahtml-mode-map nil (setq yahtml-mode-map (make-sparse-keymap) yahtml-prefix-map (make-sparse-keymap)) - (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map) + (define-key yahtml-mode-map yahtml-prefix yahtml-prefix-map) (define-key yahtml-mode-map "\M-\C-@" 'yahtml-mark-begend) (if (and (boundp 'window-system) (eq window-system 'x) YaTeX-emacs-19) (define-key yahtml-mode-map [?\M-\C- ] 'yahtml-mark-begend)) @@ -129,7 +227,6 @@ (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment) (define-key yahtml-mode-map "\M-\C-m" 'yahtml-intelligent-newline) (define-key yahtml-mode-map "\C-i" 'yahtml-indent-line) - (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map) (let ((map yahtml-prefix-map)) (YaTeX-define-key "^" 'yahtml-visit-main map) (YaTeX-define-key "4^" 'yahtml-visit-main-other-window map) @@ -150,6 +247,7 @@ (YaTeX-define-key "m" 'yahtml-insert-single map) (YaTeX-define-key "n" '(lambda () (interactive) (insert (if yahtml-prefer-upcases "") + (save-excursion + (insert "
")))) + ;;; ---------- Jump ---------- (defun yahtml-on-href-p () "Check if point is on href clause." @@ -785,8 +936,9 @@ (goto-char (get 'YaTeX-inner-environment 'point)) (search-forward "href" e t) (search-forward "=" e t) - (skip-chars-forward " \t\n") - (looking-at "\"?\\([^\"> \t\n]+\\)\"?") + (progn + (skip-chars-forward " \t\n") + (looking-at "\"?\\([^\"> \t\n]+\\)\"?")) (< p (match-end 0)) (YaTeX-match-string 1) )))) @@ -816,6 +968,16 @@ "Call WWW Browser to see HREF." (let ((pb "* WWW Browser *") (cb (current-buffer))) (cond + ((string-match "^start\\>" yahtml-www-browser) + (if (get-buffer pb) + (progn (set-buffer pb) (erase-buffer) (set-buffer cb))) + (put 'yahtml-netscape-sentinel 'url href) + (set-process-sentinel + (setq yahtml-browser-process + (start-process + "browser" pb shell-file-name yahtml-shell-command-option + (format "%s \"%s\"" yahtml-www-browser href))) + 'yahtml-netscape-sentinel)) ((and (string-match "[Nn]etscape" yahtml-www-browser) (not (eq system-type 'windows-nt))) (if (get-buffer pb) @@ -843,7 +1005,7 @@ (defun yahtml-goto-corresponding-href (&optional other) "Go to corresponding name." - (let ((href (yahtml-on-href-p)) file name) + (let ((href (yahtml-on-href-p)) file name (parent buffer-file-name)) (if href (cond ((string-match "^\\(ht\\|f\\)tp:" href) @@ -858,7 +1020,8 @@ (if (string-match "^/" file) (setq file (yahtml-url-to-path file))) (if other (YaTeX-switch-to-buffer-other-window file) - (YaTeX-switch-to-buffer file)))) + (YaTeX-switch-to-buffer file)) + (or YaTeX-parent-file (setq YaTeX-parent-file parent)))) (if name (progn (set-mark-command nil) (yahtml-jump-to-name name))) t))))) @@ -954,6 +1117,7 @@ ((yahtml-goto-corresponding-href other)) ((yahtml-goto-corresponding-img)) ((yahtml-goto-corresponding-begend)) + (t (message "I don't know where to go.")) )) (defun yahtml-goto-corresponding-*-other-window () @@ -961,27 +1125,54 @@ (interactive) (yahtml-goto-corresponding-* t)) +(defun yahtml-visit-main () + "Go to parent file from where you visit current file." + (interactive) + (if YaTeX-parent-file (YaTeX-switch-to-buffer YaTeX-parent-file))) + ;;; ---------- killing ---------- (defun yahtml-kill-begend (&optional whole) - (let ((tag (yahtml-on-begend-p)) (p (make-marker)) (q (make-marker))) + (let ((tag (yahtml-on-begend-p)) p q r) (if tag - (progn + (save-excursion (or (looking-at "<") (progn (skip-chars-backward "^<") (forward-char -1))) - (set-marker p (point)) + (setq p (point)) (yahtml-goto-corresponding-begend) (or (looking-at "<") (progn (skip-chars-backward "^<") (forward-char -1))) - (delete-region (point) (progn (forward-list 1) (point))) - (set-marker q (point)) - (beginning-of-line) - (if (looking-at "^\\s *$") - (delete-region (point) (progn (forward-line 1) (point)))) + (if (< (point) p) ;if on the opening tag + (progn (setq q p p (point)) + (goto-char q)) + (setq q (point))) ;now q has end-line's (point) + (if (not whole) + (kill-region + (progn (skip-chars-backward " \t") (if (bolp) (point) q)) + (progn (forward-list 1) + (setq r (point)) + (skip-chars-forward " \t") + (if (and (eolp) (not (eobp))) (1+ (point)) r)))) (goto-char p) - (delete-region (point) (progn (forward-list 1) (point))) - (if (looking-at "^\\s *$") - (delete-region (point) (progn (forward-line 1) (point)))) - (if whole (delete-region p q)) + (skip-chars-backward " \t") + (if (not whole) + (progn + (kill-append + (buffer-substring + (setq p (if (bolp) (point) p)) + (setq q (progn + (forward-list 1) + (setq r (point)) + (skip-chars-forward " \t") + (if (and (eolp) (not (eobp))) (1+ (point)) r)))) + t) + (delete-region p q)) + (kill-region + (if (bolp) (point) p) + (progn (goto-char q) + (forward-list 1) + (setq r (point)) + (skip-chars-forward " \t") + (if (and (eolp) (not (eobp))) (1+ (point)) r)))) tag)))) (defun yahtml-kill-* (whole) @@ -1024,20 +1215,25 @@ (save-excursion (and (re-search-backward "" nil t) + (progn + (goto-char (match-end 0)) + (skip-chars-forward " \t\n") + (setq b1 (point)) + (search-forward ">" nil t)) (setq e1 (match-beginning 0)) (goto-char b1) (re-search-forward "href\\s *=" e1 t) (>= p (point)) - (goto-char (match-end 0)) - (skip-chars-forward " \t\n") - (looking-at "\"?\\([^\"> \t\n]+\\)\"?") + (progn + (goto-char (match-end 0)) + (skip-chars-forward " \t\n") + (looking-at "\"?\\([^\"> \t\n]+\\)\"?")) (< p (match-end 0))))) (setq b1 (match-beginning 1) e1 (match-end 1) yahtml-completing-buffer (current-buffer) + ;; yahtml-urls-local is buffer-local, so we must put + ;; that into yahtml-urls here + yahtml-urls (append yahtml-urls-private yahtml-urls-local) href (read-from-minibuffer "Change href to: " "" yahtml-url-completion-map)) (if (string< "" href) @@ -1123,19 +1319,35 @@ )) ;;; ---------- commenting ---------- -(defun yahtml-comment-region (beg end) - (interactive "r") - (comment-region beg end nil)) +(defun yahtml-comment-region (&optional uncom) + "Comment out region or environment." + (interactive) + (let (e beg p) + (cond + ((setq e (yahtml-on-begend-p)) + (save-excursion + (setq p (point)) + (if (string-match "^/" e) + (setq beg (progn (forward-line 1) (point))) + (setq beg (progn (beginning-of-line) (point)))) + (goto-char p) + (yahtml-goto-corresponding-begend) + (if (string-match "^/" e) + (beginning-of-line) + (forward-line 1)) + (comment-region beg (point) (if uncom (list 4))))) + (t (comment-region (region-beginning) (region-end) + (if uncom (list 4))))))) -(defun yahtml-uncomment-region (beg end) - (interactive "r") - (comment-region beg end '(4))) +(defun yahtml-uncomment-region () + (interactive) + (yahtml-comment-region t)) (defun yahtml-inner-environment-but (exclude &optional quick) "Return the inner environment but matches with EXCLUDE tag." - (let (e) + (let (e (case-fold-search t)) (save-excursion (while (and (setq e (YaTeX-inner-environment quick)) (string-match exclude e)) @@ -1192,8 +1404,11 @@ (fill-region-as-paragraph (progn (re-search-backward paragraph-start nil t) (or (save-excursion - (goto-char (match-end 0)) - (skip-chars-forward " \t>") + (goto-char (match-beginning 0)) + (if (looking-at "<") + (forward-list) + (goto-char (match-end 0)) + (skip-chars-forward " \t>")) (if (looking-at "[ \t]*$") (progn (forward-line 1) (point)))) (point))) @@ -1213,8 +1428,32 @@ ;;; ---------- indentation ---------- ;;; (defun yahtml-indent-line () + "Indent a line (faster wrapper)" (interactive) - (let ((envs "[uod]l\\|table\\|t[rhd]\\|select\\|blockquote") + (let (indent) + (if (and (save-excursion + (beginning-of-line) (skip-chars-forward "\t ") + (not (looking-at "<"))) + (save-excursion + (forward-line -1) + (while (and (not (bobp)) (looking-at "^\\s *$")) + (forward-line -1)) + (skip-chars-forward "\t ") + (setq indent (current-column)) + (not (looking-at "<")))) + (progn + (save-excursion + (beginning-of-line) + (skip-chars-forward " \t") + (or (= (current-column) indent) + (YaTeX-reindent indent))) + (and (bolp) (skip-chars-forward " \t"))) + (yahtml-indent-line-real)))) + +(defun yahtml-indent-line-real () + (interactive) + (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir") + (itemizing-envs "^\\([uod]l\\|menu\\|dir\\)$") (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\|option\\)\\b") inenv p col peol (case-fold-search t)) (save-excursion @@ -1223,38 +1462,43 @@ "html") col (get 'YaTeX-inner-environment 'indent) p (get 'YaTeX-inner-environment 'point) - op)) + op nil)) (save-excursion (cond ((string-match envs inenv) (save-excursion (beginning-of-line) (skip-chars-forward " \t") - (cond + (cond ;lookup current line's tag ((looking-at (concat "\\(" envs "\\)>")) (YaTeX-reindent col)) - ((or (looking-at itms) - (and yahtml-hate-too-deep-indentation - (looking-at (concat "<" envs)))) + ((looking-at itms) (YaTeX-reindent (+ col yahtml-environment-indent))) + ((and yahtml-hate-too-deep-indentation + (looking-at (concat "<\\(" envs "\\)"))) + (YaTeX-reindent (+ col (* 2 yahtml-environment-indent)))) ((and (< p (point)) + (string-match itemizing-envs inenv) (save-excursion (and ;;(re-search-backward itms p t) (setq op (point)) (goto-char p) (re-search-forward itms op t) - ;(goto-char (match-end 0)) - (skip-chars-forward "^>") - (skip-chars-forward ">") - (skip-chars-forward " \t") - (setq col (current-column))))) + (progn + (skip-chars-forward "^>") + (skip-chars-forward ">") + (skip-chars-forward " \t") + (setq col (if (looking-at "$") + (+ col yahtml-environment-indent) + (current-column))))))) (YaTeX-reindent col)) (t (YaTeX-reindent (+ col yahtml-environment-indent))))))) (and (bolp) (skip-chars-forward " \t")) (if (and (setq inenv (yahtml-on-begend-p)) - (string-match (concat "^\\(" envs "\\)") inenv)) + (string-match + (concat "^\\<\\(" yahtml-struct-name-regexp "\\)") inenv)) (save-excursion (setq peol (point-end-of-line)) (or (= (char-after (point)) ?<) @@ -1312,6 +1556,7 @@ (defun yahtml-lint-buffer (buf) "Call lint on buffer BUF." + (require 'yatexprc) (interactive "bCall lint on buffer: ") (setq buf (get-buffer buf)) (YaTeX-save-buffers) @@ -1329,7 +1574,7 @@ (setq file (expand-file-name file))) (if (string-match "^[A-Za-z]:/" file) (progn - ;; (aset file 1 ?|) ;$B$3$l$OMW$i$J$$$i$7$$!D(B + ;; (aset file 1 ?|) ;これは要らないらしい… (setq file (concat "///" file)))) (while list (if (string-match (concat "^" (regexp-quote (car (car list)))) file) @@ -1356,15 +1601,16 @@ (if (string-match "\\(http://[^/]*\\)/" url) (setq docroot (substring url (match-end 1))) (setq docroot url)) - (if (string-match (concat "^" (regexp-quote docroot)) file) - (setq realpath - (expand-file-name - (substring - file - (if (= (aref file (1- (match-end 0))) ?/) - (match-end 0) ; "/foo" - (min (1+ (match-end 0)) (length file)))) ; "/~foo" - (car (car list))))) + (cond + ((string-match (concat "^" (regexp-quote docroot)) file) + (setq realpath + (expand-file-name + (substring + file + (if (= (aref file (1- (match-end 0))) ?/) + (match-end 0) ; "/foo" + (min (1+ (match-end 0)) (length file)))) ; "/~foo" + (car (car list)))))) (if realpath (progn (setq list nil) (if (and dirsufp (not (string-match "/$" realpath))) @@ -1406,15 +1652,22 @@ (interactive "P") (let (env func) (end-of-line) - (setq env (downcase (or (YaTeX-inner-environment) "html"))) + (setq env (downcase (or (yahtml-inner-environment-but "^\\(a\\|p\\)\\b" t) + "html"))) (setq func (intern-soft (concat "yahtml-intelligent-newline-" env))) (newline) (if (and env func (fboundp func)) - (funcall func)))) + ;; if intelligent line function is defined, call that + (funcall func) + ;; else do the default action + (if (string-match yahtml-p-prefered-env-regexp env) + (yahtml-insert-p))))) +(defvar yahtml-faithful-to-htmllint nil) (defun yahtml-intelligent-newline-ul () (interactive) - (insert (if yahtml-prefer-upcases "