home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / emacs / help / 3891 < prev    next >
Encoding:
Text File  |  1992-08-30  |  4.0 KB  |  116 lines

  1. Path: sparky!uunet!channel1![rick.sheridan@channel1.com]
  2. From: "rick sheridan" <rick.sheridan@channel1.com>
  3. Newsgroups: gnu.emacs.help
  4. Subject: bc++ w/demacs     #03
  5. Message-ID: <1992Aug29.1277.2640@channel1>
  6. Date: 29 Aug 92 21:46:42 EST
  7. Reply-To: "rick sheridan" <rick.sheridan@channel1.com>
  8. Distribution: gnu
  9. Organization: Channel 1 Communications
  10. Lines: 104
  11.  
  12.           ... Continued from previous message... Part 3 of 4
  13.  
  14.          (setq compilation-process nil)
  15.          ;; Force mode line redisplay soon
  16.          (set-buffer-modified-p (buffer-modified-p)))
  17.        (if (and opoint (< opoint omax))
  18.            (goto-char opoint))
  19.        (set-buffer obuf)))))
  20.  
  21. (defun kill-compilation ()
  22.   "Kill the process made by the \\[compile] command."
  23.   (interactive)
  24.   (if compilation-process
  25.       (interrupt-process compilation-process)))
  26.  
  27. (defun kill-grep ()
  28.   "Kill the process made by the \\[grep] command."
  29.   (interactive)
  30.   (if compilation-process
  31.       (interrupt-process compilation-process)))
  32.  
  33. (defun next-error (&optional argp)
  34.   "Visit next compilation error message and corresponding source code.
  35. This operates on the output from the \\[compile] command.
  36. If all preparsed error messages have been processed,
  37. the error message buffer is checked for new ones.
  38. A non-nil argument (prefix arg, if interactive)
  39. means reparse the error message buffer and start at the first error."
  40.   (interactive "P")
  41.   (if (or (eq compilation-error-list t)
  42.       argp)
  43.       (progn (compilation-forget-errors)
  44.          (setq compilation-parsing-end 1)))
  45.   (if compilation-error-list
  46.       nil
  47.     (save-excursion
  48.       (switch-to-buffer "*compilation*")
  49.       (set-buffer-modified-p nil)
  50.       (compilation-parse-errors)))
  51.   (let ((next-error (car compilation-error-list)))
  52.     (if (null next-error)
  53.     (error (concat compilation-error-message
  54.                (if (and compilation-process
  55.                 (eq (process-status compilation-process)
  56.                     'run))
  57.                " yet" ""))))
  58.     (setq compilation-error-list (cdr compilation-error-list))
  59.     (if (null (car (cdr next-error)))
  60.     nil
  61.       (switch-to-buffer (marker-buffer (car (cdr next-error))))
  62.       (goto-char (car (cdr next-error)))
  63.       (set-marker (car (cdr next-error)) nil))
  64.     (let* ((pop-up-windows t)
  65.        (w (display-buffer (marker-buffer (car next-error)))))
  66.       (set-window-point w (car next-error))
  67.       (set-window-start w (car next-error)))
  68.     (set-marker (car next-error) nil)))
  69.  
  70. ;; Set compilation-error-list to nil, and
  71. ;; unchain the markers that point to the error messages and their text,
  72. ;; so that they no longer slow down gap motion.
  73. ;; This would happen anyway at the next garbage collection,
  74. ;; but it is better to do it right away.
  75. (defun compilation-forget-errors ()
  76.   (if (eq compilation-error-list t)
  77.       (setq compilation-error-list nil))
  78.   (while compilation-error-list
  79.     (let ((next-error (car compilation-error-list)))
  80.       (set-marker (car next-error) nil)
  81.       (if (car (cdr next-error))
  82.       (set-marker (car (cdr next-error)) nil)))
  83.     (setq compilation-error-list (cdr compilation-error-list))))
  84.  
  85. (defun compilation-parse-errors ()
  86.   "Parse the current buffer as error messages.
  87. This makes a list of error descriptors, compilation-error-list.
  88. For each source-file, line-number pair in the buffer,
  89. the source file is read in, and the text location is saved in compilation-error-list.
  90. The function next-error, assigned to \\[next-error], takes the next error off the list
  91. and visits its location."
  92.   (setq compilation-error-list nil)
  93.   (message "Parsing error messages...")
  94.   (let (text-buffer
  95.     last-filename last-linenum)
  96.     ;; Don't reparse messages already seen at last parse.
  97.     (goto-char compilation-parsing-end)
  98.     ;; Don't parse the first 4 lines as error messages.
  99.     ;; This matters for grep.
  100.     (if (bobp)
  101.     (forward-line 4))
  102.     (while (re-search-forward compilation-error-regexp nil t)
  103.       (let (linenum filename
  104.         error-marker text-marker)
  105.     ;; Extract file name and line number from error message.
  106.     (save-restriction
  107.  
  108.  
  109.                  Stay Tuned ... Continued in next message
  110.  
  111. ---
  112.  ■ PMDBM DEMO V1.5ß #0 ■ Evaluation Copy
  113. --
  114. Channel 1 (R)   Cambridge, MA
  115.  
  116.