Mercurial > emacs
comparison lisp/progmodes/prolog.el @ 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 | 3b3c7e10cd97 |
children | 5986db97372e |
comparison
equal
deleted
inserted
replaced
104362:cc98a0640268 | 104363:790054ad67dd |
---|---|
236 map)) | 236 map)) |
237 | 237 |
238 (defvar inferior-prolog-mode-syntax-table prolog-mode-syntax-table) | 238 (defvar inferior-prolog-mode-syntax-table prolog-mode-syntax-table) |
239 (defvar inferior-prolog-mode-abbrev-table prolog-mode-abbrev-table) | 239 (defvar inferior-prolog-mode-abbrev-table prolog-mode-abbrev-table) |
240 | 240 |
241 (defvar inferior-prolog-error-regexp-alist | |
242 ;; GNU Prolog used to not follow the GNU standard format. | |
243 '(("^\\(.*?\\):\\([0-9]+\\) error: .*(char:\\([0-9]+\\)" 1 2 3) | |
244 gnu)) | |
245 | |
241 (declare-function comint-mode "comint") | 246 (declare-function comint-mode "comint") |
242 (declare-function comint-send-string "comint" (process string)) | 247 (declare-function comint-send-string "comint" (process string)) |
243 (declare-function comint-send-region "comint" (process start end)) | 248 (declare-function comint-send-region "comint" (process start end)) |
244 (declare-function comint-send-eof "comint" ()) | 249 (declare-function comint-send-eof "comint" ()) |
245 | 250 |
266 Return not at end copies rest of line to end and sends it. | 271 Return not at end copies rest of line to end and sends it. |
267 \\[comint-kill-input] and \\[backward-kill-word] are kill commands, imitating normal Unix input editing. | 272 \\[comint-kill-input] and \\[backward-kill-word] are kill commands, imitating normal Unix input editing. |
268 \\[comint-interrupt-subjob] interrupts the shell or its current subjob if any. | 273 \\[comint-interrupt-subjob] interrupts the shell or its current subjob if any. |
269 \\[comint-stop-subjob] stops. \\[comint-quit-subjob] sends quit signal." | 274 \\[comint-stop-subjob] stops. \\[comint-quit-subjob] sends quit signal." |
270 (setq comint-prompt-regexp "^| [ ?][- ] *") | 275 (setq comint-prompt-regexp "^| [ ?][- ] *") |
276 (set (make-local-variable 'compilation-error-regexp-alist) | |
277 inferior-prolog-error-regexp-alist) | |
278 (compilation-shell-minor-mode) | |
271 (prolog-mode-variables)) | 279 (prolog-mode-variables)) |
272 | 280 |
273 (defvar inferior-prolog-buffer nil) | 281 (defvar inferior-prolog-buffer nil) |
274 | 282 |
275 (defvar inferior-prolog-flavor 'unknown | 283 (defvar inferior-prolog-flavor 'unknown |
355 (eobp) | 363 (eobp) |
356 (eq (point) pmark) | 364 (eq (point) pmark) |
357 (save-excursion | 365 (save-excursion |
358 (goto-char (- pmark 3)) | 366 (goto-char (- pmark 3)) |
359 (looking-at " \\? "))) | 367 (looking-at " \\? "))) |
368 ;; This is GNU prolog waiting to know whether you want more answers | |
369 ;; or not (or abort, etc...). The answer is a single char, not | |
370 ;; a line, so pass this char directly rather than wait for RET to | |
371 ;; send a whole line. | |
360 (comint-send-string proc (string last-command-event)) | 372 (comint-send-string proc (string last-command-event)) |
361 (call-interactively 'self-insert-command)))) | 373 (call-interactively 'self-insert-command)))) |
362 | 374 |
363 (defun prolog-consult-region (compile beg end) | 375 (defun prolog-consult-region (compile beg end) |
364 "Send the region to the Prolog process made by \"M-x run-prolog\". | 376 "Send the region to the Prolog process made by \"M-x run-prolog\". |
387 (interactive) | 399 (interactive) |
388 (save-buffer) | 400 (save-buffer) |
389 (let ((file buffer-file-name) | 401 (let ((file buffer-file-name) |
390 (proc (inferior-prolog-process))) | 402 (proc (inferior-prolog-process))) |
391 (with-current-buffer (process-buffer proc) | 403 (with-current-buffer (process-buffer proc) |
404 (compilation-forget-errors) | |
392 (comint-send-string proc (concat "['" (file-relative-name file) "'].\n")) | 405 (comint-send-string proc (concat "['" (file-relative-name file) "'].\n")) |
393 (pop-to-buffer (current-buffer))))) | 406 (pop-to-buffer (current-buffer))))) |
394 | 407 |
395 (provide 'prolog) | 408 (provide 'prolog) |
396 | 409 |