-;;; @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)))
+
+\f
+;;; @ifinfo, @iftex, @tex, @ifhtml, @html, @ifplaintext, @ifxml, @xml
+;; @ifnottex, @ifnotinfo, @ifnothtml, @ifnotplaintext, @ifnotxml