Commits

ben  committed 451b293

To: xemacs-patches@xemacs.org

Makefile: Compile texinfo earlier due to dependencies.
informat.el, texinfmt.el, texinfo.el, texnfo-upd.el: Sync with FSF 21.3.
texinfo.el: Act on region if active.

  • Participants
  • Parent commits 179e4b3

Comments (0)

Files changed (6)

+2004-11-07  Ben Wing  <ben@xemacs.org>
+
+	* Makefile (ELCS):
+	Compile texinfo earlier due to dependencies.
+	
+	* informat.el:
+	* informat.el (Info-tagify):
+	* informat.el (Info-validate):
+	* informat.el (batch-info-validate):
+	* texinfmt.el:
+	* texinfmt.el (texinfmt-version):
+	* texinfmt.el (texinfo-format-buffer):
+	* texinfmt.el (tex-start-of-header)): New.
+	* texinfmt.el (tex-end-of-header)): New.
+	* texinfmt.el (texinfo-format-region):
+	* texinfmt.el (texinfo-format-buffer-1):
+	* texinfmt.el (texinfo-format-convert):
+	* texinfmt.el (texinfo-no-refill-regexp):
+	* texinfmt.el (texinfo-append-refill):
+	* texinfmt.el (texinfo-raise-lower-sections):
+	* texinfmt.el (texinfo-raisesections-alist):
+	* texinfmt.el (texinfo-lowersections-alist):
+	* texinfmt.el (texinfo-format-scan):
+	* texinfmt.el (texinfo-copying-text): New.
+	* texinfmt.el (texinfo-copying): New.
+	* texinfmt.el (texinfo-insertcopying): New.
+	* texinfmt.el (texinfo-parse-line-arg):
+	* texinfmt.el (texinfo-parse-expanded-arg):
+	* texinfmt.el (texinfo-format-parse-line-args):
+	* texinfmt.el (texinfo-format-parse-args):
+	* texinfmt.el (texinfo-format-parse-defun-args):
+	* texinfmt.el (texinfo-discard-line):
+	* texinfmt.el (texinfo-anchor):
+	* texinfmt.el (texinfo-format-xref):
+	* texinfmt.el (texinfo-format-uref):
+	* texinfmt.el (texinfo-format-documentdescription): New.
+	* texinfmt.el (texinfo-footnote-style):
+	* texinfmt.el (texinfo-format-separate-node):
+	* texinfmt.el (texinfo-enumerate):
+	* texinfmt.el (texinfo-enumerate-item):
+	* texinfmt.el (texinfo-alphaenumerate-item):
+	* texinfmt.el (texinfo-capsenumerate-item):
+	* texinfmt.el (texinfo-table):
+	* texinfmt.el (texinfo-multitable-widths):
+	* texinfmt.el (texinfo-multitable-extract-row):
+	* texinfmt.el (texinfo-multitable-item):
+	* texinfmt.el (texinfo-format-iftex):
+	* texinfmt.el (texinfo-format-ifhtml):
+	* texinfmt.el (texinfo-format-image): New.
+	* texinfmt.el (texinfo-format-ifplaintext): New.
+	* texinfmt.el (texinfo-format-ifxml): New.
+	* texinfmt.el (texinfo-format-tex):
+	* texinfmt.el (texinfo-format-html):
+	* texinfmt.el (texinfo-format-xml): New.
+	* texinfmt.el (ifnotplaintext):
+	* texinfmt.el (texinfo-format-ifnotinfo): New.
+	* texinfmt.el (ifnothtml):
+	* texinfmt.el (texinfo-format-titlepage):
+	* texinfmt.el (texinfo-format-titlespec):
+	* texinfmt.el (texinfo-format-ignore):
+	* texinfmt.el (texinfo-alias):
+	* texinfmt.el (email):
+	* texinfmt.el (texinfo-format-email): New.
+	* texinfmt.el (texinfo-format-verb): New.
+	* texinfmt.el (texinfo-format-kbd-regexp):
+	* texinfmt.el (texinfo-format-kbd-end-regexp):
+	* texinfmt.el (texinfo-format-kbd):
+	* texinfmt.el (texinfo-format-dircategory):
+	* texinfmt.el (texinfo-do-flushright):
+	* texinfmt.el (texinfo-format-refill):
+	* texinfmt.el (texinfo-noindent):
+	* texinfmt.el (texinfo-format-defindex):
+	* texinfmt.el (texinfo-sort-region):
+	* texinfmt.el (texinfo-sort-startkeyfun):
+	* texinfmt.el (texinfo-format-deftypefn):
+	* texinfmt.el (texinfo-format-deftypefun):
+	* texinfmt.el (texinfo-format-defop):
+	* texinfmt.el (texinfo-format-defcv):
+	* texinfmt.el (texinfo-format-defmethod):
+	* texinfmt.el (texinfo-index-defun):
+	* texinfmt.el (texinfo-index-deffn):
+	* texinfmt.el (texinfo-index-deftypefn):
+	* texinfmt.el (texinfo-index-defmethod):
+	* texinfmt.el (texinfo-index-defop):
+	* texinfmt.el (texinfo-index-defivar):
+	* texinfmt.el (texinfo-index-defcv):
+	* texinfmt.el (texinfo-set):
+	* texinfmt.el (texinfo-value):
+	* texinfmt.el (texinfo-if-set):
+	* texinfmt.el (texinfo-if-clear):
+	* texinfmt.el (texinfo-format-ifeq):
+	* texinfmt.el (afourpaper):
+	* texinfmt.el (documentlanguage):
+	* texinfmt.el (texinfo-unsupported):
+	* texinfmt.el (batch-texinfo-format):
+	* texinfo.el:
+	* texinfo.el (require):
+	* texinfo.el (texinfo-open-quote): New.
+	* texinfo.el (texinfo-version): Removed.
+	* texinfo.el (texinfo-close-quote): New.
+	* texinfo.el (texinfo-update-node):
+	* texinfo.el (texinfo-section-list): New.
+	* texinfo.el (texinfo-mode-syntax-table):
+	* texinfo.el (texinfo-imenu-generic-expression):
+	* texinfo.el (texinfo-font-lock-syntactic-keywords): New.
+	* texinfo.el (texinfo-environments): New.
+	* texinfo.el (texinfo-environment-regexp): New.
+	* texinfo.el (texinfo-heading-face): New.
+	* texinfo.el (texinfo-clone-environment): New.
+	* texinfo.el (texinfo-mode-map):
+	* texinfo.el (texinfo-mode-menu):
+	* texinfo.el (texinfo-filter): New.
+	* texinfo.el (texinfo-chapter-level-regexp):
+	* texinfo.el (texinfo-mode):
+	* texinfo.el (texinfo-block-default): New.
+	* texinfo.el (texinfo-insert-block): New.
+	* texinfo.el (texinfo-inside-macro-p): New.
+	* texinfo.el (texinfo-inside-env-p): New.
+	* texinfo.el (texinfo-insert-quote): New.
+	* texinfo.el (texinfo-last-unended-begin): New.
+	* texinfo.el (texinfo-next-unmatched-end): New.
+	* texinfo.el (texinfo-insert-@email): New.
+	* texinfo.el (texinfo-insert-@emph): New.
+	* texinfo.el (texinfo-insert-@node):
+	* texinfo.el (texinfo-insert-@quotation): New.
+	* texinfo.el (texinfo-insert-@strong): New.
+	* texinfo.el (texinfo-insert-@uref): New.
+	* texinfo.el ('texinfo-insert-@url): New.
+	* texinfo.el (texinfo-show-structure):
+	* texinfo.el (texinfo-section-types-regexp)): Removed.
+	* texinfo.el (texinfo-section-level-regexp)): Removed.
+	* texinfo.el (texinfo-subsection-level-regexp)): Removed.
+	* texinfo.el (texinfo-subsubsection-level-regexp)): Removed.
+	* texnfo-upd.el:
+	* texnfo-upd.el (texinfo):
+	* texnfo-upd.el (texinfo-section-types-regexp): New.
+	* texnfo-upd.el (texinfo-section-level-regexp): New.
+	* texnfo-upd.el (texinfo-subsection-level-regexp): New.
+	* texnfo-upd.el (texinfo-subsubsection-level-regexp): New.
+	* texnfo-upd.el (texinfo-update-menu-same-level-regexps): New.
+	* texnfo-upd.el (texinfo-update-menu-higher-regexps): New.
+	* texnfo-upd.el (texinfo-update-menu-lower-regexps): New.
+	* texnfo-upd.el (texinfo-make-menu):
+	* texnfo-upd.el (texinfo-make-one-menu):
+	* texnfo-upd.el (texinfo-all-menus-update):
+	* texnfo-upd.el (texinfo-find-lower-level-node):
+	* texnfo-upd.el (texinfo-find-higher-level-node):
+	* texnfo-upd.el (texinfo-make-menu-list):
+	* texnfo-upd.el (texinfo-menu-locate-entry-p):
+	* texnfo-upd.el (texinfo-copy-node-name):
+	* texnfo-upd.el (texinfo-copy-section-title):
+	* texnfo-upd.el (texinfo-old-menu-p):
+	* texnfo-upd.el (texinfo-incorporate-descriptions):
+	* texnfo-upd.el (texinfo-incorporate-menu-entry-names):
+	* texnfo-upd.el (texinfo-menu-copy-old-description):
+	* texnfo-upd.el (texinfo-menu-end):
+	* texnfo-upd.el (texinfo-delete-old-menu):
+	* texnfo-upd.el (texinfo-insert-menu):
+	* texnfo-upd.el (texinfo-start-menu-description):
+	* texnfo-upd.el (texinfo-indent-menu-description):
+	* texnfo-upd.el (texinfo-menu-indent-description):
+	* texnfo-upd.el (texinfo-master-menu):
+	* texnfo-upd.el (texinfo-master-menu-list):
+	* texnfo-upd.el (texinfo-insert-master-menu-list):
+	* texnfo-upd.el (texinfo-copy-menu-title):
+	* texnfo-upd.el (texinfo-copy-menu):
+	* texnfo-upd.el (texinfo-specific-section-type):
+	* texnfo-upd.el (texinfo-hierarchic-level):
+	* texnfo-upd.el (texinfo-update-menu-region-beginning):
+	* texnfo-upd.el (texinfo-update-menu-region-end):
+	* texnfo-upd.el (texinfo-update-node):
+	* texnfo-upd.el (texinfo-section-to-generic-alist): Removed.
+	* texnfo-upd.el (texinfo-chapter-level-regexp): Removed.
+	* texnfo-upd.el (texinfo-every-node-update):
+	* texnfo-upd.el (texinfo-update-the-node):
+	* texnfo-upd.el (texinfo-top-pointer-case):
+	* texnfo-upd.el (texinfo-check-for-node-name):
+	* texnfo-upd.el (texinfo-delete-existing-pointers):
+	* texnfo-upd.el (texinfo-find-pointer):
+	* texnfo-upd.el (texinfo-pointer-name):
+	* texnfo-upd.el (texinfo-sequential-node-update):
+	* texnfo-upd.el (texinfo-sequentially-update-the-node):
+	* texnfo-upd.el (texinfo-sequentially-insert-pointer): New.
+	* texnfo-upd.el (texinfo-sequentially-find-pointer):
+	* texnfo-upd.el (texinfo-insert-node-lines):
+	* texnfo-upd.el (texinfo-multi-file-included-list):
+	* texnfo-upd.el (texinfo-copy-next-section-title):
+	* texnfo-upd.el (texinfo-multi-file-update):
+	* texnfo-upd.el (texinfo-multi-files-insert-main-menu):
+	* texnfo-upd.el (texinfo-multi-file-master-menu-list):
+	* texnfo-upd.el (texinfo-multiple-files-update):
+	Sync with FSF 21.3.
+
+	* texinfo.el (texinfo-insert-@-with-arg):
+	Act on region if active.
+
 2003-10-31  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.25 released.
 REQUIRES = xemacs-base
 CATEGORY = standard
 
