1. xemacs
  2. texinfo

Commits

yoshiki  committed 83896cb

* texinfmt.el: Synched with FSF 20.5.
* informat.el: Synched with FSF 20.5.
Improve compilation-minor-mode support.
My patch "[texinfo] Synch with FSF 20.5",
<87g0vu1sly.fsf@dp50.ecc.u-tokyo.ac.jp>

  • Participants
  • Parent commits 2ea6957
  • Branches default

Comments (0)

Files changed (3)

File ChangeLog

View file
  • Ignore whitespace
+2000-01-19  Yoshiki Hayashi  <yoshiki@xemacs.org>
+
+	* informat.el: (Info-validate-error-buffer): New variable.
+	Change buffer name.
+	(Info-validate-node-name): Fix Ebola.
+	(Info-file-data): Use non directory part of a file name.
+	(Info-validate): Add two lines of output to make parsing
+	function happy.
+
+1999-12-09  Yoshiki Hayashi  <t90553@mail.ecc.u-tokyo.ac.jp>
+
+	* texinfmt.el: Synched with FSF 20.5.
+	* informat.el: Synched with FSF 20.5.
+
 2000-01-13  Yoshiki Hayashi  <t90553@mail.ecc.u-tokyo.ac.jp>
 
  	* texinfo.el (texinfo-environment-regexp): Add vtable.

File informat.el

View file
  • Ignore whitespace
 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ;; 02111-1307, USA.
 
