1 ;;; inf-lisp.el --- an inferior-lisp mode
3 ;; Copyright (C) 1988, 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 ;; Free Software Foundation, Inc.
6 ;; Author: Olin Shivers <shivers@cs.cmu.edu>
7 ;; Keywords: processes, lisp
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; Hacked from tea.el by Olin Shivers (shivers@cs.cmu.edu). 8/88
28 ;; This file defines a lisp-in-a-buffer package (inferior-lisp mode)
29 ;; built on top of comint mode. This version is more featureful,
30 ;; robust, and uniform than the Emacs 18 version. The key bindings are
31 ;; also more compatible with the bindings of Hemlock and Zwei (the
32 ;; Lisp Machine emacs).
34 ;; Since this mode is built on top of the general command-interpreter-in-
35 ;; a-buffer mode (comint mode), it shares a common base functionality,
36 ;; and a common set of bindings, with all modes derived from comint mode.
37 ;; This makes these modes easier to use.
39 ;; For documentation on the functionality provided by comint mode, and
40 ;; the hooks available for customising it, see the file comint.el.
41 ;; For further information on inferior-lisp mode, see the comments below.
44 ;; The load-file/compile-file default mechanism could be smarter -- it
45 ;; doesn't know about the relationship between filename extensions and
46 ;; whether the file is source or executable. If you compile foo.lisp
47 ;; with compile-file, then the next load-file should use foo.bin for
48 ;; the default, not foo.lisp. This is tricky to do right, particularly
49 ;; because the extension for executable files varies so much (.o, .bin,
50 ;; .lbin, .mo, .vo, .ao, ...).
52 ;; It would be nice if inferior-lisp (and inferior scheme, T, ...) modes
53 ;; had a verbose minor mode wherein sending or compiling defuns, etc.
54 ;; would be reflected in the transcript with suitable comments, e.g.
55 ;; ";;; redefining fact". Several ways to do this. Which is right?
57 ;; When sending text from a source file to a subprocess, the process-mark can
58 ;; move off the window, so you can lose sight of the process interactions.
59 ;; Maybe I should ensure the process mark is in the window when I send
60 ;; text to the process? Switch selectable?
68 (defgroup inferior-lisp nil
69 "Run an outside Lisp in an Emacs buffer."
74 (defcustom inferior-lisp-filter-regexp
75 (purecopy "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'")
76 "*What not to save on inferior Lisp's input history.
77 Input matching this regexp is not saved on the input history in Inferior Lisp
78 mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword
79 \(as in :a, :c, etc.)"
81 :group
'inferior-lisp
)
83 (defvar inferior-lisp-mode-map
84 (let ((map (copy-keymap comint-mode-map
)))
85 (set-keymap-parent map lisp-mode-shared-map
)
86 (define-key map
"\C-x\C-e" 'lisp-eval-last-sexp
)
87 (define-key map
"\C-c\C-l" 'lisp-load-file
)
88 (define-key map
"\C-c\C-k" 'lisp-compile-file
)
89 (define-key map
"\C-c\C-a" 'lisp-show-arglist
)
90 (define-key map
"\C-c\C-d" 'lisp-describe-sym
)
91 (define-key map
"\C-c\C-f" 'lisp-show-function-documentation
)
92 (define-key map
"\C-c\C-v" 'lisp-show-variable-documentation
)
95 ;;; These commands augment Lisp mode, so you can process Lisp code in
97 (define-key lisp-mode-map
"\M-\C-x" 'lisp-eval-defun
) ; Gnu convention
98 (define-key lisp-mode-map
"\C-x\C-e" 'lisp-eval-last-sexp
) ; Gnu convention
99 (define-key lisp-mode-map
"\C-c\C-e" 'lisp-eval-defun
)
100 (define-key lisp-mode-map
"\C-c\C-r" 'lisp-eval-region
)
101 (define-key lisp-mode-map
"\C-c\C-c" 'lisp-compile-defun
)
102 (define-key lisp-mode-map
"\C-c\C-z" 'switch-to-lisp
)
103 (define-key lisp-mode-map
"\C-c\C-l" 'lisp-load-file
)
104 (define-key lisp-mode-map
"\C-c\C-k" 'lisp-compile-file
) ; "kompile" file
105 (define-key lisp-mode-map
"\C-c\C-a" 'lisp-show-arglist
)
106 (define-key lisp-mode-map
"\C-c\C-d" 'lisp-describe-sym
)
107 (define-key lisp-mode-map
"\C-c\C-f" 'lisp-show-function-documentation
)
108 (define-key lisp-mode-map
"\C-c\C-v" 'lisp-show-variable-documentation
)
111 ;;; This function exists for backwards compatibility.
112 ;;; Previous versions of this package bound commands to C-c <letter>
113 ;;; bindings, which is not allowed by the gnumacs standard.
115 ;;; "This function binds many inferior-lisp commands to C-c <letter> bindings,
116 ;;;where they are more accessible. C-c <letter> bindings are reserved for the
117 ;;;user, so these bindings are non-standard. If you want them, you should
118 ;;;have this function called by the inferior-lisp-load-hook:
119 ;;; (add-hook 'inferior-lisp-load-hook 'inferior-lisp-install-letter-bindings)
120 ;;;You can modify this function to install just the bindings you want."
121 (defun inferior-lisp-install-letter-bindings ()
122 (define-key lisp-mode-map
"\C-ce" 'lisp-eval-defun-and-go
)
123 (define-key lisp-mode-map
"\C-cr" 'lisp-eval-region-and-go
)
124 (define-key lisp-mode-map
"\C-cc" 'lisp-compile-defun-and-go
)
125 (define-key lisp-mode-map
"\C-cz" 'switch-to-lisp
)
126 (define-key lisp-mode-map
"\C-cl" 'lisp-load-file
)
127 (define-key lisp-mode-map
"\C-ck" 'lisp-compile-file
)
128 (define-key lisp-mode-map
"\C-ca" 'lisp-show-arglist
)
129 (define-key lisp-mode-map
"\C-cd" 'lisp-describe-sym
)
130 (define-key lisp-mode-map
"\C-cf" 'lisp-show-function-documentation
)
131 (define-key lisp-mode-map
"\C-cv" 'lisp-show-variable-documentation
)
133 (define-key inferior-lisp-mode-map
"\C-cl" 'lisp-load-file
)
134 (define-key inferior-lisp-mode-map
"\C-ck" 'lisp-compile-file
)
135 (define-key inferior-lisp-mode-map
"\C-ca" 'lisp-show-arglist
)
136 (define-key inferior-lisp-mode-map
"\C-cd" 'lisp-describe-sym
)
137 (define-key inferior-lisp-mode-map
"\C-cf" 'lisp-show-function-documentation
)
138 (define-key inferior-lisp-mode-map
"\C-cv"
139 'lisp-show-variable-documentation
))
142 (defcustom inferior-lisp-program
(purecopy "lisp")
143 "*Program name for invoking an inferior Lisp in Inferior Lisp mode."
145 :group
'inferior-lisp
)
148 (defcustom inferior-lisp-load-command
(purecopy "(load \"%s\")\n")
149 "*Format-string for building a Lisp expression to load a file.
150 This format string should use `%s' to substitute a file name
151 and should result in a Lisp expression that will command the inferior Lisp
152 to load that file. The default works acceptably on most Lisps.
153 The string \"(progn (load \\\"%s\\\" :verbose nil :print t) (values))\\n\"
154 produces cosmetically superior output for this application,
155 but it works only in Common Lisp."
157 :group
'inferior-lisp
)
160 (defcustom inferior-lisp-prompt
(purecopy "^[^> \n]*>+:? *")
161 "Regexp to recognize prompts in the Inferior Lisp mode.
162 Defaults to \"^[^> \\n]*>+:? *\", which works pretty good for Lucid, kcl,
163 and franz. This variable is used to initialize `comint-prompt-regexp' in the
164 Inferior Lisp buffer.
166 This variable is only used if the variable
167 `comint-use-prompt-regexp' is non-nil.
169 More precise choices:
170 Lucid Common Lisp: \"^\\\\(>\\\\|\\\\(->\\\\)+\\\\) *\"
171 franz: \"^\\\\(->\\\\|<[0-9]*>:\\\\) *\"
174 This is a fine thing to set in your .emacs file or through Custom."
176 :group
'inferior-lisp
)
178 (defvar inferior-lisp-buffer nil
"*The current inferior-lisp process buffer.
180 MULTIPLE PROCESS SUPPORT
181 ===========================================================================
182 To run multiple Lisp processes, you start the first up
183 with \\[inferior-lisp]. It will be in a buffer named `*inferior-lisp*'.
184 Rename this buffer with \\[rename-buffer]. You may now start up a new
185 process with another \\[inferior-lisp]. It will be in a new buffer,
186 named `*inferior-lisp*'. You can switch between the different process
187 buffers with \\[switch-to-buffer].
189 Commands that send text from source buffers to Lisp processes --
190 like `lisp-eval-defun' or `lisp-show-arglist' -- have to choose a process
191 to send to, when you have more than one Lisp process around. This
192 is determined by the global variable `inferior-lisp-buffer'. Suppose you
193 have three inferior Lisps running:
197 *inferior-lisp* inferior-lisp<3>
198 If you do a \\[lisp-eval-defun] command on some Lisp source code,
199 what process do you send it to?
201 - If you're in a process buffer (foo, bar, or *inferior-lisp*),
202 you send it to that process.
203 - If you're in some other buffer (e.g., a source file), you
204 send it to the process attached to buffer `inferior-lisp-buffer'.
205 This process selection is performed by function `inferior-lisp-proc'.
207 Whenever \\[inferior-lisp] fires up a new process, it resets
208 `inferior-lisp-buffer' to be the new process's buffer. If you only run
209 one process, this does the right thing. If you run multiple
210 processes, you can change `inferior-lisp-buffer' to another process
211 buffer with \\[set-variable].")
214 (defvar inferior-lisp-mode-hook
'()
215 "*Hook for customizing Inferior Lisp mode.")
217 (put 'inferior-lisp-mode
'mode-class
'special
)
219 (defun inferior-lisp-mode ()
220 "Major mode for interacting with an inferior Lisp process.
221 Runs a Lisp interpreter as a subprocess of Emacs, with Lisp I/O through an
222 Emacs buffer. Variable `inferior-lisp-program' controls which Lisp interpreter
223 is run. Variables `inferior-lisp-prompt', `inferior-lisp-filter-regexp' and
224 `inferior-lisp-load-command' can customize this mode for different Lisp
227 For information on running multiple processes in multiple buffers, see
228 documentation for variable `inferior-lisp-buffer'.
230 \\{inferior-lisp-mode-map}
232 Customization: Entry to this mode runs the hooks on `comint-mode-hook' and
233 `inferior-lisp-mode-hook' (in that order).
235 You can send text to the inferior Lisp process from other buffers containing
237 `switch-to-lisp' switches the current buffer to the Lisp process buffer.
238 `lisp-eval-defun' sends the current defun to the Lisp process.
239 `lisp-compile-defun' compiles the current defun.
240 `lisp-eval-region' sends the current region to the Lisp process.
241 `lisp-compile-region' compiles the current region.
243 Prefixing the lisp-eval/compile-defun/region commands with
244 a \\[universal-argument] causes a switch to the Lisp process buffer after sending
247 Commands:\\<inferior-lisp-mode-map>
248 \\[comint-send-input] after the end of the process' output sends the text from the
249 end of process to point.
250 \\[comint-send-input] before the end of the process' output copies the sexp ending at point
251 to the end of the process' output, and sends it.
252 \\[comint-copy-old-input] copies the sexp ending at point to the end of the process' output,
253 allowing you to edit it before sending it.
254 If `comint-use-prompt-regexp' is nil (the default), \\[comint-insert-input] on old input
255 copies the entire old input to the end of the process' output, allowing
256 you to edit it before sending it. When not used on old input, or if
257 `comint-use-prompt-regexp' is non-nil, \\[comint-insert-input] behaves according to
259 \\[backward-delete-char-untabify] converts tabs to spaces as it moves back.
260 \\[lisp-indent-line] indents for Lisp; with argument, shifts rest
261 of expression rigidly with the current line.
262 \\[indent-sexp] does \\[lisp-indent-line] on each line starting within following expression.
263 Paragraphs are separated only by blank lines. Semicolons start comments.
264 If you accidentally suspend your process, use \\[comint-continue-subjob]
269 (setq comint-prompt-regexp inferior-lisp-prompt
)
270 (setq major-mode
'inferior-lisp-mode
)
271 (setq mode-name
"Inferior Lisp")
272 (setq mode-line-process
'(":%s"))
273 (lisp-mode-variables t
)
274 (use-local-map inferior-lisp-mode-map
) ;c-c c-k for "kompile" file
275 (setq comint-get-old-input
(function lisp-get-old-input
))
276 (setq comint-input-filter
(function lisp-input-filter
))
277 (run-mode-hooks 'inferior-lisp-mode-hook
))
279 (defun lisp-get-old-input ()
280 "Return a string containing the sexp ending at point."
284 (buffer-substring (point) end
))))
286 (defun lisp-input-filter (str)
287 "t if STR does not match `inferior-lisp-filter-regexp'."
288 (not (string-match inferior-lisp-filter-regexp str
)))
291 (defun inferior-lisp (cmd)
292 "Run an inferior Lisp process, input and output via buffer `*inferior-lisp*'.
293 If there is a process already running in `*inferior-lisp*', just switch
295 With argument, allows you to edit the command line (default is value
296 of `inferior-lisp-program'). Runs the hooks from
297 `inferior-lisp-mode-hook' (after the `comint-mode-hook' is run).
298 \(Type \\[describe-mode] in the process buffer for a list of commands.)"
299 (interactive (list (if current-prefix-arg
300 (read-string "Run lisp: " inferior-lisp-program
)
301 inferior-lisp-program
)))
302 (if (not (comint-check-proc "*inferior-lisp*"))
303 (let ((cmdlist (split-string cmd
)))
304 (set-buffer (apply (function make-comint
)
305 "inferior-lisp" (car cmdlist
) nil
(cdr cmdlist
)))
306 (inferior-lisp-mode)))
307 (setq inferior-lisp-buffer
"*inferior-lisp*")
308 (pop-to-buffer-same-window "*inferior-lisp*"))
311 (defalias 'run-lisp
'inferior-lisp
)
313 (defun lisp-eval-region (start end
&optional and-go
)
314 "Send the current region to the inferior Lisp process.
315 Prefix argument means switch to the Lisp buffer afterwards."
317 (comint-send-region (inferior-lisp-proc) start end
)
318 (comint-send-string (inferior-lisp-proc) "\n")
319 (if and-go
(switch-to-lisp t
)))
321 (defun lisp-compile-string (string)
322 "Send the string to the inferior Lisp process to be compiled and executed."
325 (format "(funcall (compile nil (lambda () %s)))\n" string
)))
327 (defun lisp-eval-string (string)
328 "Send the string to the inferior Lisp process to be executed."
329 (comint-send-string (inferior-lisp-proc) (concat string
"\n")))
331 (defun lisp-do-defun (do-string do-region
)
332 "Send the current defun to the inferior Lisp process.
333 The actually processing is done by `do-string' and `do-region'
334 which determine whether the code is compiled before evaluation.
335 DEFVAR forms reset the variables to the init values."
338 (skip-chars-backward " \t\n\r\f") ; Makes allegro happy
339 (let ((end (point)) (case-fold-search t
))
341 (if (looking-at "(defvar")
343 ;; replace `defvar' with `defparameter'
344 (concat "(defparameter "
345 (buffer-substring-no-properties (+ (point) 7) end
)
347 (funcall do-region
(point) end
)))))
349 (defun lisp-eval-defun (&optional and-go
)
350 "Send the current defun to the inferior Lisp process.
351 DEFVAR forms reset the variables to the init values.
352 Prefix argument means switch to the Lisp buffer afterwards."
354 (lisp-do-defun 'lisp-eval-string
'lisp-eval-region
)
355 (if and-go
(switch-to-lisp t
)))
357 (defun lisp-eval-last-sexp (&optional and-go
)
358 "Send the previous sexp to the inferior Lisp process.
359 Prefix argument means switch to the Lisp buffer afterwards."
361 (lisp-eval-region (save-excursion (backward-sexp) (point)) (point) and-go
))
363 (defun lisp-compile-region (start end
&optional and-go
)
364 "Compile the current region in the inferior Lisp process.
365 Prefix argument means switch to the Lisp buffer afterwards."
367 (lisp-compile-string (buffer-substring-no-properties start end
))
368 (if and-go
(switch-to-lisp t
)))
370 (defun lisp-compile-defun (&optional and-go
)
371 "Compile the current defun in the inferior Lisp process.
372 DEFVAR forms reset the variables to the init values.
373 Prefix argument means switch to the Lisp buffer afterwards."
375 (lisp-do-defun 'lisp-compile-string
'lisp-compile-region
)
376 (if and-go
(switch-to-lisp t
)))
378 (defun switch-to-lisp (eob-p)
379 "Switch to the inferior Lisp process buffer.
380 With argument, positions cursor at end of buffer."
382 (if (get-buffer-process inferior-lisp-buffer
)
384 ;; Trying to guess what was here previously.
385 inferior-lisp-buffer
'(other-frame (reuse-buffer-window . t
) same-window
))
386 (run-lisp inferior-lisp-program
))
389 (goto-char (point-max))))
392 ;;; Now that lisp-compile/eval-defun/region takes an optional prefix arg,
393 ;;; these commands are redundant. But they are kept around for the user
394 ;;; to bind if he wishes, for backwards functionality, and because it's
395 ;;; easier to type C-c e than C-u C-c C-e.
397 (defun lisp-eval-region-and-go (start end
)
398 "Send the current region to the inferior Lisp, and switch to its buffer."
400 (lisp-eval-region start end t
))
402 (defun lisp-eval-defun-and-go ()
403 "Send the current defun to the inferior Lisp, and switch to its buffer."
407 (defun lisp-compile-region-and-go (start end
)
408 "Compile the current region in the inferior Lisp, and switch to its buffer."
410 (lisp-compile-region start end t
))
412 (defun lisp-compile-defun-and-go ()
413 "Compile the current defun in the inferior Lisp, and switch to its buffer."
415 (lisp-compile-defun t))
417 ;;; A version of the form in H. Shevis' soar-mode.el package. Less robust.
418 ;;; (defun lisp-compile-sexp (start end)
419 ;;; "Compile the s-expression bounded by START and END in the inferior lisp.
420 ;;; If the sexp isn't a DEFUN form, it is evaluated instead."
421 ;;; (cond ((looking-at "(defun\\s +")
422 ;;; (goto-char (match-end 0))
423 ;;; (let ((name-start (point)))
425 ;;; (process-send-string "inferior-lisp"
426 ;;; (format "(compile '%s #'(lambda "
427 ;;; (buffer-substring name-start
429 ;;; (let ((body-start (point)))
430 ;;; (goto-char start) (forward-sexp 1) ; Can't use end-of-defun.
431 ;;; (process-send-region "inferior-lisp"
432 ;;; (buffer-substring body-start (point))))
433 ;;; (process-send-string "inferior-lisp" ")\n"))
434 ;;; (t (lisp-eval-region start end)))))
436 ;;; (defun lisp-compile-region (start end)
437 ;;; "Each s-expression in the current region is compiled (if a DEFUN)
438 ;;; or evaluated (if not) in the inferior lisp."
439 ;;; (interactive "r")
441 ;;; (goto-char start) (end-of-defun) (beginning-of-defun) ; error check
442 ;;; (if (< (point) start) (error "region begins in middle of defun"))
443 ;;; (goto-char start)
446 ;;; (while (<= (point) end) ; Zip through
447 ;;; (lisp-compile-sexp s (point)) ; compiling up defun-sized chunks.
450 ;;; (if (< s end) (lisp-compile-sexp s end)))))
452 ;;; End of HS-style code
455 (defvar lisp-prev-l
/c-dir
/file nil
456 "Record last directory and file used in loading or compiling.
457 This holds a cons cell of the form `(DIRECTORY . FILE)'
458 describing the last `lisp-load-file' or `lisp-compile-file' command.")
460 (defcustom lisp-source-modes
'(lisp-mode)
461 "*Used to determine if a buffer contains Lisp source code.
462 If it's loaded into a buffer that is in one of these major modes, it's
463 considered a Lisp source file by `lisp-load-file' and `lisp-compile-file'.
464 Used by these commands to determine defaults."
465 :type
'(repeat symbol
)
466 :group
'inferior-lisp
)
468 (defun lisp-load-file (file-name)
469 "Load a Lisp file into the inferior Lisp process."
470 (interactive (comint-get-source "Load Lisp file: " lisp-prev-l
/c-dir
/file
471 lisp-source-modes nil
)) ; nil because LOAD
472 ; doesn't need an exact name
473 (comint-check-source file-name
) ; Check to see if buffer needs saved.
474 (setq lisp-prev-l
/c-dir
/file
(cons (file-name-directory file-name
)
475 (file-name-nondirectory file-name
)))
476 (comint-send-string (inferior-lisp-proc)
477 (format inferior-lisp-load-command file-name
))
481 (defun lisp-compile-file (file-name)
482 "Compile a Lisp file in the inferior Lisp process."
483 (interactive (comint-get-source "Compile Lisp file: " lisp-prev-l
/c-dir
/file
484 lisp-source-modes nil
)) ; nil = don't need
486 (comint-check-source file-name
) ; Check to see if buffer needs saved.
487 (setq lisp-prev-l
/c-dir
/file
(cons (file-name-directory file-name
)
488 (file-name-nondirectory file-name
)))
489 (comint-send-string (inferior-lisp-proc) (concat "(compile-file \""
496 ;;; Documentation functions: function doc, var doc, arglist, and
498 ;;; ===========================================================================
503 (defvar lisp-function-doc-command
505 (format t \"Documentation for ~a:~&~a\"
506 fn (documentation fn 'function))
508 "Command to query inferior Lisp for a function's documentation.")
510 (defvar lisp-var-doc-command
512 (format t \"Documentation for ~a:~&~a\"
513 v (documentation v 'variable))
515 "Command to query inferior Lisp for a variable's documentation.")
517 (defvar lisp-arglist-command
519 (format t \"Arglist for ~a: ~a\" fn (arglist fn))
521 "Command to query inferior Lisp for a function's arglist.")
523 (defvar lisp-describe-sym-command
525 "Command to query inferior Lisp for a variable's documentation.")
528 ;;; Ancillary functions
529 ;;; ===================
531 ;;; Reads a string from the user.
532 (defun lisp-symprompt (prompt default
)
533 (list (let* ((prompt (if default
534 (format "%s (default %s): " prompt default
)
535 (concat prompt
": ")))
536 (ans (read-string prompt
)))
537 (if (zerop (length ans
)) default ans
))))
540 ;;; Adapted from function-called-at-point in help.el.
541 (defun lisp-fn-called-at-pt ()
542 "Returns the name of the function called in the current call.
543 The value is nil if it can't find one."
547 (narrow-to-region (max (point-min) (- (point) 1000)) (point-max))
550 (let ((obj (read (current-buffer))))
551 (and (symbolp obj
) obj
))))
555 ;;; Adapted from variable-at-point in help.el.
556 (defun lisp-var-at-pt ()
560 (skip-chars-forward "'")
561 (let ((obj (read (current-buffer))))
562 (and (symbolp obj
) obj
)))
566 ;;; Documentation functions: fn and var doc, arglist, and symbol describe.
567 ;;; ======================================================================
569 (defun lisp-show-function-documentation (fn)
570 "Send a command to the inferior Lisp to give documentation for function FN.
571 See variable `lisp-function-doc-command'."
572 (interactive (lisp-symprompt "Function doc" (lisp-fn-called-at-pt)))
573 (comint-proc-query (inferior-lisp-proc)
574 (format lisp-function-doc-command fn
)))
576 (defun lisp-show-variable-documentation (var)
577 "Send a command to the inferior Lisp to give documentation for function FN.
578 See variable `lisp-var-doc-command'."
579 (interactive (lisp-symprompt "Variable doc" (lisp-var-at-pt)))
580 (comint-proc-query (inferior-lisp-proc) (format lisp-var-doc-command var
)))
582 (defun lisp-show-arglist (fn)
583 "Send a query to the inferior Lisp for the arglist for function FN.
584 See variable `lisp-arglist-command'."
585 (interactive (lisp-symprompt "Arglist" (lisp-fn-called-at-pt)))
586 (comint-proc-query (inferior-lisp-proc) (format lisp-arglist-command fn
)))
588 (defun lisp-describe-sym (sym)
589 "Send a command to the inferior Lisp to describe symbol SYM.
590 See variable `lisp-describe-sym-command'."
591 (interactive (lisp-symprompt "Describe" (lisp-var-at-pt)))
592 (comint-proc-query (inferior-lisp-proc)
593 (format lisp-describe-sym-command sym
)))
596 ;; "Returns the current inferior Lisp process.
597 ;; See variable `inferior-lisp-buffer'."
598 (defun inferior-lisp-proc ()
599 (let ((proc (get-buffer-process (if (eq major-mode
'inferior-lisp-mode
)
601 inferior-lisp-buffer
))))
603 (error "No Lisp subprocess; see variable `inferior-lisp-buffer'"))))
606 ;;; Do the user's customisation...
607 ;;;===============================
608 (defvar inferior-lisp-load-hook nil
609 "This hook is run when the library `inf-lisp' is loaded.")
611 (run-hooks 'inferior-lisp-load-hook
)
614 ;;; ===========================================================================
615 ;;; 7/21/92 Jim Blandy
616 ;;; - Changed all uses of the cmulisp name or prefix to inferior-lisp;
617 ;;; this is now the official inferior lisp package. Use the global
618 ;;; ChangeLog from now on.
620 ;;; - Split cmulisp and cmushell modes into separate files.
621 ;;; Not only is this a good idea, it's apparently the way it'll be rel 19.
622 ;;; - Upgraded process sends to use comint-send-string instead of
623 ;;; process-send-string.
624 ;;; - Explicit references to process "cmulisp" have been replaced with
625 ;;; (cmulisp-proc). This allows better handling of multiple process bufs.
626 ;;; - Added process query and var/function/symbol documentation
627 ;;; commands. Based on code written by Douglas Roberts.
628 ;;; - Added lisp-eval-last-sexp, bound to C-x C-e.
631 ;;; Added a save-restriction to lisp-fn-called-at-pt. This bug and fix
632 ;;; reported by Lennart Staflin.
635 ;;; - lisp-load-file and lisp-compile-file no longer switch-to-lisp.
636 ;;; Tale suggested this.
637 ;;; - Reversed this decision 7/15/91. You need the visual feedback.
640 ;;; Changed all keybindings of the form C-c <letter>. These are
641 ;;; supposed to be reserved for the user to bind. This affected
642 ;;; mainly the compile/eval-defun/region[-and-go] commands.
643 ;;; This was painful, but necessary to adhere to the gnumacs standard.
644 ;;; For some backwards compatibility, see the
645 ;;; cmulisp-install-letter-bindings
649 ;;; - The lisp-compile/eval-defun/region commands now take a prefix arg,
650 ;;; which means switch-to-lisp after sending the text to the Lisp process.
651 ;;; This obsoletes all the -and-go commands. The -and-go commands are
652 ;;; kept around for historical reasons, and because the user can bind
653 ;;; them to key sequences shorter than C-u C-c C-<letter>.
654 ;;; - If M-x cmulisp is invoked with a prefix arg, it allows you to
655 ;;; edit the command line.
659 ;; arch-tag: 5b74abc3-a085-4b91-8ab8-8da6899d3b92
660 ;;; inf-lisp.el ends here