* WL-ELS (ELMO-MODULES): Added elsp-spamoracle.
[elisp/wanderlust.git] / utils / ptexinfmt.el
index 82acb4f..edc4255 100644 (file)
 
 ;; Modified by Yamaoka not to use APEL functions.
 
+;; Unimplemented command:
+;;  @abbr
+;;  @float, @caption, @shortcaption, @listoffloats
+;;  @deftypecv[x]
+;;  @headitem
+;;  @comma{}
+;;  @quotation (optional arguments)
+;;  @acronym (optional argument)
+;;  @dofirstparagraphindent
+;;  @indent
+;;  @verbatiminclude
+;;  @\
+;;  @definfoenclose
+;;  @deftypeivar
+;;  @deftypeop
+
 ;;; Code:
 
 (require 'backquote)
 ;;; Broken
 (defvar ptexinfmt-disable-broken-notice-flag t
   "If non-nil disable notice, when call `ptexinfmt-broken-facility'.
-This is NO-NOTICE argument in `ptexinfmt-broken-facility'.")
+This is last argument in `ptexinfmt-broken-facility'.")
 
 (put 'ptexinfmt-broken-facility 'lisp-indent-function 'defun)
 (defmacro ptexinfmt-broken-facility (facility docstring assertion
-                                             &optional no-notice)
+                                             &optional dummy)
   "Declare a symbol FACILITY is broken if ASSERTION is nil.
-DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
+DOCSTRING will be printed if ASSERTION is nil and
+`ptexinfmt-disable-broken-notice-flag' is nil."
   (` (let ((facility '(, facility))
           (docstring (, docstring))
           (assertion (eval '(, assertion))))
@@ -58,7 +75,7 @@ DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
        (if assertion
           nil
         (put facility 'broken-docstring docstring)
-        (if (, no-notice)
+        (if ptexinfmt-disable-broken-notice-flag
             nil
           (message "BROKEN FACILITY DETECTED: %s" docstring))))))
 
@@ -104,8 +121,7 @@ DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
 ;;;       (string< texinfmt-version "2.37 of 24 May 1997")
           (boundp 'MULE) (not (featurep 'meadow))) ; Mule for Windows
       nil
-    t)
-  ptexinfmt-disable-broken-notice-flag)
+    t))
 
 ;; @var
 (ptexinfmt-broken-facility texinfo-format-var
@@ -117,8 +133,7 @@ DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
          (insert "@var{@asis{foo}}\n")
          (texinfo-format-expand-region (point-min) (point-max))
          t))
-    (error nil))
-  ptexinfmt-disable-broken-notice-flag)
+    (error nil)))
 
 ;; @xref
 (ptexinfmt-broken-facility texinfo-format-xref
@@ -130,8 +145,7 @@ DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
          (insert "@xref{, xref, , file}\n")
          (texinfo-format-expand-region (point-min) (point-max))
          t))
-    (error nil))
-  ptexinfmt-disable-broken-notice-flag)
+    (error nil)))
 
 ;; @uref
 (ptexinfmt-broken-facility texinfo-format-uref
@@ -140,11 +154,10 @@ DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
       (with-temp-buffer
        (let (texinfo-enclosure-list texinfo-alias-list)
          (texinfo-mode)
-         (insert "@uref{mailto:foo@@bar.com}\n")
+         (insert "@uref{mailto:foo@@noncommand.example.com}\n")
          (texinfo-format-expand-region (point-min) (point-max))
          t))
-    (error nil))
-  ptexinfmt-disable-broken-notice-flag)
+    (error nil)))
 
 ;; @multitable
 (ptexinfmt-broken-facility texinfo-multitable-widths
@@ -159,13 +172,11 @@ DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
              nil
            t)))
     ;; function definition is void
-    t)
-  ptexinfmt-disable-broken-notice-flag)
+    t))
 
 (ptexinfmt-broken-facility texinfo-multitable-item
   "`texinfo-multitable-item' unsupport wide-char."
-  (not (get 'texinfo-multitable-widths 'broken))
-  ptexinfmt-disable-broken-notice-flag)
+  (not (get 'texinfo-multitable-widths 'broken)))
 
 
 ;;; Hardcopy and HTML (discard)
