(install): Don't check for the file names.
[elisp/gnus.git-] / lisp / ptexinfmt.el
index 4209158..036c97b 100644 (file)
 (provide 'ptexinfmt)
 
 ;;; Broken
-(defvar ptexinfmt-disable-broken-notice t
-  "If non-nil disable notice, when call `broken-facility'.")
+(defvar ptexinfmt-disable-broken-notice-flag t
+  "If non-nil disable notice, when call `broken-facility'.
+This is NO-NOTICE argument in `broken-facility'.")
+
+;; sort -fd
+(broken-facility texinfo-format-printindex
+  "Can't sort on Mule for Windows."
+  (if (and (memq system-type '(windows-nt ms-dos))
+;;; I don't know version threshold. 
+;;;       (string< texinfmt-version "2.37 of 24 May 1997")
+          (boundp 'MULE) (not (featurep 'meadow))) ; Mule for Windows
+      nil
+    t)
+  ptexinfmt-disable-broken-notice-flag)
 
 ;; @var
 (broken-facility texinfo-format-var
-  "Don't perse @COMMAND included @var"
+  "Don't perse @var argument."
   (condition-case nil
       (with-temp-buffer
        (let (texinfo-enclosure-list texinfo-alias-list)
          (texinfo-format-expand-region (point-min) (point-max))
          t))
     (error nil))
-  ptexinfmt-disable-broken-notice)
+  ptexinfmt-disable-broken-notice-flag)
 
 ;; @xref
 (broken-facility texinfo-format-xref
-  "Can't format 1st argument empty @xref."
+  "Can't format @xref, 1st argument is empty."
   (condition-case nil
       (with-temp-buffer
        (let (texinfo-enclosure-list texinfo-alias-list)
          (texinfo-format-expand-region (point-min) (point-max))
          t))
     (error nil))
-  ptexinfmt-disable-broken-notice)
+  ptexinfmt-disable-broken-notice-flag)
 
 ;; @uref
 (broken-facility texinfo-format-uref
-  "Parse 2 times @uref argument."
+  "Parse twice @uref argument."
   (condition-case nil
       (with-temp-buffer
        (let (texinfo-enclosure-list texinfo-alias-list)
          (texinfo-format-expand-region (point-min) (point-max))
          t))
     (error nil))
-  ptexinfmt-disable-broken-notice)
+  ptexinfmt-disable-broken-notice-flag)
+
+;; @multitable
+(broken-facility texinfo-multitable-widths
+  "`texinfo-multitable-widths' unsupport wide-char."
+  (if (fboundp 'texinfo-multitable-widths)
+      (with-temp-buffer
+       (let ((str "\e$BI}9-J8;z\e(B"))
+         (texinfo-mode)
+         (insert (format " {%s}\n" str))
+         (goto-char (point-min))
+         (if (= (car (texinfo-multitable-widths)) (length str))
+             nil
+           t)))
+    ;; function definition is void
+    t)
+  ptexinfmt-disable-broken-notice-flag)
+
+(broken-facility texinfo-multitable-item
+  "`texinfo-multitable-item' unsupport wide-char."
+  (if-broken texinfo-multitable-widths nil t)
+  ptexinfmt-disable-broken-notice-flag)
+
 
 ;;; Obsolete
 ;; Removed Texinfo 3.8
 (defun-maybe 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-maybe texinfo-end-direntry ()
@@ -505,6 +539,9 @@ otherwise, insert URL-TITLE followed by URL in parentheses."
   (texinfo-discard-command)
   (texinfo-pop-stack 'multitable))
 
+(when-broken texinfo-multitable-widths
+  (fmakunbound 'texinfo-multitable-widths))
+
 (defun-maybe texinfo-multitable-widths ()
   "Return list of widths of each column in a multi-column table."
   (let (texinfo-multitable-width-list)
@@ -558,7 +595,7 @@ otherwise, insert URL-TITLE followed by URL in parentheses."
      ;; Case 3: Trouble
      (t
       (error
-       "You probably need to specify column widths for @multitable correctly.")))
+       "You probably need to specify column widths for @multitable correctly")))
     ;; Check whether columns fit on page.
     (let ((desired-columns
            (+
@@ -593,6 +630,9 @@ Cells within rows are separated by @tab."
     (delete-region texinfo-command-start end)
     row))
 
+(when-broken texinfo-multitable-item
+  (fmakunbound 'texinfo-multitable-item))
+
 (put 'multitable 'texinfo-item 'texinfo-multitable-item)
 (defun-maybe texinfo-multitable-item ()
   "Format a row within a multicolumn table.
@@ -620,7 +660,7 @@ This command is executed when texinfmt sees @item inside @multitable."
       (while (search-forward "@tab" nil t)
         (setq tab-number (1+ tab-number)))
       (if (/= tab-number (length table-widths))
-          (error "Wrong number of @tab's in a @multitable row.")))
+          (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
@@ -699,4 +739,21 @@ This command is executed when texinfmt sees @item inside @multitable."
     (kill-buffer texinfo-multitable-buffer-name)
     (setq fill-column existing-fill-column)))
 
+\f
+(when-broken texinfo-format-printindex
+  (fmakunbound 'texinfo-format-printindex))
+
+(defun-maybe texinfo-format-printindex ()
+  (let ((indexelts (symbol-value
+                    (cdr (assoc (texinfo-parse-arg-discard)
+                                texinfo-indexvar-alist))))
+        opoint)
+    (insert "\n* Menu:\n\n")
+    (setq opoint (point))
+    (texinfo-print-index nil indexelts)
+
+    (if (memq system-type '(vax-vms windows-nt ms-dos))
+        (texinfo-sort-region opoint (point))
+      (shell-command-on-region opoint (point) "sort -fd" 1))))
+
 ;;; ptexinfmt.el ends here