;;;
;;; LIST OF WEB PUBLISHING TASKS:
;;;
;;;  ( 1) d-copy-copy-files
;;;  ( 2) C-f ~/hairy-lemon/src; f9 make publish
;;;  ( 3) M-x testlinks ~/hairy-lemon/output/davin/
;;;  ( 4) M-x weblint ~/hairy-lemon/output/davin/
;;;  ( 5) C-f ~/hairy-lemon/src; f9 make tar
;;;  ( 6) M-x bak
;;;  ( 7) Insert blank CD -> Show in Windows Explorer
;;;  ( 8) Manually Copy files (d:/home/bak/* and d:/home/hairy-lemon/output/)
;;;  ( 9) Click button: Write Files to CD
;;;  (10) Eval (d-archive-compare--zips)
;;;  (11) easy upload to Geocities www.ripway.com/davin
;;;

(defun d-publish ()
  (interactive)

  ;; SAVE FILES:
  (save-some-buffers 'NO-QUESTIONS)
  (bak--info)
  (bak--allegro 'no-extra)

  (let ((default-directory (concat webdata "src/")))
    (compile "make publish")
    ;;(if (get-buffer "*Shell Command Output*")
    ;;    (kill-buffer (get-buffer "*Shell Command Output*")))
    ;;(shell-command "make publish")
    )

  ;;(error "%s" (get-buffer (current-buffer)))
  (set-buffer "*compilation*")
  (font-lock-mode 1)

;;  (while (not (save-excursion
;;                (set-buffer "*compilation*")
;;                (goto-char (point-min))
;;                (or (re-search-forward "^Compilation finished at" nil t)
;;                    (re-search-forward "^Compilation exited abnormally with code" nil t))))
;;    (sit-for 1))

  (while compilation-in-progress
    (sit-for 1))

  (if (save-excursion
        ;;(set-buffer "*Shell Command Output*")
        (goto-char (point-min))
        (re-search-forward "Error" nil t))
      (error "Error during make publish"))

  (bak)
  ;;(checksum)
  ;;(manifest)

  (progn
    (testlinks)
    (if (save-excursion
          (set-buffer "*Link Report*")
          (goto-char (point-min))
          (re-search-forward "Error" nil t))
        (error "Error during M-x testlinks")))

  (message "M-x publish finished without errors")
  )

;;(let ((default-directory "~/hairy-lemon/web/"))
;;  (compile "make m4"))

(provide 'd-publish)
;;; d-publish.el ends here
