home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / mutt / compile.mut < prev    next >
Lisp/Scheme  |  1988-09-07  |  2KB  |  50 lines

  1. ; compile.mut: compiling made easy.
  2. ; Save the current buffer (if need be), run make from ME,
  3. ;   collect the error/warning messages and parse the errors.
  4. ;   If ERROR or WARNING is found, the file with the error is
  5. ;   visited, the cursor is placed on the line containing the error
  6. ;   and the error is displayed.
  7. ; ^X^E is usally bound to compile.
  8. ; ^X^N is usally bound to get next error.
  9. ; Notes:
  10. ;  This is set up to parse LATTICE C.  You'll probably have to 
  11. ;     change things for some other compiler.
  12. ;  Microsoft MASM does not send errors to stdout.  Those bozos.  So you
  13. ;    can't use this for masm.
  14. ;  C Durland
  15.  
  16. (defun compile        ; fork make
  17. {
  18.   (string cb 80)(cb (buffer-name -1))
  19.   (delete-other-windows)(save-buffer)
  20.   (kill-buffer "*error-log*" "yes")(switch-to-buffer "*error-log*")
  21.   (set-mark)(msg "Compiling.....")(filter-region "make")
  22.   (buffer-modified -1 FALSE)(use-old-buffer cb)(next-error)
  23. })
  24.  
  25. (defun next-error    ; display the next error or warning
  26. {
  27.   (string cb 80)(cb (buffer-name -1))
  28.   (delete-other-windows)(switch-to-buffer "error.log")
  29.   (forward-line 1)    ; assume 1st line is not an error line
  30.   (if (re-search-forward "[ewEW][raRA]r[onON]")    ; look for "error" or "warn"
  31.   {    ; found it
  32.     (split-window)(while (shrink-window) {})    ; 1 line error window
  33.     (beginning-of-line)
  34.     (if (looking-at '^\(\w+\.\w+\) \(\d+\)') ;get file name, line#
  35.     {
  36.       (visit-file (get-matched '\1'))    ; visit the file with the error
  37.       (goto-line (atoi(get-matched '\2')))    ; put dot at error
  38.       (msg "")        ; clear minibuffer
  39.     }
  40.     {(use-old-buffer cb)(msg "Can't parse.")}
  41.     )
  42.   }
  43.   {(use-old-buffer cb)(msg "No errors")}
  44.   )
  45.   (update)
  46. })
  47.  
  48. (bind-to-key "compile" "^X^E")
  49. (bind-to-key "next-error" "^X^N")
  50.