(defun dot () (point)) (defun idraw-textify-paragraph (&optional x-coord y-coord) "Wrap the paragraph around point as an idraw text block. The optional X-COORD and Y-COORD are the x and y coordinates for the text block. The default for both is 0." (interactive) (let ((x x-coord) (y y-coord)) ; Default x and y coords to 0 if necessary. (if (eq x nil) (setq x 0)) (if (eq y nil) (setq y 0)) ; Mark the paragraph, position at 1st line, and narrow to it. (mark-paragraph) (next-line 1) (narrow-to-region (dot) (1- (mark))) ; Insert the standard command block that precedes the text itself. (insert (concat "Begin %I Text\n" "%I cfg Black\n" "0 0 0 SetCFg\n" "%I f *-courier-medium-r-*-120-*\n" "/Courier 12 SetF\n" "%I t\n" "[ 1 0 0 1 " (int-to-string x) " " (int-to-string y) " ] concat\n" "%I\n" "[\n" )) ; Put "(" ... ")" around each text line. (while (not (eobp)) (insert "(") (end-of-line) (insert ")") (next-line 1) (beginning-of-line) ) ; Insert the standard command block that follows the text itself. (insert (concat "] Text\n" "End" )) ; Widen back out for nice viewing. (widen) ) ) (defun idraw-textify-paragraphs-cascading (start-x start-y x-incr y-incr) "Call idraw-textify-paragraph (q.v.) on each paragraph in the region, incrementing the starting coords START-X and START-Y by X-INCR and Y-INCR, resp., at each successive placement. Note that region must end with blank line marking end of last paragraph. If not, function will run to end of buffer." (interactive "nStart x coord: nStart y coord: nx incr: ny incr: ") (let ((d (dot)) (m (mark)) (x start-x) (y start-y)) ; Mark end of entering region with ^A char (dont know better way). (goto-char m) (insert "") (goto-char d) ; Call idraw-textify-paragraph on each paragraph up to ^A. (while (or (not (= (following-char) ?)) (eobp)) (idraw-textify-paragraph x y) (setq x (+ x x-incr)) (setq y (+ y y-incr)) (next-line 2) (beginning-of-line) ) ; Get rid of end-of-region marking ^A char. ;(delete-char 1) ) )