-;;; Synched up with: FSF 19.34.
+;;; Synched up with: FSF 20.5.
+
+;;; Commentary:
+
+;; Nowadays, the Texinfo formatting commands always tagify a buffer
+;; (as does `makeinfo') since @anchor commands need tag tables.
 
 ;;; Code:
 
 (require 'info)
 
+(defvar Info-validate-error-buffer "*Problems in Info file*"
+  "Buffer name used to report errors of Info file.")
+
 ;;;###autoload
-(defun Info-tagify ()
-  "Create or update Info-file tag table in current buffer."
+(defun Info-tagify (&optional input-buffer-name)
+  "Create or update Info file tag table in current buffer or in a region."
   (interactive)
   ;; Save and restore point and restrictions.
   ;; save-restrictions would not work
   ;; because it records the old max relative to the end.
   ;; We record it relative to the beginning.
-  (message "Tagifying %s ..." (file-name-nondirectory (buffer-file-name)))
+  (if input-buffer-name
+      (message "Tagifying region in %s ..." input-buffer-name)
+      (message
+       "Tagifying %s ..."  (file-name-nondirectory (buffer-file-name))))
   (let ((omin (point-min))
 	(omax (point-max))
 	(nomax (= (point-max) (1+ (buffer-size))))
 	(opoint (point)))
     (unwind-protect
-	(progn
-	  (widen)
-	  (goto-char (point-min))
-	  (if (search-forward "\^_\nIndirect:\n" nil t)
-	      (message "Cannot tagify split info file")
-	    (let ((regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
-		  (case-fold-search t)
-		  list)
-	      (while (search-forward "\n\^_" nil t)
-		;; We want the 0-origin character position of the ^_.
-		;; That is the same as the Emacs (1-origin) position
-		;; of the newline before it.
-		(let ((beg (match-beginning 0)))
-		  (forward-line 2)
-		  (if (re-search-backward regexp beg t)
-		      (setq list
-			    (cons (list (buffer-substring-no-properties
-					  (match-beginning 1)
-					  (match-end 1))
-					beg)
-				  list)))))
+    (progn
+      (goto-char (point-min))
+      (if (search-forward "\^_\nIndirect:\n" nil t)
+          (message
+           "Cannot tagify split info file.  Run this before splitting.")
+        (let (tag-list
+              refillp
+              (case-fold-search t)
+              (regexp 
+               (concat
+                "\\("
+
+
+                "\\("
+                "@anchor"        ; match-string 2 matches @anchor
+                "\\)"
+                "\\(-no\\|-yes\\)"  ; match-string 3 matches -no or -yes
+                "\\("
+                "-refill"
+                "\\)"
+
+                "\\("
+                "{"
+                "\\)"
+                "\\("
+                "[^}]+"          ; match-string 6 matches arg to anchor
+                "\\)"
+                "\\("
+                "}"
+                "\\)"
+
+                "\\|"
+
+                "\\("
+                "\n\^_"
+                "\\)"
+
+                "\\("
+                "\nFile:[ \t]*\\([^,\n\t]*\\)[,\t\n]+[ \t\n]*"
+                "Node:[ \t]*"
+                "\\("
+                "[^,\n\t]*"      ; match-string 11 matches arg to node name
+                "\\)"
+                "[,\t\n]"
+                "\\)"
+
+                "\\)"
+                )))
+          (while (re-search-forward regexp nil t)
+            (if (string-equal "@anchor" (match-string 2))
+                (progn
+                  ;; kludge lest lose match-data
+                  (if (string-equal "-yes" (match-string 3))
+                      (setq refillp t))
+                  (setq tag-list
+                        (cons (list
+                               (concat "Ref: " (match-string 6))
+                               (match-beginning 0))
+                              tag-list))
+                  (if (eq refillp t)
+                      ;; set start and end so texinfo-format-refill works
+                      (let ((texinfo-command-start (match-beginning 0))
+                            (texinfo-command-end (match-end 0)))
+                        (texinfo-format-refill))
+                  (delete-region  (match-beginning 0) (match-end 0))))
+              ;; else this is a Node
+              (setq tag-list
+                    (cons (list 
+                           (concat "Node: " (match-string 11))
+                           (match-beginning 0))
+                          tag-list))))
+
 	      (goto-char (point-max))
 	      (forward-line -8)
 	      (let ((buffer-read-only nil))
 		      (beginning-of-line)
 		      (delete-region (point) end)))
 		(goto-char (point-max))
-		(insert "\^_\f\nTag table:\n")
-		(move-marker Info-tag-table-marker (point))
-		(setq list (nreverse list))
-		(while list
-		  (insert "Node: " (car (car list)) ?\177)
-		  (princ (car (cdr (car list))) (current-buffer))
+		(insert "\n\^_\f\nTag table:\n")
+		(if (eq major-mode 'info-mode)
+		    (move-marker Info-tag-table-marker (point)))
+		(setq tag-list (nreverse tag-list))
+		(while tag-list
+		  (insert (car (car tag-list)) ?\177)
+		  (princ (car (cdr (car tag-list))) (current-buffer))
 		  (insert ?\n)
-		  (setq list (cdr list)))
+		  (setq tag-list (cdr tag-list)))
 		(insert "\^_\nEnd tag table\n")))))
       (goto-char opoint)
       (narrow-to-region omin (if nomax (1+ (buffer-size))
 			       (min omax (point-max))))))
-  (message "Tagifying %s ... done" (file-name-nondirectory (buffer-file-name))))
+  (if input-buffer-name
+      (message "Tagifying region in %s ..." input-buffer-name)
+      (message
+       "Tagifying %s ..."  (file-name-nondirectory (buffer-file-name)))))
+
 
 ;;;###autoload
 (defun Info-split ()
     (search-forward "\nTag Table:\n")
     (insert "(Indirect)\n")))
 
+(defvar Info-validate-allnodes)
+(defvar Info-validate-thisnode)
+(defvar Info-validate-lossages)
+
 ;;;###autoload
 (defun Info-validate ()
   "Check current buffer for validity as an Info file.
 	  (error "Don't yet know how to validate indirect info files: \"%s\""
 		 (buffer-name (current-buffer))))
       (goto-char (point-min))
-      (let ((allnodes '(("*")))
+      (let ((Info-validate-allnodes '(("*")))
 	    (regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
 	    (case-fold-search t)
 	    (tags-losing nil)
-	    (lossages ()))
+	    (Info-validate-lossages ())
+	    (filename (file-name-nondirectory (buffer-file-name))))
 	(while (search-forward "\n\^_" nil t)
 	  (forward-line 1)
 	  (let ((beg (point)))
 	    (forward-line 1)
 	    (if (re-search-backward regexp beg t)
 		(let ((name (downcase
-			      (buffer-substring-no-properties
-			        (match-beginning 1)
-				(progn
-				  (goto-char (match-end 1))
-				  (skip-chars-backward " \t")
-				  (point))))))
-		  (if (assoc name allnodes)
-		      (setq lossages
+			     (buffer-substring-no-properties
+			      (match-beginning 1)
+			      (progn
+				(goto-char (match-end 1))
+				(skip-chars-backward " \t")
+				(point))))))
+		  (if (assoc name Info-validate-allnodes)
+		      (setq Info-validate-lossages
 			    (cons (list name "Duplicate node-name" nil)
-				  lossages))
-		      (setq allnodes
-			    (cons (list name
-					(progn
-					  (end-of-line)
-					  (and (re-search-backward
-						"prev[ious]*:" beg t)
-					       (progn
-						 (goto-char (match-end 0))
-						 (downcase
-						   (Info-following-node-name)))))
-					beg)
-				  allnodes)))))))
+				  Info-validate-lossages))
+		    (setq Info-validate-allnodes
+			  (cons (list name
+				      (progn
+					(end-of-line)
+					(and (re-search-backward
+					      "prev[ious]*:" beg t)
+					     (progn
+					       (goto-char (match-end 0))
+					       (downcase
+						(Info-following-node-name)))))
+				      beg)
+				Info-validate-allnodes)))))))
 	(goto-char (point-min))
 	(while (search-forward "\n\^_" nil t)
 	  (forward-line 1)
 	  (let ((beg (point))
-		thisnode next)
+		Info-validate-thisnode next)
 	    (forward-line 1)
 	    (if (re-search-backward regexp beg t)
 		(save-restriction
 		  (search-forward "\n\^_" nil 'move)
 		  (narrow-to-region beg (point))
-		  (setq thisnode (downcase
-				   (buffer-substring-no-properties
-				     (match-beginning 1)
-				     (progn
-				       (goto-char (match-end 1))
-				       (skip-chars-backward " \t")
-				       (point)))))
+		  (setq Info-validate-thisnode (downcase
+						(buffer-substring-no-properties
+						 (match-beginning 1)
+						 (progn
+						   (goto-char (match-end 1))
+						   (skip-chars-backward " \t")
+						   (point)))))
 		  (end-of-line)
 		  (and (search-backward "next:" nil t)
 		       (setq next (Info-validate-node-name "invalid Next"))
-		       (assoc next allnodes)
-		       (if (equal (car (cdr (assoc next allnodes)))
-				  thisnode)
+		       (assoc next Info-validate-allnodes)
+		       (if (equal (car (cdr (assoc next Info-validate-allnodes)))
+				  Info-validate-thisnode)
 			   ;; allow multiple `next' pointers to one node
-			   (let ((tem lossages))
+			   (let ((tem Info-validate-lossages))
 			     (while tem
 			       (if (and (equal (car (cdr (car tem)))
 					       "should have Previous")
 					(equal (car (car tem))
 					       next))
-				   (setq lossages (delq (car tem) lossages)))
+				   (setq Info-validate-lossages
+					 (delq (car tem) Info-validate-lossages)))
 			       (setq tem (cdr tem))))
-			 (setq lossages
+			 (setq Info-validate-lossages
 			       (cons (list next
 					   "should have Previous"
-					   thisnode)
-				     lossages))))
+					   Info-validate-thisnode)
+				     Info-validate-lossages))))
 		  (end-of-line)
 		  (if (re-search-backward "prev[ious]*:" nil t)
 		      (Info-validate-node-name "invalid Previous"))
 		  (end-of-line)
 		  (if (search-backward "up:" nil t)
 		      (Info-validate-node-name "invalid Up"))
+		  ;; XEmacs change
 		  (if (re-search-forward "\n\\* Menu:" nil t)
 		      (catch 'next-menu
 			(while (re-search-forward "\n\\* " nil t)
 					       (save-excursion
 						 (skip-chars-forward "^:")
 						 (point))))
+		     ;; XEmacs change
 		     (Info-extract-menu-node-name
 		      "Bad format cross-reference" t)))))))
 	(setq tags-losing (not (Info-validate-tags-table)))
-	(if (or lossages tags-losing)
-	    (with-output-to-temp-buffer " *problems in info file*"
-	      (setq lossages (nreverse lossages))
-	      (while lossages
-		(princ (nth 0 (car lossages)))
+	(if (or Info-validate-lossages tags-losing)
+	    (with-output-to-temp-buffer Info-validate-error-buffer
+	      ;; XEmacs change
+	      ;; We need to add two non error lines since first two
+	      ;; lines are not parsed by compilation-parse-errors.
+	      (princ (format "Problems in Info file: %s\n\n"
+			     filename))
+	      (setq Info-validate-lossages (nreverse Info-validate-lossages))
+	      (while Info-validate-lossages
+		;; XEmacs change
+		;; more readable, compilation-minor-mode comformant output.
+		(princ (nth 0 (car Info-validate-lossages)))
 		(princ "In node \"")
-		(princ (nth 1 (car lossages)))
+		(princ (nth 1 (car Info-validate-lossages)))
 		(princ "\", ")
-		(let ((tem (nth 2 (car lossages))))
+		(let ((tem (nth 2 (car Info-validate-lossages))))
 		  (cond ((string-match "\n" tem)
 			 (princ (substring tem 0 (match-beginning 0)))
 			 (princ "..."))
 			(t
 			 (princ tem))))
-		(if (nth 3 (car lossages))
+		(if (nth 3 (car Info-validate-lossages))
 		    (progn
 		      (princ ": ")
-		      (let ((tem (nth 3 (car lossages))))
+		      (let ((tem (nth 3 (car Info-validate-lossages))))
 			(cond ((string-match "\n" tem)
 			       (princ (substring tem 0 (match-beginning 0)))
 			       (princ "..."))
 			      (t
 			       (princ tem))))))
 		(terpri)
-		(setq lossages (cdr lossages)))
+		(setq Info-validate-lossages (cdr Info-validate-lossages)))
+	      ;; XEmacs change
 	      (save-excursion
-		(set-buffer " *problems in info file*")
+		(set-buffer Info-validate-error-buffer)
 		(compilation-minor-mode 1))
 	      (if tags-losing (princ "\nTags table must be recomputed\n")))
 	  ;; Here if info file is valid.
 	  ;; If we already made a list of problems, clear it out.
 	  (save-excursion
-	    (if (get-buffer " *problems in info file*")
+	    (if (get-buffer Info-validate-error-buffer)
 		(progn
-		  (set-buffer " *problems in info file*")
+		  (set-buffer Info-validate-error-buffer)
 		  (kill-buffer (current-buffer)))))
 	  (message "File appears valid"))))))
 
       nil
     (goto-char (match-end 0))
     (skip-chars-forward " \t")
-    (if (= (following-char) ?\()
+    ;; XEmacs change
+    (if (eq (char-after) ?\()
 	nil
       (setq name
 	    (buffer-substring-no-properties
 	     (point)
 	     (progn
-	      (skip-chars-forward "^,\t\n")
-	      (skip-chars-backward " ")
-	      (point))))))
+	       (skip-chars-forward "^,\t\n")
+	       (skip-chars-backward " ")
+	       (point))))))
   (if (null name)
       nil
+    ;; XEmacs change
     (setq name (replace-in-string name "[ \t]+" " "))
     (setq name (downcase name))
     (or (and (> (length name) 0) (= (aref name 0) ?\())
-	(assoc name allnodes)
-	(setq lossages
-	      (cons (list (Info-file-data) thisnode kind name) lossages))))
+	(assoc name Info-validate-allnodes)
+	(setq Info-validate-lossages
+	      ;; XEmacs change
+	      (cons (list (Info-file-data) Info-validate-thisnode kind name)
+		    Info-validate-lossages))))
   name)
 
 (defun Info-validate-tags-table ()
 		  (start (progn (search-backward "\nTag table:\n")
 				(1- (match-end 0))))
 		  tem)
-	     (setq tem allnodes)
+	     (setq tem Info-validate-allnodes)
 	     (while tem
 	       (goto-char start)
 	       (or (equal (car (car tem)) "*")
 	       (setq tem (downcase (buffer-substring-no-properties
 				     (match-beginning 1)
 				     (match-end 1))))
-	       (setq tem (assoc tem allnodes))
+	       (setq tem (assoc tem Info-validate-allnodes))
 	       (if (or (not tem)
 		       (< 1000 (progn
 				 (goto-char (match-beginning 2))
 			 (message "%s too small to bother tagifying" file))
 			(t
 			 (Info-tagify))))
-		(let ((loss-name " *problems in info file*"))
+		(let ((loss-name Info-validate-error-buffer))
 		  (message "Checking validity of info file %s..." file)
 		  (if (get-buffer loss-name)
 		      (kill-buffer loss-name))
       (widen)
       (beginning-of-line)
       (format "%s:%d:"
-	      (buffer-file-name)
+	      ;; Since we can validate only one file, we don't need absolute file name.
+	      (file-name-nondirectory (buffer-file-name))
 	      (1+ (count-lines 1 (point)))))))
 
+(provide 'informat)
+
 ;;; informat.el ends here

File texinfmt.el

View file
  • Ignore whitespace
 ;;; texinfmt.el --- format Texinfo files into Info files.
 
-;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993,
-;;               1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 
+;;               1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
 
 ;; Maintainer: Robert J. Chassell <bug-texinfo@prep.ai.mit.edu>
+;; Keywords: maint, tex, docs
 
 ;; This file is part of XEmacs.
 
 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ;; 02111-1307, USA.
 
-;;; Synched up with: FSF 20.2.
+;;; Synched up with: FSF 20.5.
 
 ;;; Commentary:
 
     (defmacro defcustom (var value doc &rest ignore)
       `(defvar ,var ,value ,doc)))
 
-(defvar texinfmt-version "2.37 of 24 May 1997")
+(defvar texinfmt-version "2.38 of 3 July 1998")
 
 (defun texinfmt-version (&optional here)
   "Show the version of texinfmt.el in the minibuffer.
 (defvar texinfo-node-names)
 (defvar texinfo-enclosure-list)
 (defvar texinfo-alias-list)
+(defvar texinfo-fold-nodename-case nil)
 
 (defvar texinfo-command-start)
 (defvar texinfo-command-end)
 ;;; Top level buffer and region formatting functions
 
 ;;;###autoload
-(defun texinfo-format-buffer (&optional notagify)
+(defun texinfo-format-buffer (&optional nosplit)
   "Process the current buffer as texinfo code, into an Info file.
 The Info file output is generated in a buffer visiting the Info file
 name specified in the @setfilename command.
 Info-split to do these manually."
   (interactive "P")
   (let ((lastmessage "Formatting Info file..."))
+	;; XEmacs change.
+	;; FSF Emacs 20.4 hungs up waiting for coding-system if Texinfo file
+	;; contains non ASCII character.
+;;;	(coding-system-for-write buffer-file-coding-system))
     (message lastmessage)
+    (widen)
     (texinfo-format-buffer-1)
-    (if notagify
+    (Info-tagify)
+    (if nosplit
         nil
-      (if (> (buffer-size) 30000)
-          (progn
-            (message (setq lastmessage "Making tags table for Info file..."))
-            (Info-tagify)))
       (if (> (buffer-size) 100000)
           (progn
             (message (setq lastmessage "Splitting Info file..."))
         (insert "\n"))
     
     (goto-char (point-min))
+    ;; XEmacs change
     ;; Remove trailing WS like makeinfo does
     ;; Adrian Aichner
 ;;;    (unless (equal texinfo-paragraph-indent "asis")
     (goto-char (point-min))
     (texinfo-format-scan)
     (goto-char (point-min))
-    
+    (Info-tagify input-buffer)
+    (goto-char (point-min))
     (message "Done.")))
 
 ;;;###autoload
-(defun texi2info (&optional notagify)
+(defun texi2info (&optional nosplit)
   "Convert the current buffer (written in Texinfo code) into an Info file.
 The Info file output is generated in a buffer visiting the Info file
 names specified in the @setfilename command.
 is automatically removed when the Info file is created.  The original
 Texinfo source buffer is not changed.
 
-Non-nil argument (prefix, if interactive) means don't make tag table
-and don't split the file if large.  You can use Info-tagify and
-Info-split to do these manually."
+Non-nil argument (prefix, if interactive) means don't split the file
+if large.  You can use Info-split to do this manually."
   (interactive "P")
   (let ((temp-buffer (concat  "*--" (buffer-name) "--temporary-buffer*" )))
     (message "First updating nodes and menus, then creating Info file.")
     (texinfo-master-menu t)
     (message "Now creating Info file.")
     (sit-for 2)
-    (texinfo-format-buffer notagify)
+    (texinfo-format-buffer nosplit)
     (save-buffer)
     (kill-buffer temp-buffer)))
 
     ;; work on them without losing track of multiple
     ;; @raise/@lowersections commands. 
     (goto-char (point-min))
+    ;; XEmacs change.
     ;; Remove trailing WS like makeinfo does
     ;; Adrian Aichner
 ;;;    (unless (equal texinfo-paragraph-indent "asis")
     (replace-match "\""))
   ;; Convert three hyphens in a row to two.
   (goto-char min)
+  ;; XEmacs change.
   (while (re-search-forward "\\( \\|\\w\\)\\(---\\)\\( \\|\\w\\|\n\\)" max t)
     (delete-region (1+ (match-beginning 2)) (+ 2 (match-beginning
     2)))))
    "^@"
    "\\("
    "direntry\\|"
+   "lisp\\|"
+   "smalllisp\\|"
    "example\\|"
    "smallexample\\|"
-   "lisp\\|"
-   "smalllisp\\|"
    "display\\|"
+   "smalldisplay\\|"
    "format\\|"
+   "smallformat\\|"
    "flushleft\\|"
    "flushright\\|"
    "menu\\|"
    "t{\\|"
    "TeX{\\|"
    "today{\\|"
+   ;; XEmacs change.
    "uref{\\|"
    "url{\\|"
    "var{\\|"
           ;; 4. Else go to end of paragraph and insert @refill
           (forward-paragraph)
           (forward-line -1)
-          (end-of-line)
-          (delete-region
-           (point)
-           (save-excursion (skip-chars-backward " \t") (point)))
-          ;; `looking-at-backward' not available in v. 18.57
-          ;; (if (not (looking-at-backward "@refill\\|@bye")) ;)
-          (if (not (re-search-backward
-                    "@refill\\|@bye"
-                    (save-excursion (beginning-of-line) (point))
-                    t))
-              (insert "@refill"))
+	  (let ((line-beg (point)))
+	    (end-of-line)
+	    (delete-region
+	     (point)
+	     (save-excursion (skip-chars-backward " \t") (point)))
+	    (forward-char 1)
+	    (unless (re-search-backward "@c[ \t\n]\\|@comment[ \t\n]" line-beg t)
+	      (forward-char -1))
+	    (unless (re-search-backward "@refill\\|@bye" line-beg t)
+	      (insert "@refill")))
           (forward-line 1))))))
 
 
           (forward-word 1)
         (forward-char 1))
       (setq texinfo-command-end (point))
+      ;; Detect the case of two @-commands in a row;
+      ;; process just the first one.
+      (goto-char (1+ texinfo-command-start))
+      (skip-chars-forward "^@" texinfo-command-end)
+      (setq texinfo-command-end (point))
       ;; Handle let aliasing
       (setq texinfo-command-name
 	    (let (trial
          (up (nth 3 args)))
     (texinfo-discard-command)
     (setq texinfo-last-node name)
-    (let ((tem (downcase name)))
+    (let ((tem (if texinfo-fold-nodename-case (downcase name) name)))
       (if (assoc tem texinfo-node-names)
           (error "Duplicate node name: %s" name)
         (setq texinfo-node-names (cons (list tem) texinfo-node-names))))
     (insert ?\n)
     (setq texinfo-last-node-pos (point))))
 
+(put 'anchor 'texinfo-format 'texinfo-anchor)
+(defun texinfo-anchor ()
+  (let (anchor-string 
+        (here (- (point) 7))  ; save location of beginning of `@anchor'
+        (arg (texinfo-parse-arg-discard)))
+    (if (looking-at " ")      ; since a space may be left after -discard
+      (delete-char 1))
+    (forward-paragraph) 
+    (let ((end (point)))
+      (if (save-excursion 
+            (backward-word 1)
+            (search-forward "@refill" end t))
+          (setq anchor-string "@anchor-yes-refill")
+        (setq anchor-string "@anchor-no-refill")))
+      (goto-char here)
+      (insert anchor-string "{" arg "}")))
+
 (put 'menu 'texinfo-format 'texinfo-format-menu)
 (defun texinfo-format-menu ()
   (texinfo-discard-line)
       (insert "*Note " "(" (nth 2 args) ")" (car args) "::"))))
 
 
+;;; URL Reference: @uref
+
+;; @uref produces a reference to a uniform resource locator (URL).  
+;; It takes one mandatory argument, the URL, and one optional argument, 
+;; the text to display (the default is the URL itself).  
+
+(put 'uref 'texinfo-format 'texinfo-format-uref)
+(defun texinfo-format-uref ()
+  "Format URL and optional URL-TITLE.
+Insert ` ... ' around URL if no URL-TITLE argument; 
+otherwise, insert URL-TITLE followed by URL in parentheses."
+  (let ((args (texinfo-format-parse-args)))
+    (texinfo-discard-command)
+    ;; if url-title 
+    (if (nth 1 args)
+        (insert  (nth 1 args) " (" (nth 0 args) ")")
+      (insert "`" (nth 0 args) "'"))
+    (goto-char texinfo-command-start)))
+
+
 ;;; Section headings
 
 (put 'majorheading 'texinfo-format 'texinfo-format-chapter)
 (put 'iappendix 'texinfo-format 'texinfo-format-chapter)
 (put 'appendix 'texinfo-format 'texinfo-format-chapter)
 (put 'iunnumbered 'texinfo-format 'texinfo-format-chapter)
-(put 'centerchap 'texinfo-format 'texinfo-format-chapter)
 (put 'top 'texinfo-format 'texinfo-format-chapter)
 (put 'unnumbered 'texinfo-format 'texinfo-format-chapter)
+(put 'centerchap 'texinfo-format 'texinfo-format-chapter)
 (defun texinfo-format-chapter ()
   (texinfo-format-chapter-1 ?*))
 
 	(unformated-row (texinfo-multitable-extract-row)))
     ;; Use a temporary buffer
     (set-buffer (get-buffer-create texinfo-multitable-buffer-name))
+    ;; XEmacs change
+    ;; Temporary buffer must use texinfo-format-syntax-table
+    ;; or it will fail when parsing other commands.
     (set-syntax-table texinfo-format-syntax-table)
     (delete-region (point-min) (point-max))
     (insert unformated-row)
                  (progn (re-search-forward "@end html[ \t]*\n")
                         (point))))
 
+;; XEmacs change.
+;; FSF 21.0 will include these changes.
 (put 'ifnottex 'texinfo-format 'texinfo-discard-line)
 (put 'ifnottex 'texinfo-end 'texinfo-discard-command)
 
          texinfo-enclosure-list))))
 
 
+;;; @alias
+
+(put 'alias 'texinfo-format 'texinfo-alias)
+(defun texinfo-alias ()
+  (let ((start (1- (point)))
+        args)
+    (skip-chars-forward " ")
+    (save-excursion (end-of-line) (setq texinfo-command-end (point)))
+    (if (not (looking-at "\\([^=]+\\)=\\(.*\\)"))
+	(error "Invalid alias command")
+      (setq texinfo-alias-list
+	    (cons
+	     (cons
+	      (buffer-substring (match-beginning 1) (match-end 1))
+	      (buffer-substring (match-beginning 2) (match-end 2)))
+	     texinfo-alias-list))
+      (texinfo-discard-command))
+    )
+  )
+
+
 ;;; @var, @code and the like
 
 (put 'var 'texinfo-format 'texinfo-format-var)
 ;;  @sc  a small caps font for TeX; formatted as `var' in Info
 (put 'sc 'texinfo-format 'texinfo-format-var)
+;;  @acronym   for abbreviations in all caps, such as `NASA'.
+;;  Convert all letters to uppercase if they are not already.
+(put 'acronym 'texinfo-format 'texinfo-format-var)
 (defun texinfo-format-var ()
-  (insert (upcase (texinfo-parse-arg-discard)))
-  (goto-char texinfo-command-start))
-
-(put 'url 'texinfo-format 'texinfo-format-code)
+  (let ((arg (texinfo-parse-expanded-arg)))
+    (texinfo-discard-command)
+    (insert (upcase arg))))
+
 (put 'cite 'texinfo-format 'texinfo-format-code)
 (put 'code 'texinfo-format 'texinfo-format-code)
+;; @command (for command names)
+(put 'command 'texinfo-format 'texinfo-format-code)
+;; @env (for environment variables)
+(put 'env 'texinfo-format 'texinfo-format-code)
 (put 'file 'texinfo-format 'texinfo-format-code)
 (put 'samp 'texinfo-format 'texinfo-format-code)
+(put 'url 'texinfo-format 'texinfo-format-code)
 (defun texinfo-format-code ()
   (insert "`" (texinfo-parse-arg-discard) "'")
   (goto-char texinfo-command-start))
 
+;; @option (for command-line options) must be different from @code
+;; because of its special formatting in @table; namely that it does
+;; not lead to inserted ` ... ' in a table, but does elsewhere.
+(put 'option 'texinfo-format 'texinfo-format-option)
+(defun texinfo-format-option ()
+  "Insert ` ... ' around arg unless inside a table; in that case, no quotes."
+  ;; `looking-at-backward' not available in v. 18.57, 20.2
+  (if (not (search-backward ""    ; searched-for character is a control-H
+                    (save-excursion (beginning-of-line) (point))
+                    t))
+      (insert "`" (texinfo-parse-arg-discard) "'")
+      (insert  (texinfo-parse-arg-discard)))
+  (goto-char texinfo-command-start))
+
 (put 'emph 'texinfo-format 'texinfo-format-emph)
 (put 'strong 'texinfo-format 'texinfo-format-emph)
 (defun texinfo-format-emph ()
   (insert (texinfo-parse-arg-discard))
   (goto-char texinfo-command-start))
 
-(put 'uref 'texinfo-format 'texinfo-format-uref)
-(defun texinfo-format-uref ()
-  (let* ((args (texinfo-format-parse-args))
-	 (url (nth 0 args))
-	 (displayed-text (nth 1 args)))
-    (texinfo-discard-command)
-    (if displayed-text
-	(insert (format "%s (%s)" displayed-text url))
-      (insert (format "`%s'" url)))))
-
 (put 'bullet 'texinfo-format 'texinfo-format-bullet)
 (defun texinfo-format-bullet ()
   "Insert an asterisk.
     (goto-char texinfo-command-start)))
 
 
-;;; @example, @lisp, @quotation, @display, @smalllisp, @smallexample
+;;; @example, @lisp, @quotation, @display, @smalllisp, @smallexample,
+;;  @smalldisplay
 
 (put 'display 'texinfo-format 'texinfo-format-example)
+(put 'smalldisplay 'texinfo-format 'texinfo-format-example)
 (put 'example 'texinfo-format 'texinfo-format-example)
 (put 'lisp 'texinfo-format 'texinfo-format-example)
 (put 'quotation 'texinfo-format 'texinfo-format-example)
 
 (put 'example 'texinfo-end 'texinfo-end-example)
 (put 'display 'texinfo-end 'texinfo-end-example)
+(put 'smalldisplay 'texinfo-end 'texinfo-end-example)
 (put 'lisp 'texinfo-end 'texinfo-end-example)
 (put 'quotation 'texinfo-end 'texinfo-end-example)
 (put 'smallexample 'texinfo-end 'texinfo-end-example)
 (defun texinfo-format-direntry ()
   (texinfo-push-stack 'direntry nil)
   (texinfo-discard-line)
-  (insert "START-INFO-DIR-ENTRY\n\n"))
+  (insert "START-INFO-DIR-ENTRY\n"))
 
 (put 'direntry 'texinfo-end 'texinfo-end-direntry)
 (defun texinfo-end-direntry ()
 ;; indent; this means that in Info, @format is similar to @flushleft.
 
 (put 'format 'texinfo-format 'texinfo-format-flushleft)
+(put 'smallformat 'texinfo-format 'texinfo-format-flushleft)
 (put 'flushleft 'texinfo-format 'texinfo-format-flushleft)
 (defun texinfo-format-flushleft ()
   (texinfo-discard-line))
 
 (put 'format 'texinfo-end 'texinfo-end-flushleft)
+(put 'smallformat 'texinfo-end 'texinfo-end-flushleft)
 (put 'flushleft 'texinfo-end 'texinfo-end-flushleft)
 (defun texinfo-end-flushleft ()
   (texinfo-discard-command))
   "Refill paragraph. Also, indent first line as set by @paragraphindent.
 Default is to leave paragraph indentation as is."
   (texinfo-discard-command)
-  (forward-paragraph -1)     
-  (if (looking-at "[ \t\n]*$") (forward-line 1))
-  ;; Do not indent if an entry in a list, table, or deffn,
-  ;; or if paragraph is preceded by @noindent.
-  ;; Otherwise, indent
-  (cond 
-   ;; delete a @noindent line and do not indent paragraph
-   ((save-excursion (forward-line -1)
-                    (looking-at "^@noindent")) 
+  (let ((position (point-marker)))
+    (forward-paragraph -1)     
+    (if (looking-at "[ \t\n]*$") (forward-line 1))
+    ;; Do not indent if an entry in a list, table, or deffn,
+    ;; or if paragraph is preceded by @noindent.
+    ;; Otherwise, indent
+    (cond 
+     ;; delete a @noindent line and do not indent paragraph
+     ((save-excursion (forward-line -1)
+		      (looking-at "^@noindent")) 
+      (forward-line -1)
+      (delete-region (point) (progn (forward-line 1) (point))))
+     ;; do nothing if "asis"
+     ((equal texinfo-paragraph-indent "asis"))
+     ;; do no indenting in list, etc.
+     ((> texinfo-stack-depth 0))   
+     ;; otherwise delete existing whitespace and indent
+     (t 
+      (delete-region (point) (progn (skip-chars-forward " \t") (point)))
+      (insert (make-string texinfo-paragraph-indent ? ))))
+    (forward-paragraph 1) 
     (forward-line -1)
-    (delete-region (point) (progn (forward-line 1) (point))))
-   ;; do nothing if "asis"
-   ((equal texinfo-paragraph-indent "asis"))
-   ;; do no indenting in list, etc.
-   ((> texinfo-stack-depth 0))   
-   ;; otherwise delete existing whitespace and indent
-   (t 
-    (delete-region (point) (progn (skip-chars-forward " \t") (point)))
-    (insert (make-string texinfo-paragraph-indent ? ))))
-  (forward-paragraph 1) 
-  (forward-line -1)
-  (end-of-line)
-  ;; Do not fill a section title line with asterisks, hyphens, etc. that
-  ;; are used to underline it.  This could occur if the line following
-  ;; the underlining is not an index entry and has text within it.
-  ;; XEmacs change: the standard 3.6 paragraph separators cause
-  ;; texinfmt to fail on vm.texi so we continue to use the older version.
-  (let* ((previous-paragraph-separate paragraph-separate)
-         (paragraph-separate (concat paragraph-separate "\\|^[=*---.]+"))
-         (previous-paragraph-start paragraph-start)
-         (paragraph-start (concat paragraph-start "\\|^[=*---.]+")))
-    (unwind-protect
-        (fill-paragraph nil)
-      (setq paragraph-separate previous-paragraph-separate)
-      (setq paragraph-start previous-paragraph-start))))
+    (end-of-line)
+    ;; Do not fill a section title line with asterisks, hyphens, etc. that
+    ;; are used to underline it.  This could occur if the line following
+    ;; the underlining is not an index entry and has text within it.
+    ;; XEmacs change: the standard 3.6 paragraph separators cause
+    ;; texinfmt to fail on vm.texi so we continue to use the older version.
+    (let* ((previous-paragraph-separate paragraph-separate)
+	   (paragraph-separate (concat paragraph-separate "\\|^[=*---.]+"))
+;;;	   (paragraph-separate
+;;;	    (concat paragraph-separate "\\|[-=.]+\\|\\*\\*+"))
+	   (previous-paragraph-start paragraph-start)
+	   (paragraph-start (concat paragraph-start "\\|^[=*---.]+")))
+;;;	   (paragraph-start 
+;;;	    (concat paragraph-start "\\|[-=.]+\\|\\*\\*+")))
+      (unwind-protect
+	  (fill-paragraph nil)
+	(setq paragraph-separate previous-paragraph-separate)
+	(setq paragraph-start previous-paragraph-start)))
+    (goto-char position)))
 
 (put 'noindent 'texinfo-format 'texinfo-noindent)
 (defun texinfo-noindent ()  
    (insert "\"\"" (texinfo-parse-arg-discard))
    (goto-char texinfo-command-start))
 
-; @ringaccent{o}  ==>    *o        ring accent
+;; @ringaccent{o}  ==>    *o        ring accent
 (put 'ringaccent 'texinfo-format 'texinfo-format-ring-accent)
 (defun texinfo-format-ring-accent ()
    (insert "*" (texinfo-parse-arg-discard))
 (put 'lispnarrowing 'texinfo-format 'texinfo-discard-line-with-args)
 (put 'need 'texinfo-format 'texinfo-discard-line-with-args)
 (put 'nopara 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; @novalidate suppresses cross-reference checking and auxiliary file
+;; creation with TeX.  The Info-validate command checks that every
+;; node pointer points to an existing node.  Since this Info command
+;; is not invoked automatically, the @novalidate command is irrelevant
+;; and not supported by texinfmt.el
+(put 'novalidate 'texinfo-format 'texinfo-discard-line-with-args)
+
 (put 'page 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'pagesizes 'texinfo-format 'texinfo-discard-line-with-args)
 (put 'parindent 'texinfo-format 'texinfo-discard-line-with-args)
 (put 'setchapternewpage 'texinfo-format 'texinfo-discard-line-with-args)
 (put 'setq 'texinfo-format 'texinfo-discard-line-with-args)
+
+(put 'setcontentsaftertitlepage
+     'texinfo-format 'texinfo-discard-line-with-args)
+(put 'setshortcontentsaftertitlepage
+     'texinfo-format 'texinfo-discard-line-with-args)
+
 (put 'settitle 'texinfo-format 'texinfo-discard-line-with-args)
 (put 'setx 'texinfo-format 'texinfo-discard-line-with-args)
 (put 'shortcontents 'texinfo-format 'texinfo-discard-line-with-args)
                (setq error 1
                      command-line-args-left (cdr command-line-args-left)))
               ((file-directory-p file)
+	       ;; XEmacs change
                (setq command-line-args-left
                      (nconc (directory-files
 			     file