-ELCS = detexinfo.elc informat.elc makeinfo.elc tex-mode.elc texinfmt.elc \
-	texinfo.elc texnfo-tex.elc texnfo-upd.elc
+ELCS = detexinfo.elc informat.elc makeinfo.elc texinfo.elc tex-mode.elc \
+        texinfmt.elc texnfo-tex.elc texnfo-upd.elc
 
 include ../../XEmacs.rules
 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ;; 02111-1307, USA.
 
-;;; Synched up with: FSF 20.5.
+;;; Synched up with: FSF 21.3.
 
 ;;; Commentary:
 
 	(opoint (point)))
     (unwind-protect
     (progn
+      (widen)
       (goto-char (point-min))
       (if (search-forward "\^_\nIndirect:\n" nil t)
           (message
         (let (tag-list
               refillp
               (case-fold-search t)
-              (regexp 
+              (regexp
                (concat
                 "\\("
 
                 "\\|"
 
                 "\\("
-                "\n\^_"
+                "\n\^_\\(\^L\\)?"
                 "\\)"
 
                 "\\("
-                "\nFile:[ \t]*\\([^,\n\t]*\\)[,\t\n]+[ \t\n]*"
+                "\n\\(File:[ \t]*\\([^,\n\t]*\\)[,\t\n]+[ \t\n]*\\)?"
                 "Node:[ \t]*"
                 "\\("
-                "[^,\n\t]*"      ; match-string 11 matches arg to node name
+                "[^,\n\t]*"      ; match-string 13 matches arg to node name
                 "\\)"
                 "[,\t\n]"
                 "\\)"
                   (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))
+                    (cons (list
+                           (concat "Node: " (match-string-no-properties 13))
+                           (1+ (match-beginning 10)))
                           tag-list))))
 
 	      (goto-char (point-max))
 		      (beginning-of-line)
 		      (delete-region (point) end)))
 		(goto-char (point-max))
-		(insert "\n\^_\f\nTag table:\n")
+		(or (bolp)
+		    (newline))
+		(insert "\^_\f\nTag table:\n")
 		(if (eq major-mode 'info-mode)
 		    (move-marker Info-tag-table-marker (point)))
 		(setq tag-list (nreverse tag-list))
       (narrow-to-region omin (if nomax (1+ (buffer-size))
 			       (min omax (point-max))))))
   (if input-buffer-name
-      (message "Tagifying region in %s ..." input-buffer-name)
+      (message "Tagifying region in %s done" input-buffer-name)
       (message
-       "Tagifying %s ..."  (file-name-nondirectory (buffer-file-name)))))
+       "Tagifying %s done"  (file-name-nondirectory (buffer-file-name)))))
 
 
 ;;;###autoload
 	    (forward-line 1)
 	    (if (re-search-backward regexp beg t)
 		(save-restriction
-		  (search-forward "\n\^_" nil 'move)
-		  (narrow-to-region beg (point))
+		  (let ((md (match-data)))
+		    (search-forward "\n\^_" nil 'move)
+		    (narrow-to-region beg (point))
+		    (set-match-data md))
 		  (setq Info-validate-thisnode (downcase
 						(buffer-substring-no-properties
 						 (match-beginning 1)
 Each file will be processed even if an error occurred previously.
 For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
   (if (not noninteractive)
-      (error "batch-info-validate may only be used -batch."))
+      (error "batch-info-validate may only be used -batch"))
   (let ((version-control t)
 	(auto-save-default nil)
 	(find-file-run-dired nil)
 	(cond ((not (file-exists-p file))
 	       (message ">> %s does not exist!" file)
 	       (setq error 1
-		     command-line-args-left (cdr command-line-args-left))) 
+		     command-line-args-left (cdr command-line-args-left)))
 	      ((file-directory-p file)
 	       (setq command-line-args-left (nconc (directory-files file)
 					      (cdr command-line-args-left))))
-;;; texinfmt.el --- format Texinfo files into Info files.
-
-;; 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>
+;;; texinfmt.el --- format Texinfo files into Info files
+
+;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993,
+;;               1994, 1995, 1996, 1997, 1998, 2000, 2001
+;;    Free Software Foundation, Inc.
+
+;; Maintainer: Robert J. Chassell <bug-texinfo@gnu.org>
 ;; 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.5.
+;;; Synched up with: FSF 21.3.
 
 ;;; Commentary:
 
 ;; should be due to whitespace (the author doesn't believe in TABs)
 ;; other than the VM manual fuckage.
 
+;;; Commentary:
+
 ;;; Code:
 
 ;;; Emacs lisp functions to convert Texinfo files to Info files.
     (defmacro defcustom (var value doc &rest ignore)
       `(defvar ,var ,value ,doc)))
 
-(defvar texinfmt-version "2.38 of 3 July 1998")
+(defvar texinfmt-version "2.40 of  6 Dec 2002")
 
 (defun texinfmt-version (&optional here)
   "Show the version of texinfmt.el in the minibuffer.
 If optional argument HERE is non-nil, insert info at point."
   (interactive "P")
-  (let ((version-string 
-	 (format "Version of \`texinfmt.el\': %s" texinfmt-version)))
-    (if here 
-	(insert version-string)
+  (let ((version-string
+         (format "Version of \`texinfmt.el\': %s" texinfmt-version)))
+    (if here
+        (insert version-string)
       (if (interactive-p)
-	  (message "%s" version-string)
-	version-string))))
+          (message "%s" version-string)
+        version-string))))
 
 ;;; Variable definitions
 
 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))
+        ;; 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)
 (defvar texinfo-region-buffer-name "*Info Region*"
   "*Name of the temporary buffer used by \\[texinfo-format-region].")
 
+;; These come from tex-mode.el.
+(defvar tex-start-of-header)
+(defvar tex-end-of-header)
+
 ;;;###autoload
 (defun texinfo-format-region (region-beginning region-end)
   "Convert the current region of the Texinfo file to Info format.
         (header-text "")
         (header-beginning 1)
         (header-end 1))
-    
-;;; Copy lines between beginning and end of header lines, 
+
+;;; Copy lines between beginning and end of header lines,
 ;;;    if any, or else copy the `@setfilename' line, if any.
     (save-excursion
         (save-restriction
           (let ((search-end (save-excursion (forward-line 100) (point))))
             (if (or
                  ;; Either copy header text.
-                 (and 
-                  (prog1 
+                 (and
+                  (prog1
                       (search-forward tex-start-of-header search-end t)
                     (forward-line 1)
                     ;; Mark beginning of header.
                     (setq header-beginning (point)))
-                  (prog1 
+                  (prog1
                       (search-forward tex-end-of-header nil t)
                     (beginning-of-line)
                     ;; Mark end of header
                   (setq header-beginning (point))
                   (forward-line 1)
                   (setq header-end (point))))
-                
-                ;; Copy header  
+
+                ;; Copy header
                 (setq header-text
-                      (buffer-substring
+                      (buffer-substring-no-properties
                        (min header-beginning region-beginning)
                        header-end))))))
 
     ;; Make sure region ends in a newline.
     (or (= (preceding-char) ?\n)
         (insert "\n"))
-    
+
     (goto-char (point-min))
     ;; XEmacs change
     ;; Remove trailing WS like makeinfo does
     (save-excursion
       (message "Removing trailing whitespace from Info region...")
       (while (re-search-forward "[ \t]+$" nil t)
-	(replace-match "" nil nil)))
+        (replace-match "" nil nil)))
 ;;;      )
     (texinfo-mode)
     (message "Converting region to Info format...")
 
     ;; Insert @include files so `texinfo-raise-lower-sections' can
     ;; work on them without losing track of multiple
-    ;; @raise/@lowersections commands. 
+    ;; @raise/@lowersections commands.
     (while (re-search-forward "^@include" nil t)
       (setq texinfo-command-end (point))
       (let ((filename (concat input-directory
             (goto-char (point-min))
             ;; Remove `@setfilename' line from included file, if any,
             ;; so @setfilename command not duplicated.
-            (if (re-search-forward 
-                 "^@setfilename" (save-excursion (forward-line 100) (point)) t)
-                (progn
-                  (beginning-of-line)
-                  (delete-region
-                   (point) (save-excursion (forward-line 1) (point)))))))))
+            (if (re-search-forward "^@setfilename" (line-end-position 100) t)
+		(delete-region (line-beginning-position 1)
+			       (line-beginning-position 2)))))))
 
     ;; Raise or lower level of each section, if necessary.
     (goto-char (point-min))
 
     (goto-char (point-min))
     (if (looking-at "\\\\input[ \t]+texinfo")
-        (delete-region (point) (save-excursion (forward-line 1) (point))))
+        (delete-region (point) (line-beginning-position 2)))
 
     ;; Insert Info region title text.
     (goto-char (point-min))
-    (if (search-forward 
+    (if (search-forward
          "@setfilename" (save-excursion (forward-line 100) (point)) t)
         (progn
           (setq texinfo-command-end (point))
           (let ((arg (texinfo-parse-arg-discard)))
             (insert " "
               texinfo-region-buffer-name
-              " buffer for:  `") 
+              " buffer for:  `")
             (insert (file-name-nondirectory (expand-file-name arg)))
             (insert "',        -*-Text-*-\n")))
       ;; Else no `@setfilename' line
     (save-excursion
       (goto-char (point-min))
       (or (search-forward "@setfilename" nil t)
-          (error "Texinfo file needs an `@setfilename FILENAME' line."))
+          (error "Texinfo file needs an `@setfilename FILENAME' line"))
       (setq texinfo-command-end (point))
       (setq outfile (texinfo-parse-line-arg)))
 
 
     (message "Formatting Info file: %s" outfile)
     (setq texinfo-format-filename
-	  (file-name-nondirectory (expand-file-name outfile)))
+          (file-name-nondirectory (expand-file-name outfile)))
 
     (setq fill-column fill-column-for-info)
     (set-syntax-table texinfo-format-syntax-table)
 
     (insert-buffer-substring input-buffer)
     (message "Converting %s to Info format..." (buffer-name input-buffer))
-    
+
     ;; Insert @include files so `texinfo-raise-lower-sections' can
     ;; work on them without losing track of multiple
-    ;; @raise/@lowersections commands. 
+    ;; @raise/@lowersections commands.
     (goto-char (point-min))
     ;; XEmacs change.
     ;; Remove trailing WS like makeinfo does
     (save-excursion
       (message "Removing trailing whitespace from Info buffer...")
       (while (re-search-forward "[ \t]+$" nil t)
-	(replace-match "" nil nil)))
+        (replace-match "" nil nil)))
 ;;;      )
     (while (re-search-forward "^@include" nil t)
       (setq texinfo-command-end (point))
       (let ((filename (concat input-directory
                               (texinfo-parse-line-arg))))
         (re-search-backward "^@include")
-        (delete-region (point) (save-excursion (forward-line 1) (point)))
+        (delete-region (point) (line-beginning-position 2))
         (message "Reading included file: %s" filename)
         (save-excursion
           (save-restriction
             (goto-char (point-min))
             ;; Remove `@setfilename' line from included file, if any,
             ;; so @setfilename command not duplicated.
-            (if (re-search-forward 
-                 "^@setfilename"
-                 (save-excursion (forward-line 100) (point)) t)
-                (progn
-                  (beginning-of-line)
-                  (delete-region
-                   (point) (save-excursion (forward-line 1) (point)))))))))
+            (if (re-search-forward "^@setfilename" (line-end-position 100) t)
+		(delete-region (line-beginning-position 1)
+			       (line-beginning-position 2)))))))
     ;; Raise or lower level of each section, if necessary.
     (goto-char (point-min))
     (texinfo-raise-lower-sections)
     (goto-char (point-min))
     ;; Insert info about how this file was made.
     (insert "Info file: "
-	    texinfo-format-filename ",    -*-Text-*-\n"
-	    "produced by `texinfo-format-buffer'\n"
-	    ;; Date string removed so that regression testing is easier.
-	    ;; "on "
-	    ;; (insert (format-time-string "%e %b %Y")) " "
-	    "from file"
-	    (if (buffer-file-name input-buffer)
-		(concat " `"
-			(file-name-sans-versions
-			 (file-name-nondirectory
-			  (buffer-file-name input-buffer)))
-			"'")
-	      (concat "buffer `" (buffer-name input-buffer) "'"))
-	    "\nusing `texinfmt.el' version "
-	    texinfmt-version
-	    ".\n\n")
+            texinfo-format-filename ",    -*-Text-*-\n"
+            "produced by `texinfo-format-buffer'\n"
+            ;; Date string removed so that regression testing is easier.
+            ;; "on "
+            ;; (insert (format-time-string "%e %b %Y")) " "
+            "from file"
+            (if (buffer-file-name input-buffer)
+                (concat " `"
+                        (file-name-sans-versions
+                         (file-name-nondirectory
+                          (buffer-file-name input-buffer)))
+                        "'")
+              (concat "buffer `" (buffer-name input-buffer) "'"))
+            "\nusing `texinfmt.el' version "
+            texinfmt-version
+            ".\n\n")
     ;; Return data for indices.
     (list outfile
           texinfo-vindex texinfo-findex texinfo-cindex
   (goto-char min)
   ;; XEmacs change.
   (while (re-search-forward "\\( \\|\\w\\)\\(---\\)\\( \\|\\w\\|\n\\)" max t)
-    (delete-region (1+ (match-beginning 2)) (+ 2 (match-beginning
-    2)))))
+    (delete-region (1+ (match-beginning 2)) (+ 2 (match-beginning 2)))))
 
 
 ;;; Handle paragraph filling
   (concat
    "^@"
    "\\("
+   ;; add "itemize\\|"   (from experiment of 2001 Nov 28)
+   ;;     because of a problem with @end itemize@refill
+   ;;     I don't know if this causes other problems.
+   ;;     I suspect itemized lists don't get filled properly and a
+   ;;     more precise fix is required.  Bob
+   "itemize\\|"
    "direntry\\|"
    "lisp\\|"
    "smalllisp\\|"
 
 (defun texinfo-append-refill ()
   "Append @refill at end of each paragraph that should be filled.
-Do not append @refill to paragraphs within @example and similar environments.  
+Do not append @refill to paragraphs within @example and similar environments.
 Do not append @refill to paragraphs containing @w{TEXT} or @*."
 
   ;; It is necessary to append @refill before other processing because
   ;; the other processing removes information that tells Texinfo
   ;; whether the text should or should not be filled.
-  
+
   (while (< (point) (point-max))
     (let ((refill-blank-lines "^[ \t\n]*$")
           (case-fold-search nil))       ; Don't confuse @TeX and @tex....
       (beginning-of-line)
       ;; 1. Skip over blank lines;
-      ;;    skip over lines beginning with @-commands, 
+      ;;    skip over lines beginning with @-commands,
       ;;    but do not skip over lines
       ;;      that are no-refill environments such as @example or
       ;;      that begin with within-paragraph @-commands such as @code.
       (while (and (looking-at (concat "^@\\|^\\\\\\|" refill-blank-lines))
-                  (not (looking-at 
+                  (not (looking-at
                         (concat
-                         "\\(" 
+                         "\\("
                          texinfo-no-refill-regexp
-                         "\\|" 
+                         "\\|"
                          texinfo-part-of-para-regexp
                          "\\)")))
                   (< (point) (point-max)))
         (forward-line 1))
       ;; 2. Skip over @example and similar no-refill environments.
       (if (looking-at texinfo-no-refill-regexp)
-          (let ((environment
-                 (buffer-substring (match-beginning 1) (match-end 1))))
+          (let ((environment (match-string-no-properties 1)))
             (progn (re-search-forward (concat "^@end " environment) nil t)
                    (forward-line 1)))
-	;; Else
-	;; 3. Do not refill a paragraph containing @w or @*, or ending
-	;;    with @<newline> followed by a newline.
-        (if  (or
-              (>= (point) (point-max))
-	      (re-search-forward 
-	       "@w{\\|@\\*\\|@\n\n" 
-	       (save-excursion
-		 (forward-paragraph)
-		 (forward-line 1)
-		 (point)) t))
-	    ;; Go to end of paragraph and do nothing.
-            (forward-paragraph) 
+        ;; Else
+        ;; 3. Do not refill a paragraph containing @w or @*, or ending
+        ;;    with @<newline> followed by a newline.
+        (if  (or (>= (point) (point-max))
+		 (re-search-forward
+		  "@w{\\|@\\*\\|@\n\n"
+		  (save-excursion (forward-paragraph) (forward-line 1) (point))
+		  t))
+            ;; Go to end of paragraph and do nothing.
+            (forward-paragraph)
           ;; 4. Else go to end of paragraph and insert @refill
           (forward-paragraph)
           (forward-line -1)
-	  (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")))
+          (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))))))
 
 
 ;;; Handle `@raisesections' and `@lowersections' commands
 
 ;; These commands change the hierarchical level of chapter structuring
-;; commands. 
-;;    
+;; commands.
+;;
 ;; @raisesections changes @subsection to @section,
 ;;                        @section    to @chapter,
 ;;                        etc.
 ;;
 ;; Repeated @raisesections/@lowersections continue to raise or lower
 ;; the heading level.
-;; 
+;;
 ;; An @lowersections command cancels an @raisesections command, and
 ;; vice versa.
 ;;
 ;; @section produce chapter headings).
 
 (defun texinfo-raise-lower-sections ()
-  "Raise or lower the hierarchical level of chapters, sections, etc. 
+  "Raise or lower the hierarchical level of chapters, sections, etc.
 
 This function acts according to `@raisesections' and `@lowersections'
 commands in the Texinfo file.
 An attempt to raise above `chapters' reproduces chapter commands; an
 attempt to lower below subsubsections reproduces subsubsection
 commands."
-  
+
   ;; `texinfo-section-types-regexp' is defined in `texnfo-upd.el';
   ;; it is a regexp matching chapter, section, other headings
   ;; (but not the top node).
 
   (let (type (level 0))
-    (while 
+    (while
         (re-search-forward
          (concat
           "\\(\\(^@\\(raise\\|lower\\)sections\\)\\|\\("
          nil t)
       (beginning-of-line)
       (save-excursion (setq type (read (current-buffer))))
-      (cond 
-       
+      (cond
+
        ;; 1. Increment level
        ((eq type '@raisesections)
         (setq level (1+ level))
         (delete-region
          (point) (save-excursion (forward-line 1) (point))))
-       
+
        ;; 2. Decrement level
        ((eq type '@lowersections)
         (setq level (1- level))
         (delete-region
          (point) (save-excursion (forward-line 1) (point))))
-       
+
        ;; Now handle structuring commands
        ((cond
-         
+
          ;; 3. Raise level when positive
          ((> level 0)
           (let ((count level)
               (setq count (1- count)))
             (kill-word 1)
             (insert (symbol-name new-level))))
-         
+
          ;; 4. Do nothing except move point when level is zero
          ((= level 0) (forward-line 1))
-         
+
          ;; 5. Lower level when positive
          ((< level 0)
           (let ((count level)
     (@majorheading . @majorheading)
     (@chapheading . @chapheading)
     (@appendix . @appendix)
-    
+
     (@section . @chapter)
     (@unnumberedsec . @unnumbered)
     (@heading . @chapheading)
     (@appendixsec . @appendix)
-    
+
     (@subsection . @section)
     (@unnumberedsubsec . @unnumberedsec)
     (@subheading . @heading)
     (@appendixsubsec . @appendixsec)
-    
+
     (@subsubsection . @subsection)
     (@unnumberedsubsubsec . @unnumberedsubsec)
     (@subsubheading . @subheading)
 higher types.")
 
 (defvar texinfo-lowersections-alist
-  '((@chapter . @section)  
+  '((@chapter . @section)
     (@unnumbered . @unnumberedsec)
     (@centerchap . @unnumberedsec)
     (@majorheading . @heading)
     (@chapheading . @heading)
     (@appendix . @appendixsec)
-    
+
     (@section . @subsection)
     (@unnumberedsec . @unnumberedsubsec)
     (@heading . @subheading)
     (@appendixsec . @appendixsubsec)
-    
+
     (@subsection . @subsubsection)
     (@unnumberedsubsec . @unnumberedsubsubsec)
     (@subheading . @subsubheading)
     (@appendixsubsec . @appendixsubsubsec)
-    
+
     (@subsubsection . @subsubsection) ; Cannot go lower.
     (@unnumberedsubsubsec . @unnumberedsubsubsec)
     (@subsubheading . @subsubheading)
 
 (defun texinfo-format-scan ()
   (texinfo-format-convert (point-min) (point-max))
-  ;; Scan for @-commands.
+  ;; Search for @copying, which has to be first since the
+  ;; @insertcopying command then inserts the text elsewhere.
+  (goto-char (point-min))
+  (when (search-forward "@copying" nil t)
+    (texinfo-copying))
+  (while (search-forward "@insertcopying" nil t)
+    (delete-region (match-beginning 0) (match-end 0))
+
+    (texinfo-insertcopying))
+  ;; Scan for other @-commands.
   (goto-char (point-min))
   (while (search-forward "@" nil t)
     ;;
     ;;
     ;; Old version 2.34 expression: (looking-at "[@{}^'` *\"?!]")
     (if (looking-at "[@{}^'`\"=~ \t\n*?!-]")
-	;; @*, causes a line break.
-	(cond 
-	 ;; @*, a line break
-	 ((= (following-char) ?*)
-	  ;; remove command
-	  (delete-region (1- (point)) (1+ (point)))
-	  ;; insert return if not at end of line;
-	  ;; else line is already broken.
-	  (if (not (= (following-char) ?\n))
-	      (insert ?\n)))
-	 ;; @-, deleted
-	 ((= (following-char) ?-)
-	  (delete-region (1- (point)) (1+ (point))))
-	 ;; @<space>, @<tab>, @<newline>: produce a single space,
-	 ;;    unless followed by a newline.
-	 ((= (following-char) ? )
-	  (delete-region (1- (point)) (1+ (point)))
-	  ;; insert single space if not at end of line;
-	  ;; else line is already broken.
-	  (if (not (= (following-char) ?\n))
-	      (insert ? )))
-	 ((= (following-char) ?\t)
-	  (delete-region (1- (point)) (1+ (point)))
-	  ;; insert single space if not at end of line;
-	  ;; else line is already broken.
-	  (if (not (= (following-char) ?\n))
-	      (insert ? )))
-	 ;; following char is a carriage return
-         ((= (following-char) ?
-)
-	  ;; remove command
-	  (delete-region (1- (point)) (1+ (point)))
-	  ;; insert single space if not at end of line;
-	  ;; else line is already broken.
-	  (if (not (= (following-char) ?\n))
-	      (insert ? )))
-	 ;; Otherwise: the other characters are simply quoted.  Delete the @.
-	 (t
-	  (delete-char -1)
-	  (forward-char 1)))
+        ;; @*, causes a line break.
+        (cond
+         ;; @*, a line break
+         ((= (following-char) ?*)
+          ;; remove command
+          (delete-region (1- (point)) (1+ (point)))
+          ;; insert return if not at end of line;
+          ;; else line is already broken.
+          (if (not (= (following-char) ?\n))
+              (insert ?\n)))
+         ;; @-, deleted
+         ((= (following-char) ?-)
+          (delete-region (1- (point)) (1+ (point))))
+         ;; @<space>, @<tab>, @<newline>: produce a single space,
+         ;;    unless followed by a newline.
+         ((= (following-char) ? )
+          (delete-region (1- (point)) (1+ (point)))
+          ;; insert single space if not at end of line;
+          ;; else line is already broken.
+          (if (not (= (following-char) ?\n))
+              (insert ? )))
+         ((= (following-char) ?\t)
+          (delete-region (1- (point)) (1+ (point)))
+          ;; insert single space if not at end of line;
+          ;; else line is already broken.
+          (if (not (= (following-char) ?\n))
+              (insert ? )))
+         ;; following char is a carriage return
+         ((= (following-char) ?\n)
+          ;; remove command
+          (delete-region (1- (point)) (1+ (point)))
+          ;; insert single space if not at end of line;
+          ;; else line is already broken.
+          (if (not (= (following-char) ?\n))
+              (insert ? )))
+         ;; Otherwise: the other characters are simply quoted.  Delete the @.
+         (t
+         (delete-char -1)
+	 ;; Be compatible with makeinfo: if @' and its ilk are
+	 ;; followed by a @ without a brace, barf.
+	 (if (looking-at "[\"'^`~=]")
+	     (progn
+	       (if (= (char-after (1+ (point))) ?@)
+		   (error "Use braces to give a command as an argument to @%c"
+			  (following-char)))
+	       (forward-char 1)
+	       ;; @' etc. can optionally accept their argument in
+	       ;; braces (makeinfo supports that).
+	       (when (looking-at "{")
+		 (let ((start (point)))
+		   (forward-list 1)
+		   (delete-char -1)
+		   (goto-char start)
+		   (delete-char 1))))
+	   (forward-char 1))))
       ;; @ is followed by a command-word; find the end of the word.
       (setq texinfo-command-start (1- (point)))
       (if (= (char-syntax (following-char)) ?w)
       (setq texinfo-command-end (point))
       ;; Handle let aliasing
       (setq texinfo-command-name
-	    (let (trial
-		  (cmdname 
-		   (buffer-substring
-		    (1+ texinfo-command-start) texinfo-command-end)))
-	      (while (setq trial (assoc cmdname texinfo-alias-list))
-		(setq cmdname (cdr trial)))
+            (let (trial
+                  (cmdname
+                   (buffer-substring-no-properties
+                    (1+ texinfo-command-start) texinfo-command-end)))
+              (while (setq trial (assoc cmdname texinfo-alias-list))
+                (setq cmdname (cdr trial)))
             (intern cmdname)))
       ;; Call the handler for this command.
       (let ((enclosure-type
         (if enclosure-type
             (progn
               (insert
-               (car (car (cdr enclosure-type))) 
+               (car (car (cdr enclosure-type)))
                (texinfo-parse-arg-discard)
                (car (cdr (car (cdr enclosure-type)))))
               (goto-char texinfo-command-start))
           (let ((cmd (get texinfo-command-name 'texinfo-format)))
             (if cmd (funcall cmd) (texinfo-unsupported)))))))
-  
+
   (cond (texinfo-stack
          (goto-char (nth 2 (car texinfo-stack)))
-         (error "Unterminated @%s" (car (car texinfo-stack))))))
+         (error "Unterminated @%s" (car (car texinfo-stack)))))
+
+  ;; Remove excess whitespace
+  (whitespace-cleanup))
+
+(defvar texinfo-copying-text ""
+  "Text of the copyright notice and copying permissions.")
+
+(defun texinfo-copying ()
+  "Copy the copyright notice and copying permissions from the Texinfo file,
+as indicated by the @copying ... @end copying command;
+insert the text with the @insertcopying command."
+  (let ((beg (progn (beginning-of-line) (point)))
+        (end  (progn (re-search-forward "^@end copying[ \t]*\n") (point))))
+    (setq texinfo-copying-text
+          (buffer-substring-no-properties
+           (save-excursion (goto-char beg) (forward-line 1) (point))
+           (save-excursion (goto-char end) (forward-line -1) (point))))
+    (delete-region beg end)))
+
+(defun texinfo-insertcopying ()
+  "Insert the copyright notice and copying permissions from the Texinfo file,
+which are indicated by the @copying ... @end copying command."
+  (insert (concat "\n" texinfo-copying-text)))
 
 (put 'begin 'texinfo-format 'texinfo-format-begin)
 (defun texinfo-format-begin ()
            (forward-char -1))
           (t
            (error "Invalid texinfo command arg format")))
-    (prog1 (buffer-substring start (point))
+    (prog1 (buffer-substring-no-properties start (point))
            (if (eolp) (forward-char 1)))))
 
 (defun texinfo-parse-expanded-arg ()
     (texinfo-format-expand-region start (point))
     (setq texinfo-command-end (marker-position marker))
     (move-marker marker nil)
-    (prog1 (buffer-substring start (point))
+    (prog1 (buffer-substring-no-properties start (point))
            (if (eolp) (forward-char 1)))))
 
 (defun texinfo-format-expand-region (start end)
       (forward-char -1)
       (skip-chars-backward " ")
       (setq end (point))
-      (setq args (cons (if (> end beg) (buffer-substring beg end))
+      (setq args (cons (if (> end beg) (buffer-substring-no-properties beg end))
                        args))
       (goto-char next)
       (skip-chars-forward " "))
         args)
     (search-forward "{")
     (save-excursion
-      (texinfo-format-expand-region 
+      (texinfo-format-expand-region
        (point)
        (save-excursion (up-list 1) (1- (point)))))
     ;; The following does not handle cross references of the form:
     ;; `@xref{bullet, , @code{@@bullet}@{@}}.' because the
     ;; re-search-forward finds the first right brace after the second
-    ;; comma. 
+    ;; comma.
     (while (/= (preceding-char) ?\})
       (skip-chars-forward " \t\n")
       (setq beg (point))
              (goto-char beg)
              (while (search-forward "\n" end t)
                (replace-match " "))))
-      (setq args (cons (if (> end beg) (buffer-substring beg end))
+      (setq args (cons (if (> end beg) (buffer-substring-no-properties beg end))
                        args))
       (goto-char next))
-    (if (eolp) (forward-char 1))
+    ;;(if (eolp) (forward-char 1))
     (setq texinfo-command-end (point))
     (nreverse args)))
 
                (re-search-forward "[\n ]")
                (forward-char -1)
                (setq end (point))))
-        (setq args (cons (buffer-substring beg end) args))
+        (setq args (cons (buffer-substring-no-properties beg end) args))
         (skip-chars-forward " "))
       (forward-char 1)
       (nreverse args))))
   (goto-char texinfo-command-end)
   (skip-chars-forward " \t")
   (or (eolp)
-      (error "Extraneous text at end of command line."))
+      (error "Extraneous text at end of command line"))
   (goto-char texinfo-command-start)
   (or (bolp)
-      (error "Extraneous text at beginning of command line."))
+      (error "Extraneous text at beginning of command line"))
   (delete-region (point) (progn (forward-line 1) (point))))
 
 (defun texinfo-discard-line-with-args ()
 
 (put 'anchor 'texinfo-format 'texinfo-anchor)
 (defun texinfo-anchor ()
-  (let (anchor-string 
+  (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) 
+    (forward-paragraph)
     (let ((end (point)))
-      (if (save-excursion 
+      (if (save-excursion
             (backward-word 1)
             (search-forward "@refill" end t))
           (setq anchor-string "@anchor-yes-refill")
         (insert (or fname (car args)) ": ")
         (if (nth 3 args)
             (insert "(" (nth 3 args) ")"))
-        (insert (car args))))))
+        (and (car args) (insert (car args)))))))
 
 (put 'pxref 'texinfo-format 'texinfo-format-pxref)
 (defun texinfo-format-pxref ()
 
 ;;; 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).  
+;; @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; 
+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 url-title
     (if (nth 1 args)
         (insert  (nth 1 args) " (" (nth 0 args) ")")
       (insert "`" (nth 0 args) "'"))
   (texinfo-discard-command))
 
 
+;;; @kbdinputstyle, @vskip, headings & footings
+;;  These commands for not for Info and should never
+;;  appear in an Info environment; but if they do,
+;;  this causes them to be discarded.
+
+;; @kbdinputstyle
+(put 'kbdinputstyle 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; @vskip
+(put 'vskip 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; headings & footings
+(put 'evenfooting 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'evenheading 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'oddfooting 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'oddheading 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'everyfooting 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'everyheading 'texinfo-format 'texinfo-discard-line-with-args)
+
+
+;;; @documentdescription ... @end documentdescription
+;;  This command is for HTML output and should  never
+;;  appear in an Info environment; but if it does,
+;;  this causes it to be discarded.
+
+(put 'documentdescription 'texinfo-format 'texinfo-format-documentdescription)
+(defun texinfo-format-documentdescription ()
+  (delete-region texinfo-command-start
+		 (progn (re-search-forward "^@end documentdescription[ \t]*\n")
+			(point))))
+
+
+
 ;;; @center, @sp, and @br
 
 (put 'center 'texinfo-format 'texinfo-format-center)
 ;;      are placed at the end of that node.  The footnotes are
 ;;      separated from the rest of the node by a line of dashes with
 ;;      the word `Footnotes' within it.
-;; 
+;;
 ;;    * In the Separate node style, all the footnotes for a single node
 ;;      are placed in an automatically constructed node of their own.
 
 ;;
 ;; The default is  separate
 
-(defvar texinfo-footnote-style "separate" 
+(defvar texinfo-footnote-style "separate"
   "Footnote style, either separate or end.")
 
 (put 'footnotestyle 'texinfo-format 'texinfo-footnotestyle)
             (match-end 0)))
          (node-name
           (save-excursion
-            (buffer-substring
+            (buffer-substring-no-properties
              (progn (goto-char node-name-beginning) ; skip over node command
                     (skip-chars-forward " \t")  ; and over spaces
                     (point))
         (forward-line -1))
 
     ;; two cases: for the first footnote, we must insert a node header;
-    ;; for the second and subsequent footnotes, we need only insert 
+    ;; for the second and subsequent footnotes, we need only insert
     ;; the text of the  footnote.
 
     (if (save-excursion
 (put 'enumerate 'texinfo-format 'texinfo-enumerate)
 (defun texinfo-enumerate ()
   (texinfo-push-stack
-   'enumerate 
+   'enumerate
    (progn (skip-chars-forward " \t")
           (if (eolp)
               1
            (setcar (cdr (car texinfo-stack))
                    (make-symbol
                     (char-to-string
-                     (1+ 
+                     (1+
                       (string-to-char enumerating-symbol))))))
           (t
           (error
   (texinfo-discard-line)
   (let ((next (1+ (car (cdr (car texinfo-stack))))))
     (if (> next ?z)
-        (error "More than 26 items in @alphaenumerate; get a bigger alphabet."))
+        (error "More than 26 items in @alphaenumerate; get a bigger alphabet"))
     (setcar (cdr (car texinfo-stack)) next)
     (insert "\b  " next ". \n"))
   (forward-line -1))
   (texinfo-discard-line)
   (let ((next (1+ (car (cdr (car texinfo-stack))))))
     (if (> next ?Z)
-        (error "More than 26 items in @capsenumerate; get a bigger alphabet."))
+        (error "More than 26 items in @capsenumerate; get a bigger alphabet"))
     (setcar (cdr (car texinfo-stack)) next)
     (insert "\b  " next ". \n"))
   (forward-line -1))
 
 (put 'table 'texinfo-format 'texinfo-table)
 (defun texinfo-table ()
-  (texinfo-push-stack 
-   'table 
+  (texinfo-push-stack
+   'table
    (progn (skip-chars-forward " \t")
           (if (eolp)
               "@asis"
      ((looking-at "@columnfractions")
       (forward-word 1)
       (while (not (eolp))
-	(setq texinfo-multitable-width-list
-	      (cons
-	       (truncate
-		(1-
-		 (* fill-column (read (get-buffer (current-buffer))))))
-	       texinfo-multitable-width-list))))
+        (setq texinfo-multitable-width-list
+              (cons
+               (truncate
+                (1-
+                 (* fill-column (read (get-buffer (current-buffer))))))
+               texinfo-multitable-width-list))))
      ;;
      ;; Case 2: {Column 1 template} {Column 2} {Column 3 example}
      ((looking-at "{")
       (let ((start-of-templates (point)))
-	(while (not (eolp))
-	  (skip-chars-forward " \t")
-	  (let* ((start-of-template (1+ (point)))
-		 (end-of-template
-		  ;; forward-sexp works with braces in Texinfo mode
-		  (progn (forward-sexp 1) (1- (point)))))
-	    (setq texinfo-multitable-width-list
-		  (cons (- end-of-template start-of-template)
-			texinfo-multitable-width-list))
-	    ;; Remove carriage return from within a template, if any.
-	    ;; This helps those those who want to use more than
-	    ;; one line's worth of words in @multitable line.
-	    (narrow-to-region start-of-template end-of-template)
-	    (goto-char (point-min))
-	    (while (search-forward "
+        (while (not (eolp))
+          (skip-chars-forward " \t")
+          (let* ((start-of-template (1+ (point)))
+                 (end-of-template
+                  ;; forward-sexp works with braces in Texinfo mode
+                  (progn (forward-sexp 1) (1- (point)))))
+            (setq texinfo-multitable-width-list
+                  (cons (- end-of-template start-of-template)
+                        texinfo-multitable-width-list))
+            ;; Remove carriage return from within a template, if any.
+            ;; This helps those those who want to use more than
+            ;; one line's worth of words in @multitable line.
+            (narrow-to-region start-of-template end-of-template)
+            (goto-char (point-min))
+            (while (search-forward "
 " nil t)
-	      (delete-char -1))
-	    (goto-char (point-max))
-	    (widen)
-	    (forward-char 1)))))
+              (delete-char -1))
+            (goto-char (point-max))
+            (widen)
+            (forward-char 1)))))
      ;;
      ;; Case 3: Trouble
      (t
        "You probably need to specify column widths for @multitable correctly.")))
     ;; Check whether columns fit on page.
     (let ((desired-columns
-	   (+
-	    ;; between column spaces
-	    (length texinfo-multitable-width-list)
-	    ;; additional between column spaces, if any
-	    texinfo-extra-inter-column-width
-	    ;; sum of spaces for each entry
-	    (apply '+ texinfo-multitable-width-list))))
+           (+
+            ;; between column spaces
+            (length texinfo-multitable-width-list)
+            ;; additional between column spaces, if any
+            texinfo-extra-inter-column-width
+            ;; sum of spaces for each entry
+            (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))))
+          (error
+           (format
+            "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
 Cells within rows are separated by @tab."
   (skip-chars-forward " \t")
   (let* ((start (point))
-	 (end (progn
-		(re-search-forward "@item\\|@end")
-		(match-beginning 0)))
-	 (row (progn (goto-char end)
-		     (skip-chars-backward " ")
-		     ;; remove whitespace at end of argument
-		     (delete-region (point) end)
-		     (buffer-substring start (point)))))
+         (end (progn
+                (re-search-forward "@item\\|@end")
+                (match-beginning 0)))
+         (row (progn (goto-char end)
+                     (skip-chars-backward " ")
+                     ;; remove whitespace at end of argument
+                     (delete-region (point) end)
+                     (buffer-substring-no-properties start (point)))))
     (delete-region texinfo-command-start end)
     row))
 
 All cells are made to be the same height.
 This command is executed when texinfmt sees @item inside @multitable."
   (let ((original-buffer (current-buffer))
-	(table-widths (reverse (car (cdr (car texinfo-stack)))))
-	(existing-fill-column fill-column)
-	start
-	end
-	(table-column       0)
-	(table-entry-height 0)
-	;; unformatted row looks like:  A1  @tab  A2  @tab  A3
-	;; extract-row command deletes the source line in the table.
-	(unformated-row (texinfo-multitable-extract-row)))
+        (table-widths (reverse (car (cdr (car texinfo-stack)))))
+        (existing-fill-column fill-column)
+        start
+        end
+        (table-column       0)
+        (table-entry-height 0)
+        ;; unformatted row looks like:  A1  @tab  A2  @tab  A3
+        ;; extract-row command deletes the source line in the table.
+        (unformated-row (texinfo-multitable-extract-row)))
     ;; Use a temporary buffer
     (set-buffer (get-buffer-create texinfo-multitable-buffer-name))
     ;; XEmacs change
 ;; 1. Check for correct number of @tab in line.
     (let ((tab-number 1))                       ; one @tab between two columns
       (while (search-forward "@tab" nil t)
-	(setq tab-number (1+ tab-number)))
+        (setq tab-number (1+ tab-number)))
       (if (/= tab-number (length table-widths))
-	  (error "Wrong number of @tab's in a @multitable row.")))
+          (error "Wrong number of @tab's in 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
     (while (not (eobp))
       (setq start (point))
       (setq end (save-excursion
-		  (if (search-forward "@tab" nil 'move)
-		      ;; Delete the @tab command, including the @-sign
-		      (delete-region
-		       (point)
-		       (progn (forward-word -1) (1- (point)))))
-		  (point)))
+                  (if (search-forward "@tab" nil 'move)
+                      ;; Delete the @tab command, including the @-sign
+                      (delete-region
+                       (point)
+                       (progn (forward-word -1) (1- (point)))))
+                  (point)))
       ;; Set fill-column *wider* than needed to produce inter-column space
       (setq fill-column (+ 1
-			   texinfo-extra-inter-column-width
-			   (nth table-column table-widths)))
+                           texinfo-extra-inter-column-width
+                           (nth table-column table-widths)))
       (narrow-to-region start end)
       ;; Remove whitespace before and after entry.
       (skip-chars-forward " ")
       (goto-char (point-max))
       (skip-chars-backward " ")
       (delete-region (point) (save-excursion (end-of-line) (point)))
-      ;; Temorarily set texinfo-stack to nil so texinfo-format-scan
+      ;; Temporarily set texinfo-stack to nil so texinfo-format-scan
       ;; does not see an unterminated @multitable.
       (let (texinfo-stack)                      ; nil
-	(texinfo-format-scan))
+        (texinfo-format-scan))
       (let (fill-prefix)                        ; no fill prefix
-	(fill-region (point-min) (point-max)))
+        (fill-region (point-min) (point-max)))
       (setq table-entry-height
-	    (max table-entry-height (count-lines (point-min) (point-max))))
+            (max table-entry-height (count-lines (point-min) (point-max))))
 ;; 3. Move point to end of bottom line, and pad that line to fill column.
       (goto-char (point-min))
       (forward-line (1- table-entry-height))
       (let* ((beg (point))                      ; beginning of line
-	     ;; add one more space for inter-column spacing
-	     (needed-whitespace
-	      (1+
-	       (- fill-column
-		  (-
-		   (progn (end-of-line) (point)) ; end of existing line
-		   beg)))))
-	(insert (make-string
-		 (if (> needed-whitespace 0) needed-whitespace 1)
-		 ? )))
+             ;; add one more space for inter-column spacing
+             (needed-whitespace
+              (1+
+               (- fill-column
+                  (-
+                   (progn (end-of-line) (point)) ; end of existing line
+                   beg)))))
+        (insert (make-string
+                 (if (> needed-whitespace 0) needed-whitespace 1)
+                 ? )))
       ;; now, put formatted cell into a rectangle
       (set (intern (concat texinfo-multitable-rectangle-name
-			   (int-to-string table-column)))
-	   (extract-rectangle (point-min) (point)))
+                           (int-to-string table-column)))
+           (extract-rectangle (point-min) (point)))
       (delete-region (point-min) (point))
       (goto-char (point-max))
       (setq table-column (1+ table-column))
       (widen))
 ;; 4. Add extra lines to rectangles so all are of same height
     (let ((total-number-of-columns table-column)
-	  (column-number 0)
-	  here)
+          (column-number 0)
+          here)
       (while (> table-column 0)
-	(let ((this-rectangle (int-to-string table-column)))
-	  (while (< (length this-rectangle) table-entry-height)
+        (let ((this-rectangle (int-to-string table-column)))
+          (while (< (length this-rectangle) table-entry-height)
             (setq this-rectangle (append this-rectangle '("")))))
-	(setq table-column (1- table-column)))
+        (setq table-column (1- table-column)))
 ;; 5. Insert formatted rectangles in original buffer
       (switch-to-buffer original-buffer)
       (open-line table-entry-height)
       (while (< column-number total-number-of-columns)
-	(setq here (point))
-	(insert-rectangle
-	 (eval (intern
-		(concat texinfo-multitable-rectangle-name
-			(int-to-string column-number)))))
-	(goto-char here)
-	(end-of-line)
-	(setq column-number (1+ column-number))))
+        (setq here (point))
+        (insert-rectangle
+         (eval (intern
+                (concat texinfo-multitable-rectangle-name
+                        (int-to-string column-number)))))
+        (goto-char here)
+        (end-of-line)
+        (setq column-number (1+ column-number))))
     (kill-buffer texinfo-multitable-buffer-name)
     (setq fill-column existing-fill-column)))
 
 
-;;; @ifinfo,  @iftex, @tex, @ifhtml, @html, @ifnottex
+;;; @image
+;;  Use only the FILENAME argument to the command.
+;;  In Info, ignore the other arguments.
+
+(put 'image 'texinfo-format 'texinfo-format-image)
+(defun texinfo-format-image ()
+  "Insert an image from an an file ending in .txt.
+Use only the FILENAME arg; for Info, ignore the other arguments to @image."
+  (let ((args (texinfo-format-parse-args))
+	filename)
+    (when (null (nth 0 args))
+      (error "Invalid image command"))
+    (texinfo-discard-command)
+    ;; makeinfo uses FILENAME.txt
+    (setq filename (format "%s.txt" (nth 0 args)))
+    (message "Reading included file: %s" filename)
+    ;; verbatim for Info output
+    (goto-char (+ (point) (cadr (insert-file-contents filename))))
+    (message "Reading included file: %s...done" filename)))
+
+
+;;; @ifinfo,  @iftex, @tex, @ifhtml, @html, @ifplaintext, @ifxml, @xml
+;;  @ifnottex, @ifnotinfo, @ifnothtml, @ifnotplaintext, @ifnotxml
 
 (put 'ifinfo 'texinfo-format 'texinfo-discard-line)
 (put 'ifinfo 'texinfo-end 'texinfo-discard-command)
 (put 'iftex 'texinfo-format 'texinfo-format-iftex)
 (defun texinfo-format-iftex ()
   (delete-region texinfo-command-start
-                 (progn (re-search-forward "@end iftex[ \t]*\n")
-                        (point))))
+                 (re-search-forward "@end iftex[ \t]*\n")))
 
 (put 'ifhtml 'texinfo-format 'texinfo-format-ifhtml)
 (defun texinfo-format-ifhtml ()
   (delete-region texinfo-command-start
-                 (progn (re-search-forward "@end ifhtml[ \t]*\n")
+                 (re-search-forward "@end ifhtml[ \t]*\n")))
+
+(put 'ifplaintext 'texinfo-format 'texinfo-format-ifplaintext)
+(defun texinfo-format-ifplaintext ()
+  (delete-region texinfo-command-start
+                 (re-search-forward "@end ifplaintext[ \t]*\n")))
+
+(put 'ifxml 'texinfo-format 'texinfo-format-ifxml)
+(defun texinfo-format-ifxml ()
+  (delete-region texinfo-command-start
+                 (progn (re-search-forward "^@end ifxml[ \t]*\n")
                         (point))))
 
 (put 'tex 'texinfo-format 'texinfo-format-tex)
 (defun texinfo-format-tex ()
   (delete-region texinfo-command-start
-                 (progn (re-search-forward "@end tex[ \t]*\n")
-                        (point))))
+                 (re-search-forward "@end tex[ \t]*\n")))
 
 (put 'html 'texinfo-format 'texinfo-format-html)
 (defun texinfo-format-html ()
   (delete-region texinfo-command-start
-                 (progn (re-search-forward "@end html[ \t]*\n")
+                 (re-search-forward "@end html[ \t]*\n")))
+
+(put 'xml 'texinfo-format 'texinfo-format-xml)
+(defun texinfo-format-xml ()
+  (delete-region texinfo-command-start
+                 (progn (re-search-forward "^@end xml[ \t]*\n")
                         (point))))
 
-;; XEmacs change.
-;; FSF 21.0 will include these changes.
+(put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo)
+(defun texinfo-format-ifnotinfo ()
+  (delete-region texinfo-command-start
+                 (re-search-forward "@end ifnotinfo[ \t]*\n")))
+
+(put 'ifnotplaintext 'texinfo-format 'texinfo-discard-line)
+(put 'ifnotplaintext 'texinfo-end 'texinfo-discard-command)
+
 (put 'ifnottex 'texinfo-format 'texinfo-discard-line)
 (put 'ifnottex 'texinfo-end 'texinfo-discard-command)
 
+(put 'ifnothtml 'texinfo-format 'texinfo-discard-line)
+(put 'ifnothtml 'texinfo-end 'texinfo-discard-command)
+
+(put 'ifnotxml 'texinfo-format 'texinfo-discard-line)
+(put 'ifnotxml 'texinfo-end 'texinfo-discard-command)
+
 
 ;;; @titlepage
 
 (put 'titlepage 'texinfo-format 'texinfo-format-titlepage)
 (defun texinfo-format-titlepage ()
   (delete-region texinfo-command-start
-                 (progn (re-search-forward "@end titlepage[ \t]*\n")
-                        (point))))
+                 (re-search-forward "@end titlepage[ \t]*\n")))
 
 (put 'endtitlepage 'texinfo-format 'texinfo-discard-line)
 
 (put 'titlespec 'texinfo-format 'texinfo-format-titlespec)
 (defun texinfo-format-titlespec ()
   (delete-region texinfo-command-start
-                 (progn (re-search-forward "@end titlespec[ \t]*\n")
-                        (point))))
+                 (re-search-forward "@end titlespec[ \t]*\n")))
 
 (put 'endtitlespec 'texinfo-format 'texinfo-discard-line)
 
 
 
 ;;; @timestamp{}
-;; Produce `Day Month Year Hour:Min' style of output.  
+;; Produce `Day Month Year Hour:Min' style of output.
 ;; eg `1 Jan 1900 13:52'
 
 (put 'timestamp 'texinfo-format 'texinfo-format-timestamp)
 (put 'ignore 'texinfo-format 'texinfo-format-ignore)
 (defun texinfo-format-ignore ()
   (delete-region texinfo-command-start
-                 (progn (re-search-forward "@end ignore[ \t]*\n")
-                        (point))))
+                 (re-search-forward "@end ignore[ \t]*\n")))
 
 (put 'endignore 'texinfo-format 'texinfo-discard-line)
 
 ;; command for Info, but not for TeX.  A command defined using
 ;; `@definfoenclose' marks text by enclosing it in strings that precede
 ;; and follow the text.
-;; 
+;;
 ;; Presumably, if you define a command with `@definfoenclose` for Info,
 ;; you will also define the same command in the TeX definitions file,
 ;; `texinfo.tex' in a manner appropriate for typesetting.
-;; 
+;;
 ;; Write a `@definfoenclose' command on a line and follow it with three
 ;; arguments separated by commas (commas are used as separators in an
 ;; `@node' line in the same way).  The first argument to
 ;; If you do a @definfoenclose{} on the name of a pre-defined macro (such
 ;; as @emph{}, @strong{}, @tt{}, or @i{}) the enclosure definition will
 ;; override the built-in definition.
-;; 
+;;
 ;; An enclosure command defined this way takes one argument in braces.
 ;;
 ;; For example, you can write:
 ;; before and `\\' after the argument to `@phoo'.  You can then write
 ;; `@phoo{bar}' wherever you want `//bar\\' highlighted in Info.
 ;;
-;; Also, for TeX formatting, you could write 
+;; Also, for TeX formatting, you could write
 ;;
 ;;     @iftex
 ;;     @global@let@phoo=@i
     (skip-chars-forward " ")
     (save-excursion (end-of-line) (setq texinfo-command-end (point)))
     (if (not (looking-at "\\([^=]+\\)=\\(.*\\)"))
-	(error "Invalid alias command")
+        (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)))
+	      (match-string-no-properties 1)
+	      (match-string-no-properties 2))
 	     texinfo-alias-list))
       (texinfo-discard-command))
     )
   (insert "\"" (texinfo-parse-arg-discard) "\"")
   (goto-char texinfo-command-start))
 
-(put 'email 'texinfo-format 'texinfo-format-key)
+(put 'email 'texinfo-format 'texinfo-format-email)
+(defun texinfo-format-email ()
+  "Format email address and optional following full name.
+Insert full name, if present, followed by email address
+surrounded by in angle brackets."
+  (let ((args (texinfo-format-parse-args)))
+    (texinfo-discard-command)
+    ;; if full-name
+    (if (nth 1 args)
+        (insert  (nth 1 args) " "))
+    (insert "<" (nth 0 args) ">")))
+
 (put 'key 'texinfo-format 'texinfo-format-key)
 ;; I've decided not want to have angle brackets around these -- rms.
 (defun texinfo-format-key ()
   (insert (texinfo-parse-arg-discard))
   (goto-char texinfo-command-start))
 
+;; @verb{<char>TEXT<char>} (in `makeinfo' 4.1 and later)
+(put 'verb 'texinfo-format 'texinfo-format-verb)
+(defun texinfo-format-verb ()
+  "Format text between non-quoted unique delimiter characters verbatim.
+Enclose the verbatim text, including the delimiters, in braces.  Print
+text exactly as written (but not the delimiters) in a fixed-width.
+
+For example, @verb\{|@|\} results in @ and
+@verb\{+@'e?`!`+} results in @'e?`!`."
+
+  (let ((delimiter (buffer-substring-no-properties
+		    (1+ texinfo-command-end) (+ 2 texinfo-command-end))))
+    (unless (looking-at "{")
+      (error "Not found: @verb start brace"))
+    (delete-region texinfo-command-start (+ 2 texinfo-command-end))
+    (search-forward  delimiter))
+  (delete-backward-char 1)
+  (unless (looking-at "}")
+    (error "Not found: @verb end brace"))
+  (delete-char 1))
+
+;; as of 2002 Dec 10
+;; see (texinfo)Block Enclosing Commands
+;; need: @verbatim
+
+;; as of 2002 Dec 10
+;; see (texinfo)verbatiminclude
+;; need: @verbatiminclude FILENAME
+
 (put 'bullet 'texinfo-format 'texinfo-format-bullet)
 (defun texinfo-format-bullet ()
   "Insert an asterisk.
 
 ;;; @kbd
 
-;; Inside of @example ... @end example and similar environments, 
+;; Inside of @example ... @end example and similar environments,
 ;; @kbd does nothing; but outside of such environments, it places
-;; single quotation markes around its argument.
+;; single quotation marks around its argument.
 
 (defvar texinfo-format-kbd-regexp
   (concat
    "^@"
    "\\("
+   "display\\|"
    "example\\|"
    "smallexample\\|"
    "lisp\\|"
   (concat
    "^@end "
    "\\("
+   "display\\|"
    "example\\|"
    "smallexample\\|"
    "lisp\\|"
   "Place single quote marks around arg, except in @example and similar."
   ;; Search forward for @end example closer than an @example.
   ;; Can stop search at nearest @node or texinfo-section-types-regexp
-  (let* ((stop 
-	  (save-excursion
-	    (re-search-forward
-	     (concat "^@node\\|\\(" texinfo-section-types-regexp "\\)")
-	     nil
-	     'move-to-end)    ; if necessary, return point at end of buffer
-	    (point)))
-	 (example-location
-	  (save-excursion
-	    (re-search-forward texinfo-format-kbd-regexp stop 'move-to-end)
-	    (point)))
-	 (end-example-location
-	  (save-excursion
-	    (re-search-forward texinfo-format-kbd-end-regexp stop 'move-to-end)
-	    (point))))
+  (let* ((stop
+          (save-excursion
+            (re-search-forward
+             (concat "^@node\\|\\(" texinfo-section-types-regexp "\\)")
+             nil
+             'move-to-end)    ; if necessary, return point at end of buffer
+            (point)))
+         (example-location
+          (save-excursion
+            (re-search-forward texinfo-format-kbd-regexp stop 'move-to-end)
+            (point)))
+         (end-example-location
+          (save-excursion
+            (re-search-forward texinfo-format-kbd-end-regexp stop 'move-to-end)
+            (point))))
     ;; If inside @example, @end example will be closer than @example
     ;; or end of search i.e., end-example-location less than example-location
     (if (>= end-example-location example-location)
-	;; outside an @example or equivalent
-	(insert "`" (texinfo-parse-arg-discard) "'")
+        ;; outside an @example or equivalent
+        (insert "`" (texinfo-parse-arg-discard) "'")
       ;; else, in @example; do not surround with `...'
       (insert (texinfo-parse-arg-discard)))
     (goto-char texinfo-command-start)))
 (defun texinfo-format-dircategory ()
   (let ((str (texinfo-parse-arg-discard)))
     (delete-region (point)
-		   (progn
-		     (skip-chars-forward " ")
-		     (point)))
+                   (progn
+                     (skip-chars-forward " ")
+                     (point)))
     (insert "INFO-DIR-SECTION " str "\n")))
 
-;;; @cartouche 
+;;; @cartouche
 
 ;; The @cartouche command is a noop in Info; in a printed manual,
 ;; it makes a box with rounded corners.
       (make-string
        (- fill-column
           (save-excursion
-            (end-of-line) 
+            (end-of-line)
             (skip-chars-backward " \t")
             (delete-region (point) (progn (end-of-line) (point)))
-            (current-column)))  
+            (current-column)))
        ? )))))
 
 
 ;;; Refilling and indenting:  @refill, @paragraphindent, @noindent
 
 ;;; Indent only those paragraphs that are refilled as a result of an
-;;; @refill command.  
+;;; @refill command.
 
 ;;    * If the value is `asis', do not change the existing indentation at
 ;;      the starts of paragraphs.
 Default is to leave paragraph indentation as is."
   (texinfo-discard-command)
   (let ((position (point-marker)))
-    (forward-paragraph -1)     
+    (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 
+    (cond
      ;; delete a @noindent line and do not indent paragraph
      ((save-excursion (forward-line -1)
-		      (looking-at "^@noindent")) 
+		      (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))   
+     ((> texinfo-stack-depth 0))
      ;; otherwise delete existing whitespace and indent
-     (t 
+     (t
       (delete-region (point) (progn (skip-chars-forward " \t") (point)))
       (insert (make-string texinfo-paragraph-indent ? ))))
-    (forward-paragraph 1) 
+    (forward-paragraph 1)
     (forward-line -1)
     (end-of-line)
     ;; Do not fill a section title line with asterisks, hyphens, etc. that
 	   (paragraph-separate
 	    (concat paragraph-separate "\\|[-=.]+\\|\\*\\*+"))
 	   (previous-paragraph-start 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)))
+          (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 ()  
-  (save-excursion 
+(defun texinfo-noindent ()
+  (save-excursion
     (forward-paragraph 1)
     (if (search-backward "@refill"
                             (save-excursion (forward-line -1) (point)) t)
 
     (fset index-formatting-command
           (list 'lambda 'nil
-                (list 'texinfo-index 
+                (list 'texinfo-index
                       (list 'quote index-alist-name))))))
 
 
   (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 (point) (save-excursion (end-of-line) (point)))))
+  (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) (length line)))))
+                         (substring line (match-end 0)))))
     line))
 
 
 
 ;; See the `texinfo-accent-commands' variable
 ;; in the section for `texinfo-append-refill'.
-;; Also, see the defun for `texinfo-format-scan' 
+;; Also, see the defun for `texinfo-format-scan'
 ;; for single-character accent commands.
 
 ;; Command           Info output         Name
 
 ;; Note: The  defun texinfo-format-scan
 ;; looks at "[@{}^'`\",=~ *?!-]"
-;; In the case of @*, a line break is inserted; 
+;; In the case of @*, a line break is inserted;
 ;; in the other cases, the characters are simply quoted and the @ is deleted.
 ;; Thus, `texinfo-format-scan' handles the following
 ;; single-character accent commands: @^ @` @' @" @, @- @= @~
 ;; (defun texinfo-format-circumflex-accent ()
 ;;   (texinfo-discard-command)
 ;;   (insert "^"))
-;; 
+;;
 ;; @`              ==>    `         grave accent
 ;; (put '\` 'texinfo-format 'texinfo-format-grave-accent)
 ;; (defun texinfo-format-grave-accent ()
 ;;   (texinfo-discard-command)
 ;;   (insert "\`"))
-;; 
+;;
 ;; @'              ==>    '         acute accent
 ;; (put '\' 'texinfo-format 'texinfo-format-acute-accent)
 ;; (defun texinfo-format-acute-accent ()
 ;;   (texinfo-discard-command)
 ;;   (insert "'"))
-;; 
+;;
 ;; @"              ==>    "         umlaut accent
 ;; (put '\" 'texinfo-format 'texinfo-format-umlaut-accent)
 ;; (defun texinfo-format-umlaut-accent ()
 ;; (defun texinfo-format-overbar-accent ()
 ;;   (texinfo-discard-command)
 ;;   (insert "="))
-;; 
+;;
 ;; @~              ==>    ~         tilde accent
 ;; (put '~ 'texinfo-format 'texinfo-format-tilde-accent)
 ;; (defun texinfo-format-tilde-accent ()
 ;;     In Info, `Category: name ARGS'
 ;;     In index: name:  node. line#.
 ;;
-;; @defvr category name 
+;; @defvr category name
 ;;     In Info, `Category: name'
 ;;     In index: name:  node. line#.
 ;;
 ;; Generalized typed-function-like or typed-variable-like entity:
 ;; @deftypefn category data-type name args...
 ;;     In Info, `Category:  data-type name args...'
-;; @deftypevr category data-type name 
+;; @deftypevr category data-type name
 ;;     In Info, `Category:  data-type name'
 ;;     In index: name:  node. line#.
 ;;
 ;; Specialized typed-function-like or typed-variable-like entity:
 ;; @deftypefun data-type name args...
 ;;     In Info, `Function:  data-type name ARGS'
-;;     In index: name:  node. line#.   
+;;     In index: name:  node. line#.
 ;;
-;; @deftypevar data-type name 
+;; @deftypevar data-type name
 ;;     In Info, `Variable:  data-type name'
 ;;     In index: name:  node. line#.   but include args after name!?
 ;;
-;; Generalized object oriented entity: 
+;; Generalized object oriented entity:
 ;; @defop category class name args...
 ;;     In Info, `Category on class: name ARG'
 ;;     In index: name on class: node. line#.
 ;;
-;; @defcv category class name         
+;; @defcv category class name
 ;;     In Info, `Category of class: name'
 ;;     In index: name of class: node. line#.
 ;;
 ;; Specialized object oriented entity:
-;; @defmethod class name args... 
+;; @defmethod class name args...
 ;;     In Info, `Method on class: name ARGS'
 ;;     In index: name on class: node. line#.
 ;;
   ;; Generalized typed-function-like or typed-variable-like entity:
   ;; @deftypefn category data-type name args...
   ;;     In Info, `Category:  data-type name args...'
-  ;; @deftypevr category data-type name 
+  ;; @deftypevr category data-type name
   ;;     In Info, `Category:  data-type name'
   ;; Note: args in lower case, unless modified in command line.
   (let ((category (car parsed-args))
   ;; Specialized typed-function-like or typed-variable-like entity:
   ;; @deftypefun data-type name args...
   ;;     In Info, `Function:  data-type name ARGS'
-  ;; @deftypevar data-type name 
+  ;; @deftypevar data-type name
   ;;     In Info, `Variable:  data-type name'
   ;; Note: args in lower case, unless modified in command line.
   ;; Use cdr of texinfo-defun-type to determine category:
 (put 'defop 'texinfo-deffn-formatting-property 'texinfo-format-defop)
 (put 'defopx 'texinfo-deffn-formatting-property 'texinfo-format-defop)
 (defun texinfo-format-defop (parsed-args)
-  ;; Generalized object oriented entity: 
+  ;; Generalized object oriented entity:
   ;; @defop category class name args...
   ;;     In Info, `Category on class: name ARG'
   ;; Note: args in upper case; use of `on'
 (put 'defcv 'texinfo-deffn-formatting-property 'texinfo-format-defcv)
 (put 'defcvx 'texinfo-deffn-formatting-property 'texinfo-format-defcv)
 (defun texinfo-format-defcv (parsed-args)
-  ;; Generalized object oriented entity: 
-  ;; @defcv category class name         
+  ;; Generalized object oriented entity:
+  ;; @defcv category class name
   ;;     In Info, `Category of class: name'
   ;; Note: args in upper case; use of `of'
   (let ((category (car parsed-args))
 (put 'defmethodx 'texinfo-deffn-formatting-property 'texinfo-format-defmethod)
 (defun texinfo-format-defmethod (parsed-args)
   ;; Specialized object oriented entity:
-  ;; @defmethod class name args... 
+  ;; @defmethod class name args...
   ;;     In Info, `Method on class: name ARGS'
   ;; Note: args in upper case; use of `on'
   ;; Use cdr of texinfo-defun-type to determine category:
 ;; line number.  Depending on the which command is used, the entry is
 ;; formatted differently:
 ;;
-;; @defun, 
-;; @defmac, 
-;; @defspec, 
-;; @defvar, 
-;; @defopt          all use their 1st argument as the entry-proper 
+;; @defun,
+;; @defmac,
+;; @defspec,
+;; @defvar,
+;; @defopt          all use their 1st argument as the entry-proper
 ;;
-;; @deffn, 
-;; @defvr, 
-;; @deftp 
+;; @deffn,
+;; @defvr,
+;; @deftp
 ;; @deftypefun
 ;; @deftypevar      all use their 2nd argument as the entry-proper
 ;;
-;; @deftypefn, 
-;; @deftypevr       both use their 3rd argument as the entry-proper  
+;; @deftypefn,
+;; @deftypevr       both use their 3rd argument as the entry-proper
 ;;
-;; @defmethod       uses its 2nd and 1st arguments as an entry-proper 
+;; @defmethod       uses its 2nd and 1st arguments as an entry-proper
 ;;                    formatted: NAME on CLASS
 
-;; @defop           uses its 3rd and 2nd arguments as an entry-proper 
+;; @defop           uses its 3rd and 2nd arguments as an entry-proper
 ;;                    formatted: NAME on CLASS
-;;        
+;;
 ;; @defivar         uses its 2nd and 1st arguments as an entry-proper
 ;;                    formatted: NAME of CLASS
 ;;
   ;; `index-list' will be texinfo-findex or the like
   (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
     (set index-list
-         (cons 
+         (cons
           ;; Three elements: entry-proper, node-name, line-number
           (list
            (car parsed-args)
 (put 'deftypefunx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
 (put 'deftypevar 'texinfo-defun-indexing-property 'texinfo-index-deffn)
 (put 'deftypevarx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
-(defun texinfo-index-deffn (parsed-args) 
+(defun texinfo-index-deffn (parsed-args)
  ;; use 2nd parsed-arg  as entry-proper
   ;; `index-list' will be texinfo-findex or the like
   (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
     (set index-list
-         (cons 
+         (cons