;;研究報告モード ;;上川純一 2002年9月13日 (金) 作成. ;; $Id: dancer-report-mode.el,v 1.47 2003/01/22 09:34:22 dancer Exp $ ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; ;; readme-debian.el is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with your Debian installation, in /usr/share/common-licenses/GPL ;; If not, write to the Free Software Foundation, 675 Mass Ave, ;; Cambridge, MA 02139, USA. ;; 利用方法:自分の.emacsに以下のような設定を追加してください. ;; (load "~/cvscheckout/ISDL-report/macro/dancer-report-mode.el" t) ;; (setq dancer-report-author-name "自分の名前") ;; (setq dancer-report-author-alphabet "my name in roman characters") ;; (setq dancer-report-author-id "自分の番号") ;; ;; ;; C-c I でページの初期化, ;; C-c s でセクションの追加. ;; C-c S でサブセクションの追加 ;; などができます. 他の機能は後から追加. (require 'psgml-html) ;I need psgml. (add-to-list 'auto-mode-alist '("report.*\.html$" . dancer-report-mode)) ;;以下はデフォルトの値です..emacsあたりで設定を変更してください. (setq dancer-report-author-name "上川 純一") (setq dancer-report-author-alphabet "Junichi Uekawa") (setq dancer-report-author-id "20020408") (define-derived-mode dancer-report-mode html-mode "Report" "Major mode for editing ISDL report in Emacs. ISDLレポートを編集するためのメジャーモードです. \\[dancer-report-initialize-page]で現在開いているページを新規に作成しなおします. 詳しく見て行くと,次のコマンドがあります: \\{dancer-report-mode-map} " (make-local-variable 'current-section) (setq current-section 1) (make-local-variable 'current-subsection) (setq current-subsection 0) (make-local-variable 'current-bibliography) (setq current-bibliography 0) (make-local-variable 'current-imagenum) (setq current-imagenum 0) (make-local-variable 'current-tablenum) (setq current-tablenum 0) (if (boundp 'wysihtml-active-modes-alist) (add-to-list 'wysihtml-active-modes-alist '(dancer-report-mode . t)))) (define-key dancer-report-mode-map "\C-cs" 'dancer-report-insert-section) (define-key dancer-report-mode-map "\C-cS" 'dancer-report-insert-subsection) (define-key dancer-report-mode-map "\C-cI" 'dancer-report-initialize-page) (define-key dancer-report-mode-map "\C-cb" 'dancer-report-insert-bibliography) (define-key dancer-report-mode-map "\C-cf" 'dancer-report-insert-figure) (define-key dancer-report-mode-map "\C-ct" 'dancer-report-insert-table) (define-key dancer-report-mode-map "\C-cj" 'dancer-report-insert-paragraph) (define-key dancer-report-mode-map "\C-c\C-j" 'dancer-report-insert-last-paragraph) (define-key dancer-report-mode-map "\C-crf" 'dancer-report-insert-ref-figure) (define-key dancer-report-mode-map "\C-crb" 'dancer-report-insert-ref-bibliography) (define-key dancer-report-mode-map "\C-crt" 'dancer-report-insert-ref-table) (define-key dancer-report-mode-map "\C-crs" 'dancer-report-insert-ref-section) (define-key dancer-report-mode-map "\C-crS" 'dancer-report-insert-ref-subsection) (define-key dancer-report-mode-map "\C-cu" 'dancer-report-update-cvs) (define-key dancer-report-mode-map "\C-cw" 'dancer-report-work-in-progress) (defun dancer-report-getmonthnumstr (monthname) "Return a string representation of the numerical representation of MONTHNAME." (let* ( (index (string-match monthname "JanFebMarAprMayJunJulAugSepOctNovDec")) (month (+ 1 (/ index 3))) ) (number-to-string month) ) ) (defun dancer-report-string-today-japanese () "Get Japanese date-time." (let* ((time (current-time-string)) (month (dancer-report-getmonthnumstr (substring time 4 7))) (day (string-to-number (substring time 8 10))) (year (substring time 20 24)) ) (concat year "年" month "月" (number-to-string day) "日") ) ) (defun dancer-report-initialize-page () "ページの初期化をします.最初はこれを実行してください." (interactive) (let* ((currentnumber (completing-read "ISDLレポート番号: " nil nil nil dancer-report-author-id)) (currentdate (dancer-report-string-today-japanese)) (currenttitle (read-string "タイトル: ")) (abstract (completing-read "概要: " nil nil nil currenttitle) ) ) (kill-region (point-min) (point-max)) ;clear buffer. (insert (concat " " currenttitle "

" currenttitle "

" dancer-report-author-name ",廣安 知之,三木 光範

ISDL Report   No. " currentnumber "

" currentdate "

Abstract

" abstract "

1  はじめに

Reference


Copyright

Copyright (C) 2002 Tomoyuki Hiroyasu, All rights reserved.
Copyright (C) 2002 Mitsunori Miki, All rights reserved.
Copyright (C) 2002 " dancer-report-author-alphabet ", All rights reserved.

No part of this document may be reproduced, copied, distributed,
transferred, modified, or transmitted, in any form or by any means,
without the prior written permission of the authors.
In no event shall the authors be liable for any damages caused in any way
out of the use of this document.
      

Back to Top
" )) (goto-line 1) )) (defun dancer-report-insert-section () "Insert a new report section." (interactive) (let* ((sectiontitle (read-string "セクションのタイトル: " )) ) (goto-line 1) (search-forward "") (previous-line 1) (end-of-line) (setq current-section (+ current-section 1)) (setq current-subsection 0) (let* ((my-current-section (completing-read "セクション番号: " nil nil nil (number-to-string current-section)))) (setq current-section (string-to-number my-current-section)) (insert (concat "\n

" my-current-section "  " sectiontitle "

\n"))))) (defun dancer-report-insert-subsection () "Insert a new report subsection." (interactive) (let* ((sectiontitle (read-string "サブセクションのタイトル: " )) ) (goto-line 1) (search-forward "") (previous-line 1) (end-of-line) (setq current-subsection (+ current-subsection 1)) (let* ((my-current-subsection (completing-read "サブセクション番号: " nil nil nil (number-to-string current-subsection)))) (insert (concat "\n

" (number-to-string current-section) "." my-current-subsection "  " sectiontitle "

\n"))))) (defun dancer-report-insert-bibliography () "参考文献の追加." (interactive) (let* ((bunkendata (read-string "参考文献: " )) ) (goto-line 1) (search-forward "
") (search-forward "
") (previous-line 1) (end-of-line) (setq current-bibliography (+ current-bibliography 1)) (let* ((my-current-bibliography (completing-read "文献番号: " nil nil nil (number-to-string current-bibliography)))) (insert (concat "\n
[" my-current-bibliography "]
" bunkendata "
\n")) (setq current-bibliography (string-to-number my-current-bibliography))))) (defun dancer-report-insert-figure () "図の追加." (interactive) (let* ((insert-default-directory nil) (image-path (read-file-name "ファイル名: ")) (image-title (read-string "図のタイトル: ")) ) (setq current-imagenum (+ current-imagenum 1)) (let* ((my-current-imagenum (completing-read "図表番号: " nil nil nil (number-to-string current-imagenum)))) (insert (concat "

Figure " my-current-imagenum ": " image-title "

\n")) (setq current-imagenum (string-to-number my-current-imagenum))))) (defun dancer-report-insert-table () "表の追加." (interactive) (let* ((table-title (read-string "表のタイトル: ")) ) (setq current-tablenum (+ current-tablenum 1)) (let* ((my-current-tablenum (completing-read "表番号: " nil nil nil (number-to-string current-tablenum)))) (insert (concat "
Table " my-current-tablenum ": " table-title "
\n")) (setq current-tablenum (string-to-number my-current-tablenum))))) (defun dancer-report-insert-paragraph () "Insert a new paragraph." (interactive) (end-of-line) (insert "

") (previous-line 2) (end-of-line) ) (defun dancer-report-insert-last-paragraph () "Insert a new paragraph at the end of report." (interactive) (goto-line 1) (search-forward "") (previous-line 1) (end-of-line) (insert "

") (previous-line 2) (end-of-line) ) (defun dancer-report-insert-ref-figure () "Insert a new reference for figure." (interactive) (let* ((fignumber (read-string "図番号: "))) (insert (concat "Figure. " fignumber "" )))) (defun dancer-report-insert-ref-bibliography () "Insert a new reference for bibliography." (interactive) (unwind-protect (let* ((nowbuffer (current-buffer))) (save-excursion (dancer-report-internal-list-bibliography) (let* ((bibnumber (read-string "参考文献番号: "))) (insert (concat "[" bibnumber "]" )))) (switch-to-buffer nowbuffer)) (delete-other-windows))) (defun dancer-report-insert-ref-table () "Insert a new reference for table." (interactive) (let* ((tabnumber (read-string "表番号: "))) (insert (concat "Table. " tabnumber "" )))) (defun dancer-report-insert-ref-section () "Insert a new reference for section." (interactive) (let* ((secnumber (read-string "section 番号: "))) (insert (concat "" secnumber "" )))) (defun dancer-report-insert-ref-subsection () "Insert a new reference for section." (interactive) (let* ((secnumber (read-string "section 番号: ")) (subsectnumber (read-string "subsection 番号: ")) ) (insert (concat "" secnumber "." subsectnumber "" )))) (defun dancer-report-work-in-progress () "Make the current page work in progress." (interactive) (goto-line 2) (search-forward "<") (beginning-of-line) (insert "\n\n" )) (defun dancer-report-update-cvs () "Run the script to do `cvs-update' on remote host." (interactive) (let* ((update-cvs-buffer "*cvs-update-buffer*")) (save-buffer) ;save this buffer. (switch-to-buffer update-cvs-buffer) ;move to new status-display buffer. (kill-region (point-min) (point-max)) (insert "CVSにコミットします:\n") (call-process "/usr/bin/cvs" nil update-cvs-buffer t "-q" "ci" "-m" "\"\"") (insert "mikilabのCVSをアップデートします:\n") (call-process "/bin/bash" nil update-cvs-buffer t "../../../macro/update-cvs.sh") (sit-for 3) (kill-buffer update-cvs-buffer) )) (defun dancer-report-internal-list-anything (buffer-name search-firstentry search-nextstring re-nameentry re-reststring) "List the currently available something list. Such as bibliography, and pop it up to BUFFER-NAME. SEARCH-FIRSTENTRY is the first entry SEARCH-NEXTSTRING is the sign for a next entry RE-NAMEENTRY is the name entry regexp RE-RESTSTRING is the content entry regexp. " (interactive) (let* ((data-string "")) (save-excursion (goto-line 1) (search-forward search-firstentry) ;skip to the first entry. (while (and (if search-nextstring (search-forward search-nextstring nil t) t) (re-search-forward re-nameentry nil t));get the a name= entry (let* ((biblionum (match-string 1))) (re-search-forward re-reststring) ;find the rest string. (let* ((biblioname (match-string 1))) (setq data-string (concat data-string "\n" biblionum ": " biblioname))))) (pop-to-buffer buffer-name) (kill-region (point-min) (point-max)) (insert data-string)))) ;; 現在ある参考文献の一覧を表示してみる. (defun dancer-report-internal-list-bibliography () "List the currently available bibliography list." (interactive) (dancer-report-internal-list-anything "*bib-list-select*" "

" "
" "\\([^<]+\\)" )) (provide 'dancer-report-mode)