(provide 'ptexinfmt)
-;;; Fix broken facility
+;;; Broken
;; @var
(broken-facility texinfo-format-var
- "When @COMMAND included, don't perse it."
+ "Don't perse @COMMAND included @var"
(condition-case nil
(with-temp-buffer
(let (texinfo-enclosure-list texinfo-alias-list)
t))
(error nil)))
-(when-broken texinfo-format-var
- (defun texinfo-format-var ()
- (let ((arg (texinfo-parse-expanded-arg)))
- (texinfo-discard-command)
- (insert (upcase arg)))))
-
;; @xref
(broken-facility texinfo-format-xref
- "When 1st arg is nil, wrong-type-argument error."
+ "Can't format 1st argument empty @xref."
(condition-case nil
(with-temp-buffer
(let (texinfo-enclosure-list texinfo-alias-list)
t))
(error nil)))
-(when-broken texinfo-format-xref
- (defun texinfo-format-xref ()
- (let ((args (texinfo-format-parse-args)))
- (texinfo-discard-command)
- (insert "*Note ")
- (let ((fname (or (nth 1 args) (nth 2 args))))
- (if (null (or fname (nth 3 args)))
- (insert (car args) "::")
- (insert (or fname (car args)) ": ")
- (if (nth 3 args)
- (insert "(" (nth 3 args) ")"))
- (and (car args) (insert (car args))))))))
-
;; @uref
(broken-facility texinfo-format-uref
- "Parse 2 times argument."
+ "Parse 2 times @uref argument."
(condition-case nil
(with-temp-buffer
(let (texinfo-enclosure-list texinfo-alias-list)
t))
(error nil)))
-(when-broken texinfo-format-uref
- (fmakunbound 'texinfo-format-uref)) ; after defun-maybe
+;;; Obsolete
+;; Removed Texinfo 3.8
+(put 'overfullrule 'texinfo-format 'texinfo-discard-line)
+(put 'smallbreak 'texinfo-format 'texinfo-discard-line)
+(put 'medbreak 'texinfo-format 'texinfo-discard-line)
+(put 'bigbreak 'texinfo-format 'texinfo-discard-line)
+;; Removed Texinfo 3.9
+(put 'setchapterstyle 'texinfo-format 'texinfo-discard-line-with-args)
+
+;;; Hardcopy and HTML (discard)
+;; I18N
+(put 'documentlanguage 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'documentencoding 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; size
+(put 'smallbook 'texinfo-format 'texinfo-discard-line)
+(put 'afourpaper 'texinfo-format 'texinfo-discard-line)
+(put 'afourlatex 'texinfo-format 'texinfo-discard-line)
+(put 'afourwide 'texinfo-format 'texinfo-discard-line)
+(put 'pagesizes 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; style
+(put 'setchapternewpage 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'kbdinputstyle 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; flags
+(put 'setcontentsaftertitlepage 'texinfo-format 'texinfo-discard-line)
+(put 'setshortcontentsaftertitlepage 'texinfo-format 'texinfo-discard-line)
+(put 'novalidate 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; head & foot
+(put 'headings 'texinfo-format 'texinfo-discard-line-with-args)
+(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)
+
+;; misc
+(put 'page 'texinfo-format 'texinfo-discard-line)
+(put 'hyphenation 'texinfo-format 'texinfo-discard-command-and-arg)
+\f
;;; Directory File
;; @direcategory
(put 'dircategory 'texinfo-format 'texinfo-format-dircategory)
(texinfo-pop-stack 'direntry))
-;;; Menus
+;;; Block Enclosing and Conditional
;; @detailmenu ... @end detailmenu
(put 'detailmenu 'texinfo-format 'texinfo-discard-line)
(put 'detailmenu 'texinfo-end 'texinfo-discard-command)
-;;; Block Enclosing
;; @smalldisplay ... @end smalldisplay
(put 'smalldisplay 'texinfo-format 'texinfo-format-example)
(put 'smalldisplay 'texinfo-end 'texinfo-end-example)
(put 'smallformat 'texinfo-format 'texinfo-format-flushleft)
(put 'smallformat 'texinfo-end 'texinfo-end-flushleft)
+;; @ifnottex ... @end ifnottex
+(put 'ifnottex 'texinfo-format 'texinfo-discard-line)
+(put 'ifnottex 'texinfo-end 'texinfo-discard-command)
+
+;; @ifnothtml ... @end ifnothtml
+(put 'ifnothtml 'texinfo-format 'texinfo-discard-line)
+(put 'ifnothtml 'texinfo-end 'texinfo-discard-command)
+
+;; @ifnotinfo ... @end ifnotinfo
+(put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo)
+(put 'endifnotinfo 'texinfo-format 'texinfo-discard-line)
+(defun-maybe texinfo-format-ifnotinfo ()
+ (delete-region texinfo-command-start
+ (progn (re-search-forward "@end ifnotinfo[ \t]*\n")
+ (point))))
+
+;; @html ... @end html
+(put 'html 'texinfo-format 'texinfo-format-html)
+(put 'endhtml 'texinfo-format 'texinfo-discard-line)
+(defun-maybe texinfo-format-html ()
+ (delete-region texinfo-command-start
+ (progn (re-search-forward "@end html[ \t]*\n")
+ (point))))
+
+\f
;;; Marking
;; @url, @env, @command
(put 'url 'texinfo-format 'texinfo-format-code)
;; @acronym
(put 'acronym 'texinfo-format 'texinfo-format-var)
+(when-broken texinfo-format-var
+ (fmakunbound 'texinfo-format-var))
+(defun-maybe texinfo-format-var ()
+ (let ((arg (texinfo-parse-expanded-arg)))
+ (texinfo-discard-command)
+ (insert (upcase arg))))
+
;; @key
(put 'key 'texinfo-format 'texinfo-format-key)
(defun-maybe texinfo-format-key ()
;; @email{EMAIL-ADDRESS[, DISPLAYED-TEXT]}
(put 'email 'texinfo-format 'texinfo-format-email)
-(defun texinfo-format-email ()
+(defun-maybe texinfo-format-email ()
"Format EMAIL-ADDRESS and optional DISPLAYED-TXT.
Insert < ... > around EMAIL-ADDRESS."
(let ((args (texinfo-format-parse-args)))
(goto-char texinfo-command-start))
-;;; Cross References
-;; @ref
-(put 'ref 'texinfo-format 'texinfo-format-xref)
-
-;; @uref
-(put 'uref 'texinfo-format 'texinfo-format-uref)
-(defun-maybe texinfo-format-uref ()
- "Format URL and optional URL-TITLE.
-Insert ` ... ' around URL if no URL-TITLE argument;
-otherwise, insert URL-TITLE followed by URL in parentheses."
- (let ((args (texinfo-format-parse-args)))
- (texinfo-discard-command)
- ;; if url-title
- (if (nth 1 args)
- (insert (nth 1 args) " (" (nth 0 args) ")")
- (insert "`" (nth 0 args) "'"))
- (goto-char texinfo-command-start)))
-
-;;; Conditional
-;; @ifnottex ... @end ifnottex
-(put 'ifnottex 'texinfo-format 'texinfo-discard-line)
-(put 'ifnottex 'texinfo-end 'texinfo-discard-command)
-
-;; @ifnothtml ... @end ifnothtml
-(put 'ifnothtml 'texinfo-format 'texinfo-discard-line)
-(put 'ifnothtml 'texinfo-end 'texinfo-discard-command)
-
-;; @ifnotinfo ... @end ifnotinfo
-(put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo)
-(put 'endifnotinfo 'texinfo-format 'texinfo-discard-line)
-(defun-maybe texinfo-format-ifnotinfo ()
- (delete-region texinfo-command-start
- (progn (re-search-forward "@end ifnotinfo[ \t]*\n")
- (point))))
-
-;; @html ... @end html
-(put 'html 'texinfo-format 'texinfo-format-html)
-(put 'endhtml 'texinfo-format 'texinfo-discard-line)
-(defun texinfo-format-html ()
- (delete-region texinfo-command-start
- (progn (re-search-forward "@end html[ \t]*\n")
- (point))))
-
-;;; Hardcopy and HTML (discard)
-;; I18N
-(put 'documentlanguage 'texinfo-format 'texinfo-discard-line-with-args)
-(put 'documentencoding 'texinfo-format 'texinfo-discard-line-with-args)
-
-;; size
-(put 'smallbook 'texinfo-format 'texinfo-discard-line)
-(put 'afourpaper 'texinfo-format 'texinfo-discard-line)
-(put 'afourlatex 'texinfo-format 'texinfo-discard-line)
-(put 'afourwide 'texinfo-format 'texinfo-discard-line)
-(put 'pagesizes 'texinfo-format 'texinfo-discard-line-with-args)
-
-;; style
-(put 'setchapternewpage 'texinfo-format 'texinfo-discard-line-with-args)
-(put 'kbdinputstyle 'texinfo-format 'texinfo-discard-line-with-args)
-
-;; flags
-(put 'setcontentsaftertitlepage 'texinfo-format 'texinfo-discard-line)
-(put 'setshortcontentsaftertitlepage 'texinfo-format 'texinfo-discard-line)
-(put 'novalidate 'texinfo-format 'texinfo-discard-line-with-args)
-
-;; head & foot
-(put 'headings 'texinfo-format 'texinfo-discard-line-with-args)
-(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)
-
-;; misc
-(put 'page 'texinfo-format 'texinfo-discard-line)
-(put 'hyphenation 'texinfo-format 'texinfo-discard-command-and-arg)
-
-;;; Special
-;; @exampleindent
-
-;; @alias NEW=EXISTING (maybe invalid)
-(put 'alias 'texinfo-format 'texinfo-alias)
-(defun-maybe texinfo-alias ()
- (let ((start (1- (point)))
- args)
- (skip-chars-forward " ")
- (save-excursion (end-of-line) (setq texinfo-command-end (point)))
- (if (not (looking-at "\\([^=]+\\)=\\(.*\\)"))
- (error "Invalid alias command")
- (setq texinfo-alias-list
- (cons
- (cons
- (buffer-substring (match-beginning 1) (match-end 1))
- (buffer-substring (match-beginning 2) (match-end 2)))
- texinfo-alias-list))
- (texinfo-discard-command))))
-
-;; @definfoenclose NEWCMD, BEFORE, AFTER
-
-;; @image{FILENAME, [WIDTH], [HEIGHT]}
-(put 'image 'texinfo-format 'texinfo-format-image)
-(defun-maybe texinfo-format-image ()
- (let ((args (texinfo-format-parse-args)) ; parse FILENAME?
- 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))))))
-
-;; @multitable COLUMN-WIDTH-SPEC'
-
-
+\f
;;; Accents and Special characters
;; @pounds{} ==> # Pounds Sterling
(put 'pounds 'texinfo-format 'texinfo-format-pounds)
(goto-char texinfo-command-start))
-;;; Obsolete Texinfo command (backward compatibility)
-;; Removed Texinfo 3.8
-(put 'overfullrule 'texinfo-format 'texinfo-discard-line)
-(put 'smallbreak 'texinfo-format 'texinfo-discard-line)
-(put 'medbreak 'texinfo-format 'texinfo-discard-line)
-(put 'bigbreak 'texinfo-format 'texinfo-discard-line)
-;; Removed Texinfo 3.9
-(put 'setchapterstyle 'texinfo-format 'texinfo-discard-line-with-args)
+\f
+;;; Cross References
+;; @ref, @xref
+(put 'ref 'texinfo-format 'texinfo-format-xref)
+
+(when-broken texinfo-format-xref
+ (fmakunbound 'texinfo-format-xref))
+(defun-maybe texinfo-format-xref ()
+ (let ((args (texinfo-format-parse-args)))
+ (texinfo-discard-command)
+ (insert "*Note ")
+ (let ((fname (or (nth 1 args) (nth 2 args))))
+ (if (null (or fname (nth 3 args)))
+ (insert (car args) "::")
+ (insert (or fname (car args)) ": ")
+ (if (nth 3 args)
+ (insert "(" (nth 3 args) ")"))
+ (and (car args) (insert (car args)))))))
+
+;; @uref
+(put 'uref 'texinfo-format 'texinfo-format-uref)
+(when-broken texinfo-format-uref
+ (fmakunbound 'texinfo-format-uref))
+(defun-maybe texinfo-format-uref ()
+ "Format URL and optional URL-TITLE.
+Insert ` ... ' around URL if no URL-TITLE argument;
+otherwise, insert URL-TITLE followed by URL in parentheses."
+ (let ((args (texinfo-format-parse-args)))
+ (texinfo-discard-command)
+ ;; if url-title
+ (if (nth 1 args)
+ (insert (nth 1 args) " (" (nth 0 args) ")")
+ (insert "`" (nth 0 args) "'"))
+ (goto-char texinfo-command-start)))
+
+
+\f
+;;; Special
+;; @exampleindent
+
+;; @alias NEW=EXISTING
+(put 'alias 'texinfo-format 'texinfo-alias)
+(defun-maybe texinfo-alias ()
+ (let ((start (1- (point)))
+ args)
+ (skip-chars-forward " ")
+ (save-excursion (end-of-line) (setq texinfo-command-end (point)))
+ (if (not (looking-at "\\([^=]+\\)=\\(.*\\)"))
+ (error "Invalid alias command")
+ (setq texinfo-alias-list
+ (cons
+ (cons
+ (buffer-substring (match-beginning 1) (match-end 1))
+ (buffer-substring (match-beginning 2) (match-end 2)))
+ texinfo-alias-list))
+ (texinfo-discard-command))))
+
+;; @definfoenclose NEWCMD, BEFORE, AFTER
+
+;; @image{FILENAME, [WIDTH], [HEIGHT]}
+(put 'image 'texinfo-format 'texinfo-format-image)
+(defun-maybe texinfo-format-image ()
+ (let ((args (texinfo-format-parse-args)) ; parse FILENAME?
+ 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)))
+
+;; @multitable COLUMN-WIDTH-SPEC'
;;; ptexinfmt.el ends here