From: fpb@ittc.wec.com (Frank P. Bresz)
Newsgroups: gnu.emacs.sources
Subject: compile.el v18.59 to handle tree walking makes.
Date: 8 Jan 93 15:22:32 GMT
Distribution: gnu
Organization: Westinghouse, ITTC, Pgh, PA.


Here are some changes to allow compile.el to parse and understand Makes
like we have locally that end up walking up and down a tree building
things.  

enjoy.

# rcsdiff -r1.1 -cw compile.el
*** /tmp/T0a27037	Fri Jan  8 10:19:45 1993
--- compile.el	Fri Jan  8 10:19:34 1993
***************
*** 46,51 ****
--- 46,54 ----
    "\\([^ :\n]+\\(: *\\|, line \\|(\\)[0-9]+\\)\\|\\([0-9]+ *of *[^ \n]+\\)"
    "Regular expression for filename/linenumber in error in compilation log.")
  
+ (defvar compilation-cd-regexp "^cd"
+   "Regular expression to be used to glean any cd-ing the make may do")
+ 
  (defun compile (command)
    "Compile the program including the current buffer.  Default: run `make'.
  Runs COMMAND, a shell command, in a separate process asynchronously
***************
*** 230,236 ****
      ;; This matters for grep.
      (if (bobp)
  	(forward-line 2))
!     (while (re-search-forward compilation-error-regexp nil t)
        (let (linenum filename
  	    error-marker text-marker)
  	;; Extract file name and line number from error message.
--- 233,261 ----
      ;; This matters for grep.
      (if (bobp)
  	(forward-line 2))
!     (while (re-search-forward 
! 	    (concat compilation-error-regexp "\\|" compilation-cd-regexp) nil t)
!       ;; Go to the beginninnng of the match and see if we are at a cd line
!       ;; If so the change directory 
!       ;; This allows cd'ing within Make i.e. the tree walking makes can
!       ;; be parsed with this.
!       (goto-char (match-beginning 0))
!       (if (looking-at compilation-cd-regexp)
! 	  (let (dir)
! 	    ;; Code snarfed from shell.el to get directory.
! 	    (skip-chars-forward "^ ")
! 	    (skip-chars-forward " \t")
! 	    (file-directory-p
! 	     (setq dir
! 		   (expand-file-name
! 		    (substitute-in-file-name
! 		     (buffer-substring
! 		      (point)
! 		      (progn
! 			(skip-chars-forward "^\n \t;")
! 			(point)))))))
! 	    (cd dir))
! 	(re-search-forward compilation-error-regexp nil t)
  	(let (linenum filename
  		      error-marker text-marker)
  	  ;; Extract file name and line number from error message.
***************
*** 296,302 ****
  		(setq compilation-error-list
  		      (cons (list error-marker text-marker)
  			    compilation-error-list)))))
! 	(forward-line 1)))
      (setq compilation-parsing-end (point-max)))
    (message "Parsing error messages...done")
    (setq compilation-error-list (nreverse compilation-error-list)))
--- 321,327 ----
  		  (setq compilation-error-list
  			(cons (list error-marker text-marker)
  			      compilation-error-list)))))
! 	  (forward-line 1))))
      (setq compilation-parsing-end (point-max)))
    (message "Parsing error messages...done")
    (setq compilation-error-list (nreverse compilation-error-list)))
--
Frank P. Bresz <fpb@ittc.pgh.wec.com>, uunet!ittc!fpb, +1 412 733 6749, Fx 6444
My opinions are mine, Westinghouse pays big money for *official* opinions
Member: League for Programming Freedom (LPF)  | STOP Software Patents
For more information on the 'LPF' send mail   | before they stop you.