1 ;;; -*- Mode: Emacs-Lisp -*-
4 ;;; ILISP Error handler
6 ;;; This file is part of ILISP.
7 ;;; Please refer to the file COPYING for copyrights and licensing
9 ;;; Please refer to the file ACKNOWLEGDEMENTS for an (incomplete) list
10 ;;; of present and past contributors.
12 ;;; $Id: ilisp-hnd.el,v 1.3 2001-07-02 09:40:46 youngs Exp $
15 ;; Do not handle errors by default.
16 (defvar ilisp-handle-errors nil)
19 (defun ilisp-handler (error-p wait-p message output prompt)
20 "Given ERROR-P, WAIT-P, MESSAGE, OUTPUT and PROMPT, show the message
21 and output if there is an error or the output is multiple lines and
22 let the user decide what to do."
23 (if (not ilisp-handle-errors)
27 (setq ilisp-last-message message
28 ilisp-last-prompt prompt)
29 (if (not wait-p) (lisp-display-output output))))
32 (setq output (comint-remove-whitespace output))
33 (or error-p (string-match "\n" output)))
34 (let* ((buffer (ilisp-output-buffer ilisp-output t))
36 (funcall ilisp-error-filter output)
39 (if (and error-p (not (comint-interrupted)))
42 "SPC-scroll, I-ignore, K-keep, A-abort sends and keep or B-break: "
46 "SPC-scroll, I-ignore, K-keep or A-abort sends and keep: "
48 (clear comint-queue-emptied))
51 (message "Ignore message")
54 (ilisp-temp-buffer-show-function)
59 (set-buffer (get-buffer-create "*Errors*"))
60 (if clear (delete-region (point-min) (point-max)))
61 (goto-char (point-max))
66 (if clear (setq comint-queue-emptied nil))
69 (message "Abort pending commands and keep in *Errors*")
75 (concat comment-start comment-start comment-start
78 (message "Preserve break") nil)
79 (message "Keep error in *Errors* and continue")
84 (defun ilisp-abort-handler ()
85 "Handle when the user aborts commands."
86 (setq ilisp-initializing nil
89 (while ilisp-pending-changes
90 (if (not (memq (car ilisp-pending-changes) lisp-changes))
91 (setq add (cons (car ilisp-pending-changes) add)))
92 (setq ilisp-pending-changes (cdr ilisp-pending-changes)))
93 (setq lisp-changes (nconc lisp-changes add))))