annotate lisp/comint/inf-lisp.el @ 123:c77884c6318d

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