File:  [Local Repository] / gnujdoc / makeinfo.el
Revision 1.9: download - view: text, annotated - select for diffs
Wed Apr 26 06:45:36 2000 UTC (20 years, 3 months ago) by hayashi
Branches: MAIN
CVS tags: HEAD
Add workaround for @ref

    1: ;; makeinfo.el -- make info files from texinfo files
    2: 
    3: ;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 
    4: ;;               1994, 1995, 1996, 1997 Free Software Foundation, Inc.
    5: ;; Copyright (C) 1999 Yoshiki Hayashi <t90553@mail.ecc.u-tokyo.ac.jp>
    6: 
    7: ;; This program is free software; you can redistribute it and/or
    8: ;; modify it under the terms of the GNU General Public License as
    9: ;; published by the Free Software Foundation; either version 2, or (at
   10: ;; your option) any later version.
   11: 
   12: ;; This program is distributed in the hope that it will be useful, but
   13: ;; WITHOUT ANY WARRANTY; without even the implied warranty of
   14: ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15: ;; General Public License for more details.
   16: 
   17: ;; You should have received a copy of the GNU General Public License
   18: ;; along with GNU Emacs; see the file COPYING.  If not, write to the
   19: ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   20: ;; Boston, MA 02111-1307, USA.
   21: 
   22: (or (featurep 'mule)
   23:     (error "Emacs without mule is not supported"))
   24: (require 'texinfmt)
   25: 
   26: (if (featurep 'xemacs)
   27:     (set-language-environment "Japanese")
   28:   ;; GNU Emacs
   29:   (if (>= emacs-major-version 20)
   30:       (progn (set-language-environment "Japanese")
   31: 	     (and (= emacs-major-version 20)
   32: 		  (> emacs-minor-version 2);; Emacs 20.2 dumps core
   33: 		  (set-terminal-coding-system 'euc-japan)))))
   34: 
   35: (find-file (car command-line-args-left))
   36: 
   37: (if (featurep 'xemacs)
   38:     (setq coding-system-for-write buffer-file-coding-system)
   39: ;; GNU Emacs
   40: (if (>= emacs-major-version 20)
   41:     (setq coding-system-for-write buffer-file-coding-system)
   42: )
   43: 
   44: ;; Without this, MULE 2.3 saves file with iso-2022-jp
   45: (if (= emacs-major-version 19)
   46:     (setq-default file-coding-system file-coding-system)
   47: ))
   48: ;; texinfmt.el workaround
   49: ;; all version
   50: (defun texinfo-format-var () ;; avoid texinfm bug.
   51:   (let ((arg (texinfo-parse-expanded-arg)))
   52:     (texinfo-discard-command)
   53:     (insert (upcase arg))))
   54: 
   55: (defun texinfo-format-xref ()
   56:   (let ((args (texinfo-format-parse-args)))
   57:     (texinfo-discard-command)
   58:     (insert "*Note ")
   59:     (let ((fname (or (nth 1 args) (nth 2 args))))
   60:       (if (null (or fname (nth 3 args)))
   61:           (insert (car args) "::")
   62:         (insert (or fname (car args)) ": ")
   63:         (if (nth 3 args)
   64:             (insert "(" (nth 3 args) ")"))
   65:         (and (car args) (insert (car args)))))))
   66: 
   67: (and (string< texinfmt-version "2.38 of 3 July 1998")
   68: ;; Emacs 20.2
   69: (put 'uref 'texinfo-format 'texinfo-format-uref)
   70: (defun texinfo-format-uref ()
   71:   "Format URL and optional URL-TITLE.
   72: Insert ` ... ' around URL if no URL-TITLE argument;
   73: otherwise, insert URL-TITLE followed by URL in parentheses."
   74:   (let ((args (texinfo-format-parse-args)))
   75:     (texinfo-discard-command)
   76:     ;; if url-title
   77:     (if (nth 1 args)
   78:         (insert  (nth 1 args) " (" (nth 0 args) ")")
   79:       (insert "`" (nth 0 args) "'"))
   80:     (goto-char texinfo-command-start)))
   81: )
   82: (and (string< texinfmt-version "2.37 of 24 May 1997")
   83: ;; MULE 2.3
   84: (put 'direntry 'texinfo-format 'texinfo-format-direntry)
   85: (defun texinfo-format-direntry ()
   86:   (texinfo-push-stack 'direntry nil)
   87:   (texinfo-discard-line)
   88:   (insert "START-INFO-DIR-ENTRY\n\n"))
   89: 
   90: (put 'direntry 'texinfo-end 'texinfo-end-direntry)
   91: (defun texinfo-end-direntry ()
   92:   (texinfo-discard-command)
   93:   (insert "END-INFO-DIR-ENTRY\n\n")
   94:   (texinfo-pop-stack 'direntry))
   95: 
   96: (put 'dircategory 'texinfo-format 'texinfo-format-dircategory)
   97: (defun texinfo-format-dircategory ()
   98:   (let ((str (texinfo-parse-arg-discard)))
   99:     (delete-region (point)
  100:                    (progn
  101:                      (skip-chars-forward " ")
  102:                      (point)))
  103:     (insert "INFO-DIR-SECTION " str "\n")))
  104: (put 'email 'texinfo-format 'texinfo-format-key)
  105: (defun texinfo-format-key ()
  106:   (insert (texinfo-parse-arg-discard))
  107:   (goto-char texinfo-command-start))
  108: (put 'url 'texinfo-format 'texinfo-format-code)
  109: (put 'detailmenu 'texinfo-format 'texinfo-discard-line)
  110: (put 'detailmenu 'texinfo-end 'texinfo-discard-command)
  111: (put 'ringaccent 'texinfo-format 'texinfo-format-ring-accent)
  112: (defun texinfo-format-ring-accent ()
  113:    (insert "*" (texinfo-parse-arg-discard))
  114:    (goto-char texinfo-command-start))
  115: )
  116: ;; workaround ends
  117: 
  118: (texinfo-every-node-update)
  119: (texinfo-format-buffer)
  120: (save-buffer)
  121: (kill-emacs)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>