(defun dot () (point))

(defun idraw-ispell ()
"Check the spelling of an idraw file by finding each text segment, defining a
region around the text part of the segment, and running ispell-region on it."
    (interactive)
    (while (search-forward "Begin %I Text" nil t)
        (search-forward "\n[\n")
	(setq d (dot))
	(search-forward "\n] Text")
	(beginning-of-line)
	(ispell-region d (dot))
    )
)

(defun spell-all-idraw-files ()
"Spell check all of the .idr files in the current working directory."
    (interactive)
    (save-excursion
	(let ((files (directory-files "." nil "\\.idr$")))
	    (spell-all-idraw-files-1 files)
	)
    )
)

(defun spell-all-idraw-files-1 (files)
"Work doer for spell-all-idraw-files."
    (cond
        ( files
	  (let ((file (car files)))
	      (if (not (string=
			 (read-from-minibuffer
			   (concat "Spell check file " file " (y/n)? "))
			 "n"))
		  (progn
		    (find-file-other-window (car files))
		    (idraw-ispell)
		  )
	       )
	       (spell-all-idraw-files-1 (cdr files))
	  )
        )
    )
)