|
|
1.1 root 1: ;;
2: ;; copyright (C) 1987, 1988 Franz Inc, Berkeley, Ca.
3: ;;
4: ;; The software, data and information contained herein are the property
5: ;; of Franz, Inc.
6: ;;
7: ;; This file (or any derivation of it) may be distributed without
8: ;; further permission from Franz Inc. as long as:
9: ;;
10: ;; * it is not part of a product for sale,
11: ;; * no charge is made for the distribution, other than a tape
12: ;; fee, and
13: ;; * all copyright notices and this notice are preserved.
14: ;;
15: ;; If you have any comments or questions on this interface, please feel
16: ;; free to contact Franz Inc. at
17: ;; Franz Inc.
18: ;; Attn: Kevin Layer
19: ;; 1995 University Ave
20: ;; Suite 275
21: ;; Berkeley, CA 94704
22: ;; (415) 548-3600
23: ;; or
24: ;; emacs-info%[email protected]
25: ;; ucbvax!franz!emacs-info
26:
27: ;; $Header: shell.el,v 1.9 88/07/15 18:32:39 layer Exp $
28:
29: (defvar fi:shell-mode-map nil
30: "The shell major-mode keymap.")
31:
32: (defvar fi:shell-mode-super-key-map nil
33: "Used for super-key processing in shell mode.")
34:
35: (defvar fi:shell-image-name "csh"
36: "*Default Shell image to invoke from (fi:shell). If the value
37: is a string then it names the image file or image path that
38: `fi:common-lisp' invokes. Otherwise, the value of this variable is given
39: to funcall, the result of which should yield a string which is the image
40: name or path.")
41:
42: (defvar fi:shell-image-arguments '("-i")
43: "*Default Shell image arguments when invoked from (fi:shell).")
44:
45: (defvar fi:shell-prompt-pattern
46: "^[-_.a-zA-Z0-9]*[#$%>] *"
47: "*Regexp used by Newline command in shell mode to match subshell prompts.
48: Anything from beginning of line up to the end of what this pattern matches
49: is deemed to be prompt, and is not re-executed.")
50:
51: (defun fi:shell-mode ()
52: "Major mode for interacting with an inferior shell."
53: (interactive)
54: (kill-all-local-variables)
55: (setq major-mode 'fi:shell-mode)
56: (setq mode-name "Shell")
57:
58: (if (null fi:shell-mode-super-key-map)
59: (progn
60: (setq fi:shell-mode-super-key-map (make-sparse-keymap))
61: (fi::subprocess-mode-super-keys fi:shell-mode-super-key-map 'shell)))
62:
63: (if (null fi:shell-mode-map)
64: (setq fi:shell-mode-map
65: (fi::subprocess-mode-commands (make-sparse-keymap)
66: fi:shell-mode-super-key-map
67: 'shell)))
68: (use-local-map fi:shell-mode-map)
69: (setq fi:subprocess-super-key-map fi:shell-mode-super-key-map)
70: (run-hooks 'fi:subprocess-mode-hook 'fi:shell-mode-hook))
71:
72: (defun fi:shell (&optional buffer-number)
73: "Start a sub-shell in a buffer whose name is determined from the optional
74: prefix argument BUFFER-NUMBER. Shell buffer names start with `*shell'
75: and end with `*', with an optional `-N' in between. If BUFFER-NUMBER is
76: not given it defaults to 1. If BUFFER-NUMBER is >= 0, then the buffer is
77: named `*shell-<BUFFER-NUMBER>*'. If BUFFER-NUMBER is < 0, then the first
78: available buffer name is chosen.
79:
80: The image file and image arguments are taken from the variables
81: `fi:shell-image-name' and `fi:shell-image-arguments'.
82:
83: See fi:explicit-shell."
84: (interactive "p")
85: (fi::make-subprocess
86: buffer-number "shell" 'fi:shell-mode
87: fi:shell-prompt-pattern fi:shell-image-name fi:shell-image-arguments))
88:
89: (defun fi:explicit-shell (&optional buffer-number
90: image-name image-arguments)
91: "The same as fi:shell, except that the image and image arguments
92: are read from the minibuffer."
93: (interactive "p\nsImage name: \nxImage arguments (a list): ")
94: (fi::make-subprocess
95: buffer-number "shell" 'fi:shell-mode fi:shell-prompt-pattern
96: image-name image-arguments))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.