annotate lisp/comint/inf-lisp.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children 0293115a14e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; inf-lisp.el --- an inferior-lisp mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;; Copyright (C) 1988, 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Author: Olin Shivers <shivers@cs.cmu.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: processes, lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; along with XEmacs; see the file COPYING. If not, write to the Free
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; Synched up with: FSF 19.30.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Hacked from tea.el by Olin Shivers (shivers@cs.cmu.edu). 8/88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; This file defines a a lisp-in-a-buffer package (inferior-lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; mode) built on top of comint mode. This version is more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; featureful, robust, and uniform than the Emacs 18 version. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; key bindings are also more compatible with the bindings of Hemlock
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; and Zwei (the Lisp Machine emacs).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; Since this mode is built on top of the general command-interpreter-in-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;; a-buffer mode (comint mode), it shares a common base functionality,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;; and a common set of bindings, with all modes derived from comint mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;; This makes these modes easier to use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;;; For documentation on the functionality provided by comint mode, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;;; the hooks available for customizing it, see the file comint.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;; For further information on inferior-lisp mode, see the comments below.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;; Needs fixin:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;;; The load-file/compile-file default mechanism could be smarter -- it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;; doesn't know about the relationship between filename extensions and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;;; whether the file is source or executable. If you compile foo.lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;;; with compile-file, then the next load-file should use foo.bin for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;; the default, not foo.lisp. This is tricky to do right, particularly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;;; because the extension for executable files varies so much (.o, .bin,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;;; .lbin, .mo, .vo, .ao, ...).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;;; It would be nice if inferior-lisp (and inferior scheme, T, ...) modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;;; had a verbose minor mode wherein sending or compiling defuns, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;;; would be reflected in the transcript with suitable comments, e.g.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;;; ";;; redefining fact". Several ways to do this. Which is right?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;;; When sending text from a source file to a subprocess, the process-mark can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;;; move off the window, so you can lose sight of the process interactions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;;; Maybe I should ensure the process mark is in the window when I send
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;;; text to the process? Switch selectable?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (require 'comint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (require 'lisp-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;;;jwz: ilisp is better, don't ###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (defvar inferior-lisp-filter-regexp "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 "*What not to save on inferior Lisp's input history.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 Input matching this regexp is not saved on the input history in Inferior Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 \(as in :a, :c, etc.)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (defvar inferior-lisp-mode-map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (cond ((not inferior-lisp-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (setq inferior-lisp-mode-map (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (set-keymap-name inferior-lisp-mode-map 'inferior-lisp-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (set-keymap-parents inferior-lisp-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (list comint-mode-map shared-lisp-mode-map))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (define-key inferior-lisp-mode-map "\C-x\C-e" 'lisp-eval-last-sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (define-key inferior-lisp-mode-map "\C-c\C-l" 'lisp-load-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (define-key inferior-lisp-mode-map "\C-c\C-k" 'lisp-compile-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (define-key inferior-lisp-mode-map "\C-c\C-a" 'lisp-show-arglist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (define-key inferior-lisp-mode-map "\C-c\C-d" 'lisp-describe-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (define-key inferior-lisp-mode-map "\C-c\C-f"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 'lisp-show-function-documentation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (define-key inferior-lisp-mode-map "\C-c\C-v"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 'lisp-show-variable-documentation)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;;; These commands augment Lisp mode, so you can process Lisp code in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ;;; the source files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (define-key lisp-mode-map "\M-\C-x" 'lisp-eval-defun) ; Gnu convention
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (define-key lisp-mode-map "\C-x\C-e" 'lisp-eval-last-sexp) ; Gnu convention
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (define-key lisp-mode-map "\C-c\C-e" 'lisp-eval-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (define-key lisp-mode-map "\C-c\C-r" 'lisp-eval-region)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (define-key lisp-mode-map "\C-c\C-c" 'lisp-compile-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (define-key lisp-mode-map "\C-c\C-z" 'switch-to-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (define-key lisp-mode-map "\C-c\C-l" 'lisp-load-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (define-key lisp-mode-map "\C-c\C-k" 'lisp-compile-file) ; "kompile" file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (define-key lisp-mode-map "\C-c\C-a" 'lisp-show-arglist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (define-key lisp-mode-map "\C-c\C-d" 'lisp-describe-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (define-key lisp-mode-map "\C-c\C-f" 'lisp-show-function-documentation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (define-key lisp-mode-map "\C-c\C-v" 'lisp-show-variable-documentation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ;;; This function exists for backwards compatibility.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ;;; Previous versions of this package bound commands to C-c <letter>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ;;; bindings, which is not allowed by the gnumacs standard.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ;;; "This function binds many inferior-lisp commands to C-c <letter> bindings,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;;;where they are more accessible. C-c <letter> bindings are reserved for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;;;user, so these bindings are non-standard. If you want them, you should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;;;have this function called by the inferior-lisp-load-hook:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ;;; (setq inferior-lisp-load-hook '(inferior-lisp-install-letter-bindings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;;;You can modify this function to install just the bindings you want."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (defun inferior-lisp-install-letter-bindings ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (define-key lisp-mode-map "\C-ce" 'lisp-eval-defun-and-go)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (define-key lisp-mode-map "\C-cr" 'lisp-eval-region-and-go)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (define-key lisp-mode-map "\C-cc" 'lisp-compile-defun-and-go)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (define-key lisp-mode-map "\C-cz" 'switch-to-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (define-key lisp-mode-map "\C-cl" 'lisp-load-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (define-key lisp-mode-map "\C-ck" 'lisp-compile-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (define-key lisp-mode-map "\C-ca" 'lisp-show-arglist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (define-key lisp-mode-map "\C-cd" 'lisp-describe-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (define-key lisp-mode-map "\C-cf" 'lisp-show-function-documentation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (define-key lisp-mode-map "\C-cv" 'lisp-show-variable-documentation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (define-key inferior-lisp-mode-map "\C-cl" 'lisp-load-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (define-key inferior-lisp-mode-map "\C-ck" 'lisp-compile-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (define-key inferior-lisp-mode-map "\C-ca" 'lisp-show-arglist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (define-key inferior-lisp-mode-map "\C-cd" 'lisp-describe-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (define-key inferior-lisp-mode-map "\C-cf" 'lisp-show-function-documentation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (define-key inferior-lisp-mode-map "\C-cv"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 'lisp-show-variable-documentation))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ;;;jwz: ilisp is better, don't ###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (defvar inferior-lisp-program "lisp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 "*Program name for invoking an inferior Lisp with for Inferior Lisp mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;;;jwz: ilisp is better, don't ###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (defvar inferior-lisp-load-command "(load \"%s\")\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 "*Format-string for building a Lisp expression to load a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 This format string should use `%s' to substitute a file name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 and should result in a Lisp expression that will command the inferior Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 to load that file. The default works acceptably on most Lisps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 The string \"(progn (load \\\"%s\\\" :verbose nil :print t) (values))\\n\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 produces cosmetically superior output for this application,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 but it works only in Common Lisp.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;;;jwz: ilisp is better, don't ###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (defvar inferior-lisp-prompt "^[^> \n]*>+:? *"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 "Regexp to recognise prompts in the Inferior Lisp mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 Defaults to \"^[^> \\n]*>+:? *\", which works pretty good for Lucid, kcl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 and franz. This variable is used to initialize `comint-prompt-regexp' in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 Inferior Lisp buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 More precise choices:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 Lucid Common Lisp: \"^\\\\(>\\\\|\\\\(->\\\\)+\\\\) *\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 franz: \"^\\\\(->\\\\|<[0-9]*>:\\\\) *\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 kcl: \"^>+ *\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 This is a fine thing to set in your .emacs file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (defvar inferior-lisp-buffer nil "*The current inferior-lisp process buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 MULTIPLE PROCESS SUPPORT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ===========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 To run multiple Lisp processes, you start the first up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 with \\[inferior-lisp]. It will be in a buffer named `*inferior-lisp*'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 Rename this buffer with \\[rename-buffer]. You may now start up a new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 process with another \\[inferior-lisp]. It will be in a new buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 named `*inferior-lisp*'. You can switch between the different process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 buffers with \\[switch-to-buffer].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 Commands that send text from source buffers to Lisp processes --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 like `lisp-eval-defun' or `lisp-show-arglist' -- have to choose a process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 to send to, when you have more than one Lisp process around. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 is determined by the global variable `inferior-lisp-buffer'. Suppose you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 have three inferior Lisps running:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 Buffer Process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 foo inferior-lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 bar inferior-lisp<2>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 *inferior-lisp* inferior-lisp<3>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 If you do a \\[lisp-eval-defun] command on some Lisp source code,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 what process do you send it to?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 - If you're in a process buffer (foo, bar, or *inferior-lisp*),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 you send it to that process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 - If you're in some other buffer (e.g., a source file), you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 send it to the process attached to buffer `inferior-lisp-buffer'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 This process selection is performed by function `inferior-lisp-proc'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 Whenever \\[inferior-lisp] fires up a new process, it resets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 `inferior-lisp-buffer' to be the new process's buffer. If you only run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 one process, this does the right thing. If you run multiple
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 processes, you can change `inferior-lisp-buffer' to another process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 buffer with \\[set-variable].")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ;;;jwz: ilisp is better, don't ###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (defvar inferior-lisp-mode-hook '()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 "*Hook for customizing Inferior Lisp mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (defun inferior-lisp-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 "Major mode for interacting with an inferior Lisp process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 Runs a Lisp interpreter as a subprocess of Emacs, with Lisp I/O through an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 Emacs buffer. Variable `inferior-lisp-program' controls which Lisp interpreter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 is run. Variables `inferior-lisp-prompt', `inferior-lisp-filter-regexp' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 `inferior-lisp-load-command' can customize this mode for different Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 interpreters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 For information on running multiple processes in multiple buffers, see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 documentation for variable `inferior-lisp-buffer'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 \\{inferior-lisp-mode-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 Customization: Entry to this mode runs the hooks on `comint-mode-hook' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 `inferior-lisp-mode-hook' (in that order).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 You can send text to the inferior Lisp process from other buffers containing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 Lisp source.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 switch-to-lisp switches the current buffer to the Lisp process buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 lisp-eval-defun sends the current defun to the Lisp process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 lisp-compile-defun compiles the current defun.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 lisp-eval-region sends the current region to the Lisp process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 lisp-compile-region compiles the current region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 Prefixing the lisp-eval/compile-defun/region commands with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 a \\[universal-argument] causes a switch to the Lisp process buffer after sending
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 the text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 Commands:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 Return after the end of the process' output sends the text from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 end of process to point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 Return before the end of the process' output copies the sexp ending at point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 to the end of the process' output, and sends it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 Delete converts tabs to spaces as it moves back.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 Tab indents for Lisp; with argument, shifts rest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 of expression rigidly with the current line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 C-M-q does Tab on each line starting within following expression.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 Paragraphs are separated only by blank lines. Semicolons start comments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 If you accidentally suspend your process, use \\[comint-continue-subjob]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 to continue it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (comint-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (setq comint-prompt-regexp inferior-lisp-prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (setq major-mode 'inferior-lisp-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (setq mode-name "Inferior Lisp")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (setq mode-line-process '(":%s"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (lisp-mode-variables t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (use-local-map inferior-lisp-mode-map) ;c-c c-k for "kompile" file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (setq comint-get-old-input (function lisp-get-old-input))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (setq comint-input-filter (function lisp-input-filter))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (setq comint-input-sentinel 'ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (run-hooks 'inferior-lisp-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (defun lisp-get-old-input ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 "Return a string containing the sexp ending at point."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (let ((end (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (backward-sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (buffer-substring (point) end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (defun lisp-input-filter (str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 "t if STR does not match `inferior-lisp-filter-regexp'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (not (string-match inferior-lisp-filter-regexp str)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;;;jwz: ilisp is better, don't ###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (defun inferior-lisp (cmd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 "Run an inferior Lisp process, input and output via buffer `*inferior-lisp*'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 If there is a process already running in `*inferior-lisp*', just switch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 to that buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 With argument, allows you to edit the command line (default is value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 of `inferior-lisp-program'). Runs the hooks from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 `inferior-lisp-mode-hook' (after the `comint-mode-hook' is run).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 \(Type \\[describe-mode] in the process buffer for a list of commands.)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (interactive (list (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (read-string "Run lisp: " inferior-lisp-program)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 inferior-lisp-program)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (if (not (comint-check-proc "*inferior-lisp*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (let ((cmdlist (inferior-lisp-args-to-list cmd)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (set-buffer (apply (function make-comint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 "inferior-lisp" (car cmdlist) nil (cdr cmdlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (inferior-lisp-mode)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (setq inferior-lisp-buffer "*inferior-lisp*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (pop-to-buffer "*inferior-lisp*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 ;;;###autoload (add-hook 'same-window-buffer-names "*inferior-lisp*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 ;;;jwz: ilisp is better, don't ###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (define-function 'run-lisp 'inferior-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 ;;; Break a string up into a list of arguments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ;;; This will break if you have an argument with whitespace, as in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ;;; string = "-ab +c -x 'you lose'".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (defun inferior-lisp-args-to-list (string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (let ((where (string-match "[ \t]" string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (cond ((null where) (list string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ((not (= where 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (cons (substring string 0 where)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (inferior-lisp-args-to-list (substring string (+ 1 where)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (length string)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (t (let ((pos (string-match "[^ \t]" string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (if (null pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (inferior-lisp-args-to-list (substring string pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (length string)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (defun lisp-eval-region (start end &optional and-go)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 "Send the current region to the inferior Lisp process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 Prefix argument means switch to the Lisp buffer afterwards."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (interactive "r\nP")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (comint-send-region (inferior-lisp-proc) start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (comint-send-string (inferior-lisp-proc) "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (if and-go (switch-to-lisp t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (defun lisp-eval-defun (&optional and-go)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 "Send the current defun to the inferior Lisp process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 Prefix argument means switch to the Lisp buffer afterwards."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (end-of-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (skip-chars-backward " \t\n\r\f") ; Makes allegro happy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (let ((end (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (beginning-of-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (lisp-eval-region (point) end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (if and-go (switch-to-lisp t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (defun lisp-eval-last-sexp (&optional and-go)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 "Send the previous sexp to the inferior Lisp process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 Prefix argument means switch to the Lisp buffer afterwards."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (lisp-eval-region (save-excursion (backward-sexp) (point)) (point) and-go))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 ;;; Common Lisp COMPILE sux.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (defun lisp-compile-region (start end &optional and-go)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 "Compile the current region in the inferior Lisp process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 Prefix argument means switch to the Lisp buffer afterwards."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (interactive "r\nP")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (comint-send-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (inferior-lisp-proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (format "(funcall (compile nil `(lambda () (progn 'compile %s))))\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (buffer-substring start end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (if and-go (switch-to-lisp t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (defun lisp-compile-defun (&optional and-go)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 "Compile the current defun in the inferior Lisp process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 Prefix argument means switch to the Lisp buffer afterwards."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (end-of-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (skip-chars-backward " \t\n\r\f") ; Makes allegro happy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (let ((e (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (beginning-of-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (lisp-compile-region (point) e)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (if and-go (switch-to-lisp t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (defun switch-to-lisp (eob-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 "Switch to the inferior Lisp process buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 With argument, positions cursor at end of buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (if (get-buffer inferior-lisp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (pop-to-buffer inferior-lisp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (error "No current inferior Lisp buffer"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (cond (eob-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (push-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (goto-char (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 ;;; Now that lisp-compile/eval-defun/region takes an optional prefix arg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 ;;; these commands are redundant. But they are kept around for the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;;; to bind if he wishes, for backwards functionality, and because it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 ;;; easier to type C-c e than C-u C-c C-e.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (defun lisp-eval-region-and-go (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 "Send the current region to the inferior Lisp, and switch to its buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (lisp-eval-region start end t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (defun lisp-eval-defun-and-go ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 "Send the current defun to the inferior Lisp, and switch to its buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (lisp-eval-defun t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (defun lisp-compile-region-and-go (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 "Compile the current region in the inferior Lisp, and switch to its buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (lisp-compile-region start end t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (defun lisp-compile-defun-and-go ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 "Compile the current defun in the inferior Lisp, and switch to its buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (lisp-compile-defun t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ;;; A version of the form in H. Shevis' soar-mode.el package. Less robust.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 ;;; (defun lisp-compile-sexp (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 ;;; "Compile the s-expression bounded by START and END in the inferior lisp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ;;; If the sexp isn't a DEFUN form, it is evaluated instead."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 ;;; (cond ((looking-at "(defun\\s +")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ;;; (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 ;;; (let ((name-start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ;;; (forward-sexp 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 ;;; (process-send-string "inferior-lisp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ;;; (format "(compile '%s #'(lambda "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 ;;; (buffer-substring name-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ;;; (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 ;;; (let ((body-start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 ;;; (goto-char start) (forward-sexp 1) ; Can't use end-of-defun.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 ;;; (process-send-region "inferior-lisp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 ;;; (buffer-substring body-start (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 ;;; (process-send-string "inferior-lisp" ")\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 ;;; (t (lisp-eval-region start end)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 ;;; (defun lisp-compile-region (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 ;;; "Each s-expression in the current region is compiled (if a DEFUN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 ;;; or evaluated (if not) in the inferior lisp."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 ;;; (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 ;;; (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 ;;; (goto-char start) (end-of-defun) (beginning-of-defun) ; error check
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 ;;; (if (< (point) start) (error "region begins in middle of defun"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 ;;; (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 ;;; (let ((s start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ;;; (end-of-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 ;;; (while (<= (point) end) ; Zip through
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 ;;; (lisp-compile-sexp s (point)) ; compiling up defun-sized chunks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 ;;; (setq s (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 ;;; (end-of-defun))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 ;;; (if (< s end) (lisp-compile-sexp s end)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 ;;; End of HS-style code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (defvar lisp-prev-l/c-dir/file nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 "Record last directory and file used in loading or compiling.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 This holds a cons cell of the form `(DIRECTORY . FILE)'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 describing the last `lisp-load-file' or `lisp-compile-file' command.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (defvar lisp-source-modes '(lisp-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 "*Used to determine if a buffer contains Lisp source code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 If it's loaded into a buffer that is in one of these major modes, it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 considered a Lisp source file by `lisp-load-file' and `lisp-compile-file'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 Used by these commands to determine defaults.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (defun lisp-load-file (file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 "Load a Lisp file into the inferior Lisp process."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (interactive (comint-get-source "Load Lisp file: " lisp-prev-l/c-dir/file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 lisp-source-modes nil)) ; NIL because LOAD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 ; doesn't need an exact name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (comint-check-source file-name) ; Check to see if buffer needs saved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (setq lisp-prev-l/c-dir/file (cons (file-name-directory file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (file-name-nondirectory file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (comint-send-string (inferior-lisp-proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (format inferior-lisp-load-command file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (switch-to-lisp t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (defun lisp-compile-file (file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 "Compile a Lisp file in the inferior Lisp process."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (interactive (comint-get-source "Compile Lisp file: " lisp-prev-l/c-dir/file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 lisp-source-modes nil)) ; NIL = don't need
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 ; suffix .lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (comint-check-source file-name) ; Check to see if buffer needs saved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (setq lisp-prev-l/c-dir/file (cons (file-name-directory file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (file-name-nondirectory file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (comint-send-string (inferior-lisp-proc) (concat "(compile-file \""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 "\"\)\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (switch-to-lisp t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 ;;; Documentation functions: function doc, var doc, arglist, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 ;;; describe symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 ;;; ===========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 ;;; Command strings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 ;;; ===============
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (defvar lisp-function-doc-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 "(let ((fn '%s))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (format t \"Documentation for ~a:~&~a\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 fn (documentation fn 'function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (values))\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 "Command to query inferior Lisp for a function's documentation.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (defvar lisp-var-doc-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 "(let ((v '%s))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (format t \"Documentation for ~a:~&~a\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 v (documentation v 'variable))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (values))\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 "Command to query inferior Lisp for a variable's documentation.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (defvar lisp-arglist-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 "(let ((fn '%s))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (format t \"Arglist for ~a: ~a\" fn (arglist fn))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (values))\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 "Command to query inferior Lisp for a function's arglist.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (defvar lisp-describe-sym-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 "(describe '%s)\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 "Command to query inferior Lisp for a variable's documentation.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 ;;; Ancillary functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 ;;; ===================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 ;;; Reads a string from the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (defun lisp-symprompt (prompt default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (list (let* ((prompt (if default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (format "%s (default %s): " prompt default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (concat prompt ": ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (ans (read-string prompt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (if (zerop (length ans)) default ans))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 ;;; Adapted from function-called-at-point in help.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (defun lisp-fn-called-at-pt ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 "Returns the name of the function called in the current call.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 The value is nil if it can't find one."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (narrow-to-region (max (point-min) (- (point) 1000)) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (backward-up-list 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (let ((obj (read (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (and (symbolp obj) obj))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 ;;; Adapted from variable-at-point in help.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (defun lisp-var-at-pt ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (forward-sexp -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (skip-chars-forward "'")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (let ((obj (read (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (and (symbolp obj) obj)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 ;;; Documentation functions: fn and var doc, arglist, and symbol describe.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ;;; ======================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (defun lisp-show-function-documentation (fn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 "Send a command to the inferior Lisp to give documentation for function FN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 See variable `lisp-function-doc-command'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (interactive (lisp-symprompt "Function doc" (lisp-fn-called-at-pt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (comint-proc-query (inferior-lisp-proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (format lisp-function-doc-command fn)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (defun lisp-show-variable-documentation (var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 "Send a command to the inferior Lisp to give documentation for function FN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 See variable `lisp-var-doc-command'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (interactive (lisp-symprompt "Variable doc" (lisp-var-at-pt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (comint-proc-query (inferior-lisp-proc) (format lisp-var-doc-command var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (defun lisp-show-arglist (fn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 "Send a query to the inferior Lisp for the arglist for function FN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 See variable `lisp-arglist-command'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (interactive (lisp-symprompt "Arglist" (lisp-fn-called-at-pt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (comint-proc-query (inferior-lisp-proc) (format lisp-arglist-command fn)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (defun lisp-describe-sym (sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 "Send a command to the inferior Lisp to describe symbol SYM.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 See variable `lisp-describe-sym-command'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (interactive (lisp-symprompt "Describe" (lisp-var-at-pt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (comint-proc-query (inferior-lisp-proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (format lisp-describe-sym-command sym)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 ;; "Returns the current inferior Lisp process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ;; See variable `inferior-lisp-buffer'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (defun inferior-lisp-proc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (let ((proc (get-buffer-process (if (eq major-mode 'inferior-lisp-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (current-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 inferior-lisp-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (or proc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (error "No Lisp subprocess; see variable `inferior-lisp-buffer'"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 ;;; Do the user's customization...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 ;;;===============================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (defvar inferior-lisp-load-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 "This hook is run when the library `inf-lisp' is loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 This is a good place to put keybindings.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (run-hooks 'inferior-lisp-load-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 ;;; CHANGE LOG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 ;;; ===========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 ;;; 7/21/92 Jim Blandy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 ;;; - Changed all uses of the cmulisp name or prefix to inferior-lisp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 ;;; this is now the official inferior lisp package. Use the global
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 ;;; ChangeLog from now on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 ;;; 5/24/90 Olin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 ;;; - Split cmulisp and cmushell modes into separate files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 ;;; Not only is this a good idea, it's apparently the way it'll be rel 19.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 ;;; - Upgraded process sends to use comint-send-string instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 ;;; process-send-string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 ;;; - Explicit references to process "cmulisp" have been replaced with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 ;;; (cmulisp-proc). This allows better handling of multiple process bufs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 ;;; - Added process query and var/function/symbol documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 ;;; commands. Based on code written by Douglas Roberts.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 ;;; - Added lisp-eval-last-sexp, bound to C-x C-e.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 ;;; 9/20/90 Olin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 ;;; Added a save-restriction to lisp-fn-called-at-pt. This bug and fix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 ;;; reported by Lennart Staflin.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 ;;; 3/12/90 Olin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 ;;; - lisp-load-file and lisp-compile-file no longer switch-to-lisp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 ;;; Tale suggested this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 ;;; - Reversed this decision 7/15/91. You need the visual feedback.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 ;;; 7/25/91 Olin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 ;;; Changed all keybindings of the form C-c <letter>. These are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 ;;; supposed to be reserved for the user to bind. This affected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 ;;; mainly the compile/eval-defun/region[-and-go] commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 ;;; This was painful, but necessary to adhere to the gnumacs standard.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 ;;; For some backwards compatibility, see the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 ;;; cmulisp-install-letter-bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 ;;; function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 ;;; 8/2/91 Olin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 ;;; - The lisp-compile/eval-defun/region commands now take a prefix arg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 ;;; which means switch-to-lisp after sending the text to the Lisp process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 ;;; This obsoletes all the -and-go commands. The -and-go commands are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;;; kept around for historical reasons, and because the user can bind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 ;;; them to key sequences shorter than C-u C-c C-<letter>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 ;;; - If M-x cmulisp is invoked with a prefix arg, it allows you to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 ;;; edit the command line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (provide 'inf-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ;;; inf-lisp.el ends here