Initial Commit
[packages] / xemacs-packages / ilisp / ilisp-kil.el
1 ;;; -*- Mode: Emacs-Lisp -*-
2
3 ;;; ilisp-kil.el --
4 ;;; ILISP Panic/Reset/Status commands.
5 ;;;
6 ;;; This file is part of ILISP.
7 ;;; Please refer to the file COPYING for copyrights and licensing
8 ;;; information.
9 ;;; Please refer to the file ACKNOWLEGDEMENTS for an (incomplete) list
10 ;;; of present and past contributors.
11 ;;;
12 ;;; $Id: ilisp-kil.el,v 1.3 2001-07-02 09:40:47 youngs Exp $
13
14 ;;;%% Panic/Reset/Status commands 
15 ;;;
16 (defun status-lisp (showp)
17   "Show the message of the current command being executed in the
18 inferior LISP.  With a prefix show pending sends as well."  
19   (interactive "P")
20   (save-excursion
21     (set-buffer (ilisp-buffer))
22     (comint-current-send showp)))
23
24
25 ;;;
26 (defun reset-ilisp ()
27   "Reset the inferior LISP top level."
28   (interactive)
29   (message "Reset LISP to top level")
30   (comint-simple-send (ilisp-process) (ilisp-value 'ilisp-reset)))
31
32 ;;;
33 (defun abort-commands-lisp (&optional message)
34   "Abort the commands sent to the current ilisp."
35   (interactive)
36   (if (ilisp-value comint-aborting t)
37       (message "Already aborted commands")
38       (beep)
39       (message (or message "Aborted commands"))
40       (comint-abort-sends (ilisp-process))))
41
42 ;;;
43 (defun panic-lisp ()
44   "Panic reset for the inferior LISP."
45   (interactive)
46   (save-excursion
47     (if (y-or-n-p "Panic reset LISP? ")
48         (save-excursion
49           (set-buffer (ilisp-buffer))
50           (comint-setup-ipc t)
51           (message "LISP is reset, state is unknown"))
52         (message ""))))
53
54 ;;;
55 (defun repair-ilisp ()
56   "If ilisp is not listening to you in the lisp interaction buffer, you might try this."
57   (interactive)
58   (set-buffer (ilisp-buffer))
59   (comint-setup-ipc t)
60   (goto-char (point-max))
61   (insert "()")
62   (return-ilisp)
63   (message "ILISP is working again (maybe)"))
64
65
66 ;;;
67 (defun interrupt-subjob-ilisp ()
68   "Interrupt the current top level command in the inferior LISP."
69   (interactive)
70   (if (not (eq comint-send-queue comint-end-queue))
71       (if (y-or-n-p "Abort commands before interrupting top level? ")
72           (abort-commands-lisp)
73           (message "Waiting for commands to finish")
74           (while (not (eq comint-send-queue comint-end-queue))
75             (accept-process-output)
76             (sit-for 0))))
77   (message "Interrupted top level")
78   (comint-interrupt-subjob))