changeset 104363:790054ad67dd

(inferior-prolog-error-regexp-alist): New var. (inferior-prolog-mode): Use it. (inferior-prolog-load-file): Reset list of errors.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 19 Aug 2009 17:15:30 +0000
parents cc98a0640268
children 82c4f7cce5f9
files lisp/ChangeLog lisp/progmodes/prolog.el
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Aug 19 14:39:35 2009 +0000
+++ b/lisp/ChangeLog	Wed Aug 19 17:15:30 2009 +0000
@@ -1,3 +1,9 @@
+2009-08-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/prolog.el (inferior-prolog-error-regexp-alist): New var.
+	(inferior-prolog-mode): Use it.
+	(inferior-prolog-load-file): Reset list of errors.
+
 2009-08-19  ARISAWA Akihiro  <ari@mbf.ocn.ne.jp>  (tiny change)
 
 	* language/tibetan.el ("Tibetan"): Fix sample-text entry.
--- a/lisp/progmodes/prolog.el	Wed Aug 19 14:39:35 2009 +0000
+++ b/lisp/progmodes/prolog.el	Wed Aug 19 17:15:30 2009 +0000
@@ -238,6 +238,11 @@
 (defvar inferior-prolog-mode-syntax-table prolog-mode-syntax-table)
 (defvar inferior-prolog-mode-abbrev-table prolog-mode-abbrev-table)
 
+(defvar inferior-prolog-error-regexp-alist
+  ;; GNU Prolog used to not follow the GNU standard format.
+  '(("^\\(.*?\\):\\([0-9]+\\) error: .*(char:\\([0-9]+\\)" 1 2 3)
+    gnu))
+
 (declare-function comint-mode "comint")
 (declare-function comint-send-string "comint" (process string))
 (declare-function comint-send-region "comint" (process start end))
@@ -268,6 +273,9 @@
 \\[comint-interrupt-subjob] interrupts the shell or its current subjob if any.
 \\[comint-stop-subjob] stops. \\[comint-quit-subjob] sends quit signal."
   (setq comint-prompt-regexp "^| [ ?][- ] *")
+  (set (make-local-variable 'compilation-error-regexp-alist)
+       inferior-prolog-error-regexp-alist)
+  (compilation-shell-minor-mode)
   (prolog-mode-variables))
 
 (defvar inferior-prolog-buffer nil)
@@ -357,6 +365,10 @@
              (save-excursion
                (goto-char (- pmark 3))
                (looking-at " \\? ")))
+        ;; This is GNU prolog waiting to know whether you want more answers
+        ;; or not (or abort, etc...).  The answer is a single char, not
+        ;; a line, so pass this char directly rather than wait for RET to
+        ;; send a whole line.
         (comint-send-string proc (string last-command-event))
       (call-interactively 'self-insert-command))))
 
@@ -389,6 +401,7 @@
   (let ((file buffer-file-name)
         (proc (inferior-prolog-process)))
     (with-current-buffer (process-buffer proc)
+      (compilation-forget-errors)
       (comint-send-string proc (concat "['" (file-relative-name file) "'].\n"))
       (pop-to-buffer (current-buffer)))))