Function: artist-vaporize-lines

artist-vaporize-lines is a byte-compiled function defined in artist.el.gz.

Signature

(artist-vaporize-lines X1 Y1)

Documentation

Vaporize lines reachable from point X1, Y1.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
;; Implementation note: This depends on artist-vaporize-line doing
;; unintersections of intersecting lines.
;;
;; Example:
;;   Suppose the buffer looks like this and that we start vaporizing
;;   lines at (3,0) (at the ``*'').
;;
;;          0123456
;;         0+--*--+
;;         1|     |
;;         2|     |
;;         3+-----+
;;
;;   We will then push (0,0) and (6,0) on the stack, and vaporize the
;;   topmost horizontal line:
;;
;;          0123456
;;         0|     |
;;         1|     |
;;         2|     |
;;         3+-----+
;;
;;   We will then pop (0,0) and remove the left-most vertical line while
;;   pushing the lower left corner (0,3) on the stack, and so on until
;;   the entire rectangle is vaporized.
;;
;;   Now, What if the `+' in the upper left and upper right corners,
;;   had not been changed to `|' but to spaces instead? We would
;;   have failed when popping (0,0) and vaporizing that line because
;;   we wouldn't find any line at (0,0):
;;
;;          0123456
;;         0
;;         1|     |
;;         2|     |
;;         3+-----+
;;
;;   That's why we depend on artist-vaporize-line doing unintersecting
;;   of crossing lines. There are alternative ways to handle this
;;   if it becomes too much a trouble.
;;
(defun artist-vaporize-lines (x1 y1)
  "Vaporize lines reachable from point X1, Y1."
  (let ((ep-stack nil))
    (mapc
     (lambda (ep) (push ep ep-stack))
     (artist-vap-find-endpoints x1 y1))
    (while (not (null ep-stack))
      (let* ((vaporize-point (pop ep-stack))
	     (new-endpoints (artist-vaporize-line (car vaporize-point)
						  (cdr vaporize-point))))
	(mapc
	 (lambda (endpoint) (push endpoint ep-stack))
	 new-endpoints)))))