*** empty log message ***
[bpt/emacs.git] / lisp / textmodes / texinfmt.el
index e478169..9e0b6b6 100644 (file)
@@ -1,8 +1,8 @@
 ;;; texinfmt.el --- format Texinfo files into Info files
 
 ;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993,
-;;               1994, 1995, 1996, 1997, 1998, 2000, 2001, 2005
-;;    Free Software Foundation, Inc.
+;;   1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003,
+;;   2004, 2005, 2006 Free Software Foundation, Inc.
 
 ;; Maintainer: Robert J. Chassell <bug-texinfo@gnu.org>
 ;; Keywords: maint, tex, docs
@@ -21,8 +21,8 @@
 
 ;; 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., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -37,7 +37,7 @@
     (defmacro defcustom (var value doc &rest ignore)
       `(defvar ,var ,value ,doc)))
 
-(defvar texinfmt-version "2.41 of  1 Mar 2005")
+(defvar texinfmt-version "2.42 of  7 Jul 2006")
 
 (defun texinfmt-version (&optional here)
   "Show the version of texinfmt.el in the minibuffer.
@@ -212,6 +212,8 @@ converted to Info is stored in a temporary buffer."
 
 ;;; Find a buffer to use.
     (switch-to-buffer (get-buffer-create texinfo-region-buffer-name))
+    (setq buffer-read-only t)
+    (let ((inhibit-read-only t))
     (erase-buffer)
     ;; Insert the header into the buffer.
     (insert header-text)
@@ -313,7 +315,7 @@ converted to Info is stored in a temporary buffer."
     (goto-char (point-min))
     (Info-tagify input-buffer)
     (goto-char (point-min))
-    (message "Done.")))
+    (message "Done."))))
 
 ;;;###autoload
 (defun texi2info (&optional nosplit)
@@ -1553,7 +1555,9 @@ The node is constructed automatically."
               "  Node: " node-name "-Footnotes, Up: " node-name "\n")
       (setq start (point))
       (insert (format "\n(%d)  %s\n" texinfo-footnote-number arg))
-      (fill-region start (point))))))
+      (narrow-to-region (save-excursion (goto-char start) (point)) (point))
+      (fill-region (point-min) (point-max))
+      (widen)))))
 
 (defun texinfo-format-end-node ()
   "Format footnote in the End of node style, with notes at end of node."
@@ -2116,11 +2120,18 @@ This command is executed when texinfmt sees @item inside @multitable."
     (insert unformated-row)
     (goto-char (point-min))
 ;; 1. Check for correct number of @tab in line.
-    (let ((tab-number 1))                       ; one @tab between two columns
+    (let ((tab-number 1))               ; one @tab between two columns
       (while (search-forward "@tab" nil t)
         (setq tab-number (1+ tab-number)))
-      (if (/= tab-number (length table-widths))
-          (error "Wrong number of @tab's in a @multitable row")))
+      (let ((needed-tabs (- (length table-widths) tab-number)))
+        (when (> needed-tabs 0)
+              (goto-char (point-min)) 
+              (end-of-line)
+              (while (> needed-tabs 0)
+                (insert "@w{ }\n@tab")
+                (setq needed-tabs (1- needed-tabs))
+                (message
+                 "Added @tabs and empty spaces to a @multitable row")))))
     (goto-char (point-min))
 ;; 2. Format each cell, and copy to a rectangle
     ;; buffer looks like this:    A1  @tab  A2  @tab  A3
@@ -2807,7 +2818,7 @@ Default is to leave the number of spaces as is."
   (let ((arg  (texinfo-parse-arg-discard)))
     (if (string= "asis" arg)
         (setq texinfo-paragraph-indent "asis")
-      (setq texinfo-paragraph-indent (string-to-int arg)))))
+      (setq texinfo-paragraph-indent (string-to-number arg)))))
 
 (put 'refill 'texinfo-format 'texinfo-format-refill)
 (defun texinfo-format-refill ()