0
|
1 ;;; -*- Mode: Emacs-Lisp -*-
|
|
2
|
|
3 ;;; ilisp-prc.el --
|
|
4
|
|
5 ;;; This file is part of ILISP.
|
|
6 ;;; Version: 5.7
|
|
7 ;;;
|
|
8 ;;; Copyright (C) 1990, 1991, 1992, 1993 Chris McConnell
|
|
9 ;;; 1993, 1994 Ivan Vasquez
|
|
10 ;;; 1994, 1995 Marco Antoniotti and Rick Busdiecker
|
|
11 ;;;
|
|
12 ;;; Other authors' names for which this Copyright notice also holds
|
|
13 ;;; may appear later in this file.
|
|
14 ;;;
|
|
15 ;;; Send mail to 'ilisp-request@lehman.com' to be included in the
|
|
16 ;;; ILISP mailing list. 'ilisp@lehman.com' is the general ILISP
|
|
17 ;;; mailing list were bugs and improvements are discussed.
|
|
18 ;;;
|
|
19 ;;; ILISP is freely redistributable under the terms found in the file
|
|
20 ;;; COPYING.
|
|
21
|
|
22
|
|
23
|
|
24 ;;;
|
|
25 ;;; ILISP process handling
|
|
26 ;;;
|
|
27 ;;;
|
|
28 (defun ilisp-process ()
|
|
29 "Return the current ILISP process."
|
|
30 (get-buffer-process (ilisp-buffer)))
|
|
31
|
|
32
|
|
33 (defvar ilisp-buffer-function 'ilisp-recent-buffer
|
|
34 "A function of no arguments which returns the current ilisp buffer")
|
|
35
|
|
36
|
|
37 ;;;%Buffer and process selection
|
|
38 (defun ilisp-buffer ()
|
|
39 "Return the current ILISP buffer. This is the buffer to whose process requests are sent."
|
|
40 (if (memq major-mode ilisp-modes)
|
|
41 (current-buffer)
|
|
42 (let ((buffer (funcall ilisp-buffer-function)))
|
|
43 (or buffer
|
|
44 (error "You must start an inferior LISP with run-ilisp.")))))
|
|
45
|
|
46
|
|
47 (defun ilisp-recent-buffer ()
|
|
48 "Return the most-recently selected ilisp buffer."
|
|
49 (if ilisp-buffer
|
|
50 (or (get-buffer ilisp-buffer)
|
|
51 (get-buffer
|
|
52 (setq ilisp-buffers
|
|
53 (lisp-del (substring ilisp-buffer 1
|
|
54 (1- (length ilisp-buffer)))
|
|
55 ilisp-buffers
|
|
56 (function (lambda (s1 s2)
|
|
57 (string= s1 (car s2)))))
|
|
58 ilisp-buffer
|
|
59 (format "*%s*" (car (car ilisp-buffers))))))))
|
|
60
|
|
61
|
|
62 ;;;
|
|
63 (defun select-ilisp ()
|
|
64 "Select the current ILISP buffer."
|
|
65 (interactive)
|
|
66 (let ((new (completing-read
|
|
67 (if ilisp-buffer
|
|
68 (format "Buffer [%s]: "
|
|
69 (substring ilisp-buffer 1
|
|
70 (1- (length ilisp-buffer))))
|
|
71 "Buffer: ")
|
|
72 ilisp-buffers nil t)))
|
|
73 (if (not (zerop (length new)))
|
|
74 (setq ilisp-buffer (format "*%s*" new)))))
|