From: "rick sheridan" <rick.sheridan@channel1.com>
Newsgroups: gnu.emacs.help
Subject: bc++ w/demacs     #01
Date: 29 Aug 92 21:46:41 EST
Reply-To: "rick sheridan" <rick.sheridan@channel1.com>
Distribution: gnu
Organization: Channel 1 Communications

Let me thank everyone who has helped me with this, especially Juergen
Nickelsen.

Below is the COMPILE.EL file for Demacs 1.2.0 that will work with
Borland C++.  I only have Borland C++ 3.1 but assume the output for
most Borland compilers is

        Error|Warning <filename> <linenumber>: <error message>

I hope a few Demacs users find this helpful.

-------------------------------- cut here -----------------------------

;; 92/08/28 modified by R.L. Sheridan, rick.sheridan@channel1.com,
;; for use with Borland compilers.
;; This has been tested only with Borland C++ 3.1, but should
;; work with all Borland language products.
;;
;; 91/10/22 modified for Demacs 1.1 by Manabu Higashida
;;

;; Run compiler as inferior of Emacs, and parse its error messages.
;; Copyright (C) 1985, 1986 Free Software Foundation, Inc.

;; This file is part of GNU Emacs.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY.  No author or distributor
;; accepts responsibility to anyone for the consequences of using it
;; or for whether it serves any particular purpose or works at all,
;; unless he says so in writing.  Refer to the GNU Emacs General Public
;; License for full details.

;; Everyone is granted permission to copy, modify and redistribute
;; GNU Emacs, but only under the conditions described in the
;; GNU Emacs General Public License.   A copy of this license is
;; supposed to have been given to you along with GNU Emacs so you
;; can know your rights and responsibilities.  It should be in a
;; file named COPYING.  Among other things, the copyright notice
;; and this notice must be preserved on all copies.

(provide 'compile)

(defvar compilation-process nil
  "Process created by compile command, or nil if none exists now.
Note that the process may have been \"deleted\" and still
be the value of this variable.")

(defvar compilation-error-list nil
  "List of error message descriptors for visiting erring functions.
Each error descriptor is a list of length two.
Its car is a marker pointing to an error message.
Its cadr is a marker pointing to the text of the line the message is about,
  or nil if that is not interesting.
The value may be t instead of a list;
this means that the buffer of error messages should be reparsed
the next time the list of errors is wanted.")

(defvar compilation-parsing-end nil
  "Position of end of buffer when last error messages parsed.")

(defvar compilation-error-message nil
  "Message to print when no more matches for compilation-error-regexp are found")

;; The regular expression has been modified to find error/warning
;; messages of the form:
;;
;;     Error|Warning <filename> <line number>: <error message>
;;
;; I only have Borland C++ but assume other Borland language products
;; use the same format.
(defvar compilation-error-regexp
  "^\\(\\(Error\\|Warning\\) \\([^ ]+\\) \\([0-9]+\\): [ -~]+\\)$"
  "Regular expression for filename/linenumber in error in compilation log.")

(defun compile (command)
  "Compile the program including the current buffer.  Default: run `make'.
Runs COMMAND, a shell command, in a separate process asynchronously
with output going to the buffer *compilation*.
On MS-DOS, this function works but syncronously.
You can then use the command \\[next-error] to find the next error message
and move to the source code that caused it."
  (interactive (list (read-string "Compile command: " compile-command)))
  (setq compile-command command)
  (compile1 compile-command "No more errors"))

(defun grep (command)
  "Run grep, with user-specified args, and collect output in a buffer.
While grep runs asynchronously, you can use the \\[next-error] command
to find the text that grep hits refer to."
  (interactive "sRun grep (with args): ")
  (compile1 (concat "grep -n " command
		    (if (not (eq system-type 'ms-dos))" /dev/null"))


                 Stay Tuned ... Continued in next message

---
  PMDBM DEMO V1.5 #0  Evaluation Copy
--
Channel 1 (R)   Cambridge, MA

Newsgroups: gnu.emacs.help