@@ -205,6 +216,14 @@ DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
 (put 'page 'texinfo-format 'texinfo-discard-line)
 (put 'hyphenation 'texinfo-format 'texinfo-discard-command-and-arg)
 
+;; @slanted{} (makeinfo 4.8 or later)
+(put 'slanted 'texinfo-format 'texinfo-format-noop)
+
+;; @tie{} (makeinfo 4.3 or later)
+(put 'tie 'texinfo-format 'texinfo-format-tie)
+(ptexinfmt-defun-if-void texinfo-format-tie ()
+  (texinfo-parse-arg-discard)
+  (insert " "))
 
 \f
 ;;; Directory File
@@ -263,6 +282,10 @@ DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
 (put 'ifnotplaintext 'texinfo-format 'texinfo-discard-line)
 (put 'ifnotplaintext 'texinfo-end 'texinfo-discard-command)
 
+;; @ifnotdocbook ... @end ifnotdocbook (makeinfo 4.7 or later)
+(put 'ifnotdocbook 'texinfo-format 'texinfo-discard-line)
+(put 'ifnotdocbook 'texinfo-end 'texinfo-discard-command)
+
 
 ;; @ifnotinfo ... @end ifnotinfo (makeinfo 3.11 or later)
 (put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo)
@@ -278,6 +301,13 @@ DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
                 (progn (re-search-forward "@end html[ \t]*\n")
                        (point))))
 
+;; @docbook ... @end docbook (makeinfo 4.7 or later)
+(put 'docbook 'texinfo-format 'texinfo-format-docbook)
+(ptexinfmt-defun-if-void texinfo-format-docbook ()
+  (delete-region texinfo-command-start
+                (progn (re-search-forward "@end docbook[ \t]*\n")
+                       (point))))
+
 ;; @ifhtml ... @end ifhtml (makeinfo 3.8 or later)
 (put 'ifhtml 'texinfo-format 'texinfo-format-ifhtml)
 (defun texinfo-format-ifhtml ()
@@ -292,14 +322,23 @@ DOCSTRING will be printed if ASSERTION is nil and NO-NOTICE is nil."
                 (progn (re-search-forward "@end ifplaintext[ \t]*\n")
                        (point))))
 
+;; @ifdocbook ... @end ifdocbook (makeinfo 4.7 or later)
+(put 'ifdocbook 'texinfo-format 'texinfo-format-ifdocbook)
+(ptexinfmt-defun-if-void texinfo-format-ifdocbook ()
+  (delete-region texinfo-command-start
+                (progn (re-search-forward "@end ifdocbook[ \t]*\n")
+                       (point))))
+
 
 \f
 ;;; Marking
-;; @url, @env, @command
-(put 'url 'texinfo-format 'texinfo-format-code)
+;; @indicateurl, @url, @env, @command, 
 (put 'env 'texinfo-format 'texinfo-format-code)
 (put 'command 'texinfo-format 'texinfo-format-code)
 
+(put 'indicateurl 'texinfo-format 'texinfo-format-code)
+(put 'url 'texinfo-format 'texinfo-format-uref)        ; Texinfo 4.7
+
 ;; @acronym
 (put 'acronym 'texinfo-format 'texinfo-format-var)
 
@@ -328,7 +367,7 @@ Insert < ... > around EMAIL-ADDRESS."
 
 ;; @option
 (put 'option 'texinfo-format 'texinfo-format-option)
-(defun texinfo-format-option ()
+(ptexinfmt-defun-if-void 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
   ;; searched-for character is a control-H
@@ -339,8 +378,39 @@ Insert < ... > around EMAIL-ADDRESS."
     (insert (texinfo-parse-arg-discard)))
   (goto-char texinfo-command-start))
 
+;; @verb{<char>TEXT<char>}  (makeinfo 4.1 or later)
+(put 'verb 'texinfo-format 'texinfo-format-verb)
+(ptexinfmt-defun-if-void 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))
 
 \f
+;;; @LaTeX, @registeredsymbol{}
+(put 'LaTeX 'texinfo-format 'texinfo-format-LaTeX)
+(ptexinfmt-defun-if-void texinfo-format-LaTeX ()
+  (texinfo-parse-arg-discard)
+  (insert "LaTeX"))
+
+(put 'registeredsymbol 'texinfo-format 'texinfo-format-registeredsymbol)
+(ptexinfmt-defun-if-void texinfo-format-registeredsymbol ()
+  (texinfo-parse-arg-discard)
+  (insert "(R)"))
+
 ;;; Accents and Special characters
 ;; @pounds{}   ==>     #       Pounds Sterling
 (put 'pounds 'texinfo-format 'texinfo-format-pounds)
@@ -348,6 +418,18 @@ Insert < ... > around EMAIL-ADDRESS."
   (texinfo-parse-arg-discard)
   (insert "#"))
 
+;; @ordf{}     ==>     a       Spanish feminine
+(put 'ordf 'texinfo-format 'texinfo-format-ordf)
+(ptexinfmt-defun-if-void texinfo-format-ordf ()
+  (texinfo-parse-arg-discard)
+  (insert "o"))
+
+;; @ordm{}     ==>     o       Spanish masculine
+(put 'ordm 'texinfo-format 'texinfo-format-ordm)
+(ptexinfmt-defun-if-void texinfo-format-ordm ()
+  (texinfo-parse-arg-discard)
+  (insert "o"))
+
 ;; @OE{}       ==>     OE      French-OE-ligature
 (put 'OE 'texinfo-format 'texinfo-format-French-OE-ligature)
 (ptexinfmt-defun-if-void texinfo-format-French-OE-ligature ()
@@ -503,6 +585,11 @@ Insert < ... > around EMAIL-ADDRESS."
 (ptexinfmt-defun-if-void texinfo-format-soft-hyphen ()
   (texinfo-discard-command))
 
+;; @/
+(put '\/ 'texinfo-format 'texinfo-format-\/)
+(ptexinfmt-defun-if-void texinfo-format-\/ ()
+  (texinfo-discard-command))
+
 \f
 ;;; Cross References
 ;; @ref, @xref
@@ -521,7 +608,7 @@ Insert < ... > around EMAIL-ADDRESS."
        (unless (null (nth 0 args))
          (insert (nth 0 args)))))))
 
-;; @uref
+;; @uref{URL [,TEXT] [,REPLACEMENT]}
 (put 'uref 'texinfo-format 'texinfo-format-uref)
 (ptexinfmt-defun-if-broken texinfo-format-uref ()
   "Format URL and optional URL-TITLE.
@@ -573,8 +660,19 @@ otherwise, insert URL-TITLE followed by URL in parentheses."
       (texinfo-discard-command))))
 
 \f
+;;; Indent
+;; @exampleindent INDENT  (makeinfo 4.0 or later)
+
+;; @paragraphindent INDENT  (makeinfo 4.0 or later)
+;; INDENT: asis, 0, n
+
+;; @firstparagraphindent WORD   (makeinfo 4.6 or later)
+;; WORD: none, insert
+
+
+\f
 ;;; Special
-;; @image{FILENAME, [WIDTH], [HEIGHT]}
+;; @image{FILENAME [, WIDTH] [, HEIGHT]}
 (put 'image 'texinfo-format 'texinfo-format-image)
 (ptexinfmt-defun-if-void texinfo-format-image ()
   ;; I don't know makeinfo parse FILENAME.
@@ -591,9 +689,6 @@ otherwise, insert URL-TITLE followed by URL in parentheses."
     (message "Reading included file: %s...done" filename)))
 
 
-;; @exampleindent
-
-
 \f
 ;;; @multitable ... @end multitable
 (ptexinfmt-defvar-if-void texinfo-extra-inter-column-width 0