Commits

Anonymous committed e4e83eb

Misc. fixes

Comments (0)

Files changed (4)

+1998-07-01  Adrian Aichner  <aichner@ecf.teradyne.com>
+
+	* texinfmt.el (texinfo-format-region): Removing trailing WS as
+	first step in Info file generation.  No support for makeinfo-like
+	"asis". 
+	(texinfo-format-buffer-1): Ditto.  
+	(texinfo-format-convert): Converting three hyphens to two at end
+	of line too.
+
+	* informat.el (Info-validate): RE-quoting search for "* Menu".
+	Match of "\n\\* Menu;$" ends previous menu and starts new one.
+	Improved matching for : and :: menu items.  Adding support for
+	xrefs crossing line boundaries by using multi-line argument in
+	(Info-extract-menu-node-name STR t).  Reversing lossages before
+	printing.  Adding info file name and line number to lossage
+	information.  Using compilation-minor-mode for lossages buffer.
+	(Info-validate-node-name): Canonicalizing WS in node names to
+	avoid unnecessary lossages.  Upgrading lossages list to provide
+	filename and line number information to support compilation minor
+	mode.  
+	(Info-file-data): New function returning string including file
+	name and line number.
+
 1998-06-10  Adrian Aichner  <aichner@ecf.teradyne.com>
 
 	* texinfmt.el: Added `texinfo-format-uref'.  Matching only files
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-VERSION = 1.08
+VERSION = 1.09
 AUTHOR_VERSION =
 MAINTAINER = XEmacs Development Team <xemacs-beta@xemacs.org>
 PACKAGE = texinfo
 		  (end-of-line)
 		  (if (search-backward "up:" nil t)
 		      (Info-validate-node-name "invalid Up"))
-		  (if (re-search-forward "\n* Menu:" nil t)
-		      (while (re-search-forward "\n\\* " nil t)
-			(Info-validate-node-name
-			  (concat "invalid menu item "
-				  (buffer-substring (point)
-						    (save-excursion
-						      (skip-chars-forward "^:")
-						      (point))))
-			  (Info-extract-menu-node-name))))
+		  (if (re-search-forward "\n\\* Menu:" nil t)
+		      (catch 'next-menu
+			(while (re-search-forward "\n\\* " nil t)
+			  (save-excursion
+			    (if (looking-at "Menu:$")
+				(throw 'next-menu nil)))
+			  (Info-validate-node-name
+			   (concat "invalid menu item "
+				   (save-excursion
+				     (re-search-forward
+				      "\\(.+[^:]\\)::?[^:]*$" nil t)
+				     (match-string 1)))
+			   (Info-extract-menu-node-name)))))
 		  (goto-char (point-min))
 		  (while (re-search-forward "\\*note[ \n]*[^:\t]*:" nil t)
 		    (goto-char (+ (match-beginning 0) 5))
 					       (save-excursion
 						 (skip-chars-forward "^:")
 						 (point))))
-		     (Info-extract-menu-node-name "Bad format cross-reference")))))))
+		     (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)))
 		(princ "In node \"")
-		(princ (car (car lossages)))
+		(princ (nth 1 (car lossages)))
 		(princ "\", ")
-		(let ((tem (nth 1 (car lossages))))
+		(let ((tem (nth 2 (car lossages))))
 		  (cond ((string-match "\n" tem)
 			 (princ (substring tem 0 (match-beginning 0)))
 			 (princ "..."))
 			(t
 			 (princ tem))))
-		(if (nth 2 (car lossages))
+		(if (nth 3 (car lossages))
 		    (progn
 		      (princ ": ")
-		      (let ((tem (nth 2 (car lossages))))
+		      (let ((tem (nth 3 (car lossages))))
 			(cond ((string-match "\n" tem)
 			       (princ (substring tem 0 (match-beginning 0)))
 			       (princ "..."))
 			       (princ tem))))))
 		(terpri)
 		(setq lossages (cdr lossages)))
+	      (save-excursion
+		(set-buffer " *problems in info file*")
+		(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.
 	      (point))))))
   (if (null name)
       nil
+    (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 thisnode kind name) lossages))))
+	      (cons (list (Info-file-data) thisnode kind name) lossages))))
   name)
 
 (defun Info-validate-tags-table ()
 	    (error (message ">> Error: %s" (prin1-to-string err))))))
       (kill-emacs error))))
 
+(defun Info-file-data ()
+  (save-excursion
+    (save-restriction
+      (widen)
+      (beginning-of-line)
+      (format "%s:%d:"
+	      (buffer-file-name)
+	      (1+ (count-lines 1 (point)))))))
+
 ;;; informat.el ends here
         (insert "\n"))
     
     (goto-char (point-min))
+    ;; Remove trailing WS like makeinfo does
+    ;; Adrian Aichner
+;;;    (unless (equal texinfo-paragraph-indent "asis")
+    (save-excursion
+      (message "Removing trailing whitespace from Info region...")
+      (while (re-search-forward "[ \t]+$" nil t)
+	(replace-match "" nil nil)))
+;;;      )
     (texinfo-mode)
     (message "Converting region to Info format...")
     (setq fill-column fill-column-for-info)
     ;; work on them without losing track of multiple
     ;; @raise/@lowersections commands. 
     (goto-char (point-min))
+    ;; Remove trailing WS like makeinfo does
+    ;; Adrian Aichner
+;;;    (unless (equal texinfo-paragraph-indent "asis")
+    (save-excursion
+      (message "Removing trailing whitespace from Info buffer...")
+      (while (re-search-forward "[ \t]+$" nil t)
+	(replace-match "" nil nil)))
+;;;      )
     (while (re-search-forward "^@include" nil t)
       (setq texinfo-command-end (point))
       (let ((filename (concat input-directory
     (replace-match "\""))
   ;; Convert three hyphens in a row to two.
   (goto-char min)
-  (while (re-search-forward "\\( \\|\\w\\)\\(---\\)\\( \\|\\w\\)" max t)
+  (while (re-search-forward "\\( \\|\\w\\)\\(---\\)\\( \\|\\w\\|\n\\)" max t)
     (delete-region (1+ (match-beginning 2)) (+ 2 (match-beginning
     2)))))