;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993,
;; 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003,
-;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Maintainer: Robert J. Chassell <bug-texinfo@gnu.org>
;; Keywords: maint, tex, docs
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs 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.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Emacs lisp functions to convert Texinfo files to Info files.
-(or (fboundp 'defgroup)
- (defmacro defgroup (&rest ignore) nil))
-
-(or (fboundp 'defcustom)
- (defmacro defcustom (var value doc &rest ignore)
- `(defvar ,var ,value ,doc)))
-
(defvar texinfmt-version "2.42 of 7 Jul 2006")
(defun texinfmt-version (&optional here)
(apply '+ texinfo-multitable-width-list))))
(if (> desired-columns fill-column)
(error
- (format
- "Multi-column table width, %d chars, is greater than page width, %d chars."
- desired-columns fill-column))))
+ "Multi-column table width, %d chars, is greater than page width, %d chars."
+ desired-columns fill-column)))
texinfo-multitable-width-list))
;; @item A1 @tab A2 @tab A3
("ky" . texinfo-format-kindex)))
\f
-;;; Sort and index (for VMS)
-
-;; Sort an index which is in the current buffer between START and END.
-;; Used on VMS, where the `sort' utility is not available.
-(defun texinfo-sort-region (start end)
- (require 'sort)
- (save-restriction
- (narrow-to-region start end)
- (goto-char (point-min))
- (sort-subr nil 'forward-line 'end-of-line 'texinfo-sort-startkeyfun)))
-
-;; Subroutine for sorting an index.
-;; At start of a line, return a string to sort the line under.
-(defun texinfo-sort-startkeyfun ()
- (let ((line (buffer-substring-no-properties (point) (line-end-position))))
- ;; Canonicalize whitespace and eliminate funny chars.
- (while (string-match "[ \t][ \t]+\\|[^a-z0-9 ]+" line)
- (setq line (concat (substring line 0 (match-beginning 0))
- " "
- (substring line (match-end 0)))))
- line))
-
-\f
;;; @printindex
(put 'printindex 'texinfo-format 'texinfo-format-printindex)
(defun texinfo-format-printindex ()
- (let ((indexelts (symbol-value
- (cdr (assoc (texinfo-parse-arg-discard)
- texinfo-indexvar-alist))))
- opoint)
+ (let* ((arg (texinfo-parse-arg-discard))
+ (fmt (cdr (assoc arg texinfo-short-index-format-cmds-alist)))
+ (index-list (delq nil (mapcar (lambda (e)
+ (and (eq fmt (get (cdr e) 'texinfo-format))
+ (cdr (assoc (car e) texinfo-indexvar-alist))))
+ texinfo-short-index-cmds-alist)))
+ (indexelts (apply #'append nil (mapcar #'symbol-value index-list)))
+ opoint)
(insert "\n* Menu:\n\n")
(setq opoint (point))
(texinfo-print-index nil indexelts)
-
- (if (memq system-type '(vax-vms windows-nt ms-dos))
- (texinfo-sort-region opoint (point))
- (shell-command-on-region opoint (point) "sort -fd" 1))))
+ (shell-command-on-region opoint (point) "sort -fd" 1)))
(defun texinfo-print-index (file indexelts)
(while indexelts
;; Take arguments
;; @,{c} ==> c, cedilla accent
-(put ', 'texinfo-format 'texinfo-format-cedilla-accent)
+(put '\, 'texinfo-format 'texinfo-format-cedilla-accent)
(defun texinfo-format-cedilla-accent ()
(insert (texinfo-parse-arg-discard) ",")
(goto-char texinfo-command-start))