Mercurial > emacs
annotate lisp/comint.el @ 705:c7d478752305
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 10 Jun 1992 01:34:51 +0000 |
parents | 8a533acedb77 |
children | 4abf65b235d9 |
rev | line source |
---|---|
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
638
diff
changeset
|
1 ;;; comint.el --- general command interpreter in a window stuff |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
638
diff
changeset
|
2 |
584 | 3 ;;; Copyright Olin Shivers (1988). |
114 | 4 |
5 ;;; This file is part of GNU Emacs. | |
6 | |
7 ;;; GNU Emacs is free software; you can redistribute it and/or modify | |
8 ;;; it under the terms of the GNU General Public License as published by | |
9 ;;; the Free Software Foundation; either version 1, or (at your option) | |
10 ;;; any later version. | |
11 | |
12 ;;; GNU Emacs is distributed in the hope that it will be useful, | |
13 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 ;;; GNU General Public License for more details. | |
16 | |
17 ;;; You should have received a copy of the GNU General Public License | |
18 ;;; along with GNU Emacs; see the file COPYING. If not, write to | |
19 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | |
584 | 21 ;;; The changelog is at the end of this file. |
22 | |
23 ;;; Please send me bug reports, bug fixes, and extensions, so that I can | |
24 ;;; merge them into the master source. | |
25 ;;; - Olin Shivers (shivers@cs.cmu.edu) | |
26 | |
27 ;;; This hopefully generalises shell mode, lisp mode, tea mode, soar mode,... | |
114 | 28 ;;; This file defines a general command-interpreter-in-a-buffer package |
29 ;;; (comint mode). The idea is that you can build specific process-in-a-buffer | |
30 ;;; modes on top of comint mode -- e.g., lisp, shell, scheme, T, soar, .... | |
31 ;;; This way, all these specific packages share a common base functionality, | |
32 ;;; and a common set of bindings, which makes them easier to use (and | |
33 ;;; saves code, implementation time, etc., etc.). | |
34 | |
584 | 35 ;;; Several packages are already defined using comint mode: |
36 ;;; - cmushell.el defines a shell-in-a-buffer mode. | |
37 ;;; - cmulisp.el defines a simple lisp-in-a-buffer mode. | |
38 ;;; Cmushell and cmulisp mode are similar to, and intended to replace, | |
39 ;;; their counterparts in the standard gnu emacs release (in shell.el). | |
40 ;;; These replacements are more featureful, robust, and uniform than the | |
41 ;;; released versions. The key bindings in lisp mode are also more compatible | |
42 ;;; with the bindings of Hemlock and Zwei (the Lisp Machine emacs). | |
43 ;;; | |
44 ;;; - The file cmuscheme.el defines a scheme-in-a-buffer mode. | |
45 ;;; - The file tea.el tunes scheme and inferior-scheme modes for T. | |
46 ;;; - The file soar.el tunes lisp and inferior-lisp modes for Soar. | |
47 ;;; - cmutex.el defines tex and latex modes that invoke tex, latex, bibtex, | |
48 ;;; previewers, and printers from within emacs. | |
49 ;;; - background.el allows csh-like job control inside emacs. | |
50 ;;; It is pretty easy to make new derived modes for other processes. | |
51 | |
114 | 52 ;;; For documentation on the functionality provided by comint mode, and |
53 ;;; the hooks available for customising it, see the comments below. | |
54 ;;; For further information on the standard derived modes (shell, | |
55 ;;; inferior-lisp, inferior-scheme, ...), see the relevant source files. | |
56 | |
584 | 57 ;;; For hints on converting existing process modes (e.g., tex-mode, |
58 ;;; background, dbx, gdb, kermit, prolog, telnet) to use comint-mode | |
114 | 59 ;;; instead of shell-mode, see the notes at the end of this file. |
60 | |
705 | 61 (defconst comint-version "2.03") |
114 | 62 |
63 | |
584 | 64 ;;; Brief Command Documentation: |
65 ;;;============================================================================ | |
66 ;;; Comint Mode Commands: (common to all derived modes, like cmushell & cmulisp | |
67 ;;; mode) | |
68 ;;; | |
69 ;;; m-p comint-previous-input Cycle backwards in input history | |
70 ;;; m-n comint-next-input Cycle forwards | |
71 ;;; m-s comint-previous-similar-input Previous similar input | |
705 | 72 ;;; c-m-r comint-previous-input-matching Search backwards in input history |
584 | 73 ;;; return comint-send-input |
74 ;;; c-a comint-bol Beginning of line; skip prompt. | |
75 ;;; c-d comint-delchar-or-maybe-eof Delete char unless at end of buff. | |
76 ;;; c-c c-u comint-kill-input ^u | |
77 ;;; c-c c-w backward-kill-word ^w | |
78 ;;; c-c c-c comint-interrupt-subjob ^c | |
79 ;;; c-c c-z comint-stop-subjob ^z | |
80 ;;; c-c c-\ comint-quit-subjob ^\ | |
81 ;;; c-c c-o comint-kill-output Delete last batch of process output | |
82 ;;; c-c c-r comint-show-output Show last batch of process output | |
83 ;;; | |
114 | 84 ;;; Not bound by default in comint-mode |
85 ;;; send-invisible Read a line w/o echo, and send to proc | |
86 ;;; (These are bound in shell-mode) | |
87 ;;; comint-dynamic-complete Complete filename at point. | |
88 ;;; comint-dynamic-list-completions List completions in help buffer. | |
89 ;;; comint-replace-by-expanded-filename Expand and complete filename at point; | |
90 ;;; replace with expanded/completed name. | |
584 | 91 ;;; comint-kill-subjob No mercy. |
92 ;;; comint-continue-subjob Send CONT signal to buffer's process | |
93 ;;; group. Useful if you accidentally | |
94 ;;; suspend your process (with C-c C-z). | |
95 ;;; | |
96 ;;; These used to be bound for RMS -- I prefer the input history stuff, | |
97 ;;; but you might like 'em. | |
98 ;;; m-P comint-msearch-input Search backwards for prompt | |
99 ;;; m-N comint-psearch-input Search forwards for prompt | |
100 ;;; C-cR comint-msearch-input-matching Search backwards for prompt & string | |
114 | 101 |
584 | 102 ;;; comint-mode-hook is the comint mode hook. Basically for your keybindings. |
103 ;;; comint-load-hook is run after loading in this package. | |
104 | |
114 | 105 |
106 ;;; Buffer Local Variables: | |
107 ;;;============================================================================ | |
108 ;;; Comint mode buffer local variables: | |
109 ;;; comint-prompt-regexp - string comint-bol uses to match prompt. | |
705 | 110 ;;; comint-last-input-start - marker Handy if inferior always echos |
584 | 111 ;;; comint-last-input-end - marker For comint-kill-output command |
114 | 112 ;;; input-ring-size - integer For the input history |
113 ;;; input-ring - ring mechanism | |
114 ;;; input-ring-index - marker ... | |
115 ;;; comint-last-input-match - string ... | |
116 ;;; comint-get-old-input - function Hooks for specific | |
117 ;;; comint-input-sentinel - function process-in-a-buffer | |
118 ;;; comint-input-filter - function modes. | |
119 ;;; comint-input-send - function | |
120 ;;; comint-eol-on-send - boolean | |
121 | |
584 | 122 (defvar comint-prompt-regexp "^" |
123 "Regexp to recognise prompts in the inferior process. | |
124 Defaults to \"^\", the null string at BOL. | |
114 | 125 |
126 Good choices: | |
584 | 127 Canonical Lisp: \"^[^> ]*>+:? *\" (Lucid, franz, kcl, T, cscheme, oaklisp) |
114 | 128 Lucid Common Lisp: \"^\\(>\\|\\(->\\)+\\) *\" |
584 | 129 franz: \"^\\(->\\|<[0-9]*>:\\) *\" |
130 kcl: \"^>+ *\" | |
131 shell: \"^[^#$%>]*[#$%>] *\" | |
132 T: \"^>+ *\" | |
114 | 133 |
584 | 134 This is a good thing to set in mode hooks.") |
114 | 135 |
584 | 136 (defvar input-ring-size 30 |
137 "Size of input history ring.") | |
114 | 138 |
139 ;;; Here are the per-interpreter hooks. | |
584 | 140 (defvar comint-get-old-input (function comint-get-old-input-default) |
141 "Function that submits old text in comint mode. | |
114 | 142 This function is called when return is typed while the point is in old text. |
143 It returns the text to be submitted as process input. The default is | |
144 comint-get-old-input-default, which grabs the current line, and strips off | |
584 | 145 leading text matching comint-prompt-regexp") |
114 | 146 |
584 | 147 (defvar comint-input-sentinel (function ignore) |
148 "Called on each input submitted to comint mode process by comint-send-input. | |
149 Thus it can, for instance, track cd/pushd/popd commands issued to the csh.") | |
114 | 150 |
584 | 151 (defvar comint-input-filter |
152 (function (lambda (str) (not (string-match "\\`\\s *\\'" str)))) | |
153 "Predicate for filtering additions to input history. | |
114 | 154 Only inputs answering true to this function are saved on the input |
584 | 155 history list. Default is to save anything that isn't all whitespace") |
156 | |
157 (defvar comint-input-sender (function comint-simple-send) | |
158 "Function to actually send to PROCESS the STRING submitted by user. | |
159 Usually this is just 'comint-simple-send, but if your mode needs to | |
160 massage the input string, this is your hook. This is called from | |
161 the user command comint-send-input. comint-simple-send just sends | |
162 the string plus a newline.") | |
163 | |
164 (defvar comint-eol-on-send 'T | |
165 "If non-nil, then jump to the end of the line before sending input to process. | |
166 See comint-send-input") | |
114 | 167 |
168 (defvar comint-mode-hook '() | |
584 | 169 "Called upon entry into comint-mode |
170 This is run before the process is cranked up.") | |
171 | |
172 (defvar comint-exec-hook '() | |
173 "Called each time a process is exec'd by comint-exec. | |
174 This is called after the process is cranked up. It is useful for things that | |
175 must be done each time a process is executed in a comint-mode buffer (e.g., | |
176 (process-kill-without-query)). In contrast, the comint-mode-hook is only | |
177 executed once when the buffer is created.") | |
178 | |
179 (defvar comint-mode-map nil) | |
114 | 180 |
181 (defun comint-mode () | |
182 "Major mode for interacting with an inferior interpreter. | |
183 Interpreter name is same as buffer name, sans the asterisks. | |
184 Return at end of buffer sends line as input. | |
185 Return not at end copies rest of line to end and sends it. | |
584 | 186 Setting mode variable comint-eol-on-send means jump to the end of the line |
187 before submitting new input. | |
114 | 188 |
189 This mode is typically customised to create inferior-lisp-mode, | |
584 | 190 shell-mode, etc.. This can be done by setting the hooks |
191 comint-input-sentinel, comint-input-filter, comint-input-sender and | |
192 comint-get-old-input to appropriate functions, and the variable | |
193 comint-prompt-regexp to the appropriate regular expression. | |
114 | 194 |
195 An input history is maintained of size input-ring-size, and | |
196 can be accessed with the commands comint-next-input [\\[comint-next-input]] and | |
197 comint-previous-input [\\[comint-previous-input]]. Commands not keybound by | |
198 default are send-invisible, comint-dynamic-complete, and | |
199 comint-list-dynamic-completions. | |
200 | |
201 If you accidentally suspend your process, use \\[comint-continue-subjob] | |
202 to continue it. | |
203 | |
204 \\{comint-mode-map} | |
205 | |
584 | 206 Entry to this mode runs the hooks on comint-mode-hook" |
114 | 207 (interactive) |
584 | 208 (let ((old-ring (and (assq 'input-ring (buffer-local-variables)) |
209 (boundp 'input-ring) | |
210 input-ring)) | |
211 (old-ptyp comint-ptyp)) ; preserve across local var kill. gross. | |
212 ; (kill-all-local-variables) ; Removed 1/15/90 Olin | |
213 (setq major-mode 'comint-mode) | |
214 (setq mode-name "Comint") | |
215 (setq mode-line-process '(": %s")) | |
216 (use-local-map comint-mode-map) | |
705 | 217 (make-local-variable 'comint-last-input-start) |
218 (setq comint-last-input-start (make-marker)) | |
584 | 219 (make-local-variable 'comint-last-input-end) |
220 (setq comint-last-input-end (make-marker)) | |
221 (make-local-variable 'comint-last-input-match) | |
222 (setq comint-last-input-match "") | |
223 (make-local-variable 'comint-prompt-regexp) ; Don't set; default | |
224 (make-local-variable 'input-ring-size) ; ...to global val. | |
225 (make-local-variable 'input-ring) | |
226 (make-local-variable 'input-ring-index) | |
227 (setq input-ring-index 0) | |
228 (make-local-variable 'comint-get-old-input) | |
229 (make-local-variable 'comint-input-sentinel) | |
230 (make-local-variable 'comint-input-filter) | |
231 (make-local-variable 'comint-input-sender) | |
232 (make-local-variable 'comint-eol-on-send) | |
233 (make-local-variable 'comint-ptyp) | |
234 (setq comint-ptyp old-ptyp) | |
705 | 235 (make-local-variable 'comint-exec-hook) |
584 | 236 (run-hooks 'comint-mode-hook) |
237 ;Do this after the hook so the user can mung INPUT-RING-SIZE w/his hook. | |
238 ;The test is so we don't lose history if we run comint-mode twice in | |
239 ;a buffer. | |
240 (setq input-ring (if (ring-p old-ring) old-ring | |
241 (make-ring input-ring-size))))) | |
242 | |
243 ;;; The old-ptyp stuff above is because we have to preserve the value of | |
244 ;;; comint-ptyp across calls to comint-mode, in spite of the | |
245 ;;; kill-all-local-variables that it does. Blech. Hopefully, this will all | |
246 ;;; go away when a later release fixes the signalling bug. | |
247 ;;; (Later: I removed the kill-all-local-variables, but have left this | |
248 ;;; other code in place just in case I reverse myself.) | |
114 | 249 |
584 | 250 (if comint-mode-map |
251 nil | |
252 (setq comint-mode-map (make-sparse-keymap)) | |
253 (define-key comint-mode-map "\ep" 'comint-previous-input) | |
254 (define-key comint-mode-map "\en" 'comint-next-input) | |
255 (define-key comint-mode-map "\es" 'comint-previous-similar-input) | |
256 (define-key comint-mode-map "\C-m" 'comint-send-input) | |
257 (define-key comint-mode-map "\C-d" 'comint-delchar-or-maybe-eof) | |
258 (define-key comint-mode-map "\C-a" 'comint-bol) | |
259 (define-key comint-mode-map "\C-c\C-u" 'comint-kill-input) | |
260 (define-key comint-mode-map "\C-c\C-w" 'backward-kill-word) | |
261 (define-key comint-mode-map "\C-c\C-c" 'comint-interrupt-subjob) | |
262 (define-key comint-mode-map "\C-c\C-z" 'comint-stop-subjob) | |
263 (define-key comint-mode-map "\C-c\C-\\" 'comint-quit-subjob) | |
264 (define-key comint-mode-map "\C-c\C-o" 'comint-kill-output) | |
265 (define-key comint-mode-map "\C-\M-r" 'comint-previous-input-matching) | |
266 (define-key comint-mode-map "\C-c\C-r" 'comint-show-output) | |
267 ;;; prompt-search commands commented out 3/90 -Olin | |
268 ; (define-key comint-mode-map "\eP" 'comint-msearch-input) | |
269 ; (define-key comint-mode-map "\eN" 'comint-psearch-input) | |
270 ; (define-key comint-mode-map "\C-cR" 'comint-msearch-input-matching) | |
271 ) | |
272 | |
273 | |
274 ;;; This function is used to make a full copy of the comint mode map, | |
275 ;;; so that client modes won't interfere with each other. This function | |
276 ;;; isn't necessary in emacs 18.5x, but we keep it around for 18.4x versions. | |
277 (defun full-copy-sparse-keymap (km) | |
278 "Recursively copy the sparse keymap KM" | |
279 (cond ((consp km) | |
280 (cons (full-copy-sparse-keymap (car km)) | |
281 (full-copy-sparse-keymap (cdr km)))) | |
282 (t km))) | |
283 | |
284 (defun comint-check-proc (buffer) | |
285 "True if there is a process associated w/buffer BUFFER, and | |
286 it is alive (status RUN or STOP). BUFFER can be either a buffer or the | |
287 name of one" | |
288 (let ((proc (get-buffer-process buffer))) | |
114 | 289 (and proc (memq (process-status proc) '(run stop))))) |
290 | |
291 ;;; Note that this guy, unlike shell.el's make-shell, barfs if you pass it () | |
292 ;;; for the second argument (program). | |
293 (defun make-comint (name program &optional startfile &rest switches) | |
584 | 294 (let ((buffer (get-buffer-create (concat "*" name "*")))) |
114 | 295 ;; If no process, or nuked process, crank up a new one and put buffer in |
296 ;; comint mode. Otherwise, leave buffer and existing process alone. | |
182 | 297 (cond ((not (comint-check-proc buffer)) |
584 | 298 (save-excursion |
114 | 299 (set-buffer buffer) |
300 (comint-mode)) ; Install local vars, mode, keymap, ... | |
301 (comint-exec buffer name program startfile switches))) | |
302 buffer)) | |
303 | |
584 | 304 (defvar comint-ptyp t |
305 "True if communications via pty; false if by pipe. Buffer local. | |
306 This is to work around a bug in emacs process signalling.") | |
307 | |
114 | 308 (defun comint-exec (buffer name command startfile switches) |
309 "Fires up a process in buffer for comint modes. | |
584 | 310 Blasts any old process running in the buffer. Doesn't set the buffer mode. |
311 You can use this to cheaply run a series of processes in the same comint | |
312 buffer. The hook comint-exec-hook is run after each exec." | |
114 | 313 (save-excursion |
314 (set-buffer buffer) | |
315 (let ((proc (get-buffer-process buffer))) ; Blast any old process. | |
316 (if proc (delete-process proc))) | |
317 ;; Crank up a new process | |
318 (let ((proc (comint-exec-1 name buffer command switches))) | |
584 | 319 (make-local-variable 'comint-ptyp) |
320 (setq comint-ptyp process-connection-type) ; T if pty, NIL if pipe. | |
114 | 321 ;; Jump to the end, and set the process mark. |
584 | 322 (goto-char (point-max)) |
705 | 323 (set-marker (process-mark proc) (point)) |
114 | 324 ;; Feed it the startfile. |
325 (cond (startfile | |
326 ;;This is guaranteed to wait long enough | |
327 ;;but has bad results if the comint does not prompt at all | |
328 ;; (while (= size (buffer-size)) | |
329 ;; (sleep-for 1)) | |
330 ;;I hope 1 second is enough! | |
331 (sleep-for 1) | |
332 (goto-char (point-max)) | |
333 (insert-file-contents startfile) | |
334 (setq startfile (buffer-substring (point) (point-max))) | |
335 (delete-region (point) (point-max)) | |
584 | 336 (comint-send-string proc startfile))) |
337 (run-hooks 'comint-exec-hook) | |
705 | 338 buffer))) |
114 | 339 |
340 ;;; This auxiliary function cranks up the process for comint-exec in | |
638 | 341 ;;; the appropriate environment. |
114 | 342 |
343 (defun comint-exec-1 (name buffer command switches) | |
638 | 344 (let ((process-environment |
345 (comint-update-env process-environment | |
346 (list (format "TERMCAP=emacs:co#%d:tc=unknown" | |
347 (screen-width)) | |
348 "TERM=emacs" | |
349 "EMACS=t")))) | |
350 (apply 'start-process name buffer command switches))) | |
584 | 351 |
352 | |
114 | 353 |
354 ;; This is just (append new old-env) that compresses out shadowed entries. | |
355 ;; It's also pretty ugly, mostly due to elisp's horrible iteration structures. | |
356 (defun comint-update-env (old-env new) | |
357 (let ((ans (reverse new)) | |
358 (vars (mapcar (function (lambda (vv) | |
359 (and (string-match "^[^=]*=" vv) | |
360 (substring vv 0 (match-end 0))))) | |
361 new))) | |
362 (while old-env | |
363 (let* ((vv (car old-env)) ; vv is var=value | |
364 (var (and (string-match "^[^=]*=" vv) | |
365 (substring vv 0 (match-end 0))))) | |
366 (setq old-env (cdr old-env)) | |
584 | 367 (cond ((not (and var (comint-mem var vars))) |
114 | 368 (if var (setq var (cons var vars))) |
369 (setq ans (cons vv ans)))))) | |
370 (nreverse ans))) | |
584 | 371 |
372 ;;; This should be in emacs, but it isn't. | |
373 (defun comint-mem (item list &optional elt=) | |
374 "Test to see if ITEM is equal to an item in LIST. | |
375 Option comparison function ELT= defaults to equal." | |
376 (let ((elt= (or elt= (function equal))) | |
377 (done nil)) | |
378 (while (and list (not done)) | |
379 (if (funcall elt= item (car list)) | |
380 (setq done list) | |
381 (setq list (cdr list)))) | |
382 done)) | |
383 | |
114 | 384 |
584 | 385 ;;; Ring Code |
386 ;;;============================================================================ | |
387 ;;; This code defines a ring data structure. A ring is a | |
388 ;;; (hd-index tl-index . vector) | |
389 ;;; list. You can insert to, remove from, and rotate a ring. When the ring | |
390 ;;; fills up, insertions cause the oldest elts to be quietly dropped. | |
391 ;;; | |
392 ;;; HEAD = index of the newest item on the ring. | |
393 ;;; TAIL = index of the oldest item on the ring. | |
394 ;;; | |
395 ;;; These functions are used by the input history mechanism, but they can | |
396 ;;; be used for other purposes as well. | |
397 | |
398 (defun ring-p (x) | |
399 "T if X is a ring; NIL otherwise." | |
400 (and (consp x) (integerp (car x)) | |
401 (consp (cdr x)) (integerp (car (cdr x))) | |
402 (vectorp (cdr (cdr x))))) | |
403 | |
404 (defun make-ring (size) | |
405 "Make a ring that can contain SIZE elts" | |
406 (cons 1 (cons 0 (make-vector (+ size 1) nil)))) | |
407 | |
408 (defun ring-plus1 (index veclen) | |
409 "INDEX+1, with wraparound" | |
410 (let ((new-index (+ index 1))) | |
411 (if (= new-index veclen) 0 new-index))) | |
412 | |
413 (defun ring-minus1 (index veclen) | |
414 "INDEX-1, with wraparound" | |
415 (- (if (= 0 index) veclen index) 1)) | |
416 | |
417 (defun ring-length (ring) | |
418 "Number of elts in the ring." | |
419 (let ((hd (car ring)) (tl (car (cdr ring))) (siz (length (cdr (cdr ring))))) | |
420 (let ((len (if (<= hd tl) (+ 1 (- tl hd)) (+ 1 tl (- siz hd))))) | |
421 (if (= len siz) 0 len)))) | |
422 | |
423 (defun ring-empty-p (ring) | |
424 (= 0 (ring-length ring))) | |
425 | |
426 (defun ring-insert (ring item) | |
427 "Insert a new item onto the ring. If the ring is full, dump the oldest | |
428 item to make room." | |
429 (let* ((vec (cdr (cdr ring))) (len (length vec)) | |
430 (new-hd (ring-minus1 (car ring) len))) | |
431 (setcar ring new-hd) | |
432 (aset vec new-hd item) | |
433 (if (ring-empty-p ring) ;overflow -- dump one off the tail. | |
434 (setcar (cdr ring) (ring-minus1 (car (cdr ring)) len))))) | |
435 | |
436 (defun ring-remove (ring) | |
437 "Remove the oldest item retained on the ring." | |
438 (if (ring-empty-p ring) (error "Ring empty") | |
439 (let ((tl (car (cdr ring))) (vec (cdr (cdr ring)))) | |
440 (set-car (cdr ring) (ring-minus1 tl (length vec))) | |
441 (aref vec tl)))) | |
442 | |
443 ;;; This isn't actually used in this package. I just threw it in in case | |
444 ;;; someone else wanted it. If you want rotating-ring behavior on your history | |
445 ;;; retrieval (analagous to kill ring behavior), this function is what you | |
446 ;;; need. I should write the yank-input and yank-pop-input-or-kill to go with | |
447 ;;; this, and not bind it to a key by default, so it would be available to | |
448 ;;; people who want to bind it to a key. But who would want it? Blech. | |
449 (defun ring-rotate (ring n) | |
450 (if (not (= n 0)) | |
451 (if (ring-empty-p ring) ;Is this the right error check? | |
452 (error "ring empty") | |
453 (let ((hd (car ring)) (tl (car (cdr ring))) (vec (cdr (cdr ring)))) | |
454 (let ((len (length vec))) | |
455 (while (> n 0) | |
456 (setq tl (ring-plus1 tl len)) | |
457 (aset ring tl (aref ring hd)) | |
458 (setq hd (ring-plus1 hd len)) | |
459 (setq n (- n 1))) | |
460 (while (< n 0) | |
461 (setq hd (ring-minus1 hd len)) | |
462 (aset vec hd (aref vec tl)) | |
463 (setq tl (ring-minus1 tl len)) | |
464 (setq n (- n 1)))) | |
465 (set-car ring hd) | |
466 (set-car (cdr ring) tl))))) | |
467 | |
468 (defun comint-mod (n m) | |
469 "Returns N mod M. M is positive. Answer is guaranteed to be non-negative, | |
470 and less than m." | |
471 (let ((n (% n m))) | |
472 (if (>= n 0) n | |
473 (+ n | |
474 (if (>= m 0) m (- m)))))) ; (abs m) | |
475 | |
476 (defun ring-ref (ring index) | |
477 (let ((numelts (ring-length ring))) | |
478 (if (= numelts 0) (error "indexed empty ring") | |
479 (let* ((hd (car ring)) (tl (car (cdr ring))) (vec (cdr (cdr ring))) | |
480 (index (comint-mod index numelts)) | |
481 (vec-index (comint-mod (+ index hd) | |
482 (length vec)))) | |
483 (aref vec vec-index))))) | |
484 | |
485 | |
114 | 486 ;;; Input history retrieval commands |
487 ;;; M-p -- previous input M-n -- next input | |
584 | 488 ;;; M-C-r -- previous input matching |
114 | 489 ;;; =========================================================================== |
490 | |
491 (defun comint-previous-input (arg) | |
492 "Cycle backwards through input history." | |
493 (interactive "*p") | |
494 (let ((len (ring-length input-ring))) | |
584 | 495 (cond ((<= len 0) |
496 (message "Empty input ring") | |
497 (ding)) | |
498 ((not (comint-after-pmark-p)) | |
499 (message "Not after process mark") | |
500 (ding)) | |
501 (t | |
502 (cond ((eq last-command 'comint-previous-input) | |
503 (delete-region (mark) (point))) | |
504 ((eq last-command 'comint-previous-similar-input) | |
505 (delete-region | |
506 (process-mark (get-buffer-process (current-buffer))) | |
507 (point))) | |
508 (t | |
509 (setq input-ring-index | |
510 (if (> arg 0) -1 | |
511 (if (< arg 0) 1 0))) | |
512 (push-mark (point)))) | |
513 (setq input-ring-index (comint-mod (+ input-ring-index arg) len)) | |
514 (message "%d" (1+ input-ring-index)) | |
515 (insert (ring-ref input-ring input-ring-index)) | |
516 (setq this-command 'comint-previous-input))))) | |
517 | |
114 | 518 (defun comint-next-input (arg) |
519 "Cycle forwards through input history." | |
520 (interactive "*p") | |
521 (comint-previous-input (- arg))) | |
522 | |
584 | 523 (defvar comint-last-input-match "" |
524 "Last string searched for by comint input history search, for defaulting. | |
525 Buffer local variable.") | |
526 | |
114 | 527 (defun comint-previous-input-matching (str) |
528 "Searches backwards through input history for substring match." | |
529 (interactive (let* ((last-command last-command) ; preserve around r-f-m | |
530 (s (read-from-minibuffer | |
531 (format "Command substring (default %s): " | |
532 comint-last-input-match)))) | |
533 (list (if (string= s "") comint-last-input-match s)))) | |
534 ; (interactive "sCommand substring: ") | |
535 (setq comint-last-input-match str) ; update default | |
536 (if (not (eq last-command 'comint-previous-input)) | |
537 (setq input-ring-index -1)) | |
538 (let ((str (regexp-quote str)) | |
539 (len (ring-length input-ring)) | |
540 (n (+ input-ring-index 1))) | |
541 (while (and (< n len) (not (string-match str (ring-ref input-ring n)))) | |
542 (setq n (+ n 1))) | |
543 (cond ((< n len) | |
544 (comint-previous-input (- n input-ring-index))) | |
545 (t (if (eq last-command 'comint-previous-input) | |
546 (setq this-command 'comint-previous-input)) | |
584 | 547 (message "Not found.") |
548 (ding))))) | |
549 | |
550 | |
551 ;;; These next three commands are alternatives to the input history commands | |
552 ;;; -- comint-next-input, comint-previous-input and | |
553 ;;; comint-previous-input-matching. They search through the process buffer | |
554 ;;; text looking for occurrences of the prompt. Bound to M-P, M-N, and C-c R | |
555 ;;; (uppercase P, N, and R) for now. Try'em out. Go with what you like... | |
556 | |
557 ;;; comint-msearch-input-matching prompts for a string, not a regexp. | |
558 ;;; This could be considered to be the wrong thing. I decided to keep it | |
559 ;;; simple, and not make the user worry about regexps. This, of course, | |
560 ;;; limits functionality. | |
561 | |
562 ;;; These commands were deemed non-winning and have been commented out. | |
563 ;;; Feel free to re-enable them if you like. -Olin 3/91 | |
564 | |
565 ;(defun comint-psearch-input () | |
566 ; "Search forwards for next occurrence of prompt and skip to end of line. | |
567 ;\(prompt is anything matching regexp comint-prompt-regexp)" | |
568 ; (interactive) | |
569 ; (if (re-search-forward comint-prompt-regexp (point-max) t) | |
570 ; (end-of-line) | |
571 ; (error "No occurrence of prompt found"))) | |
572 ; | |
573 ;(defun comint-msearch-input () | |
574 ; "Search backwards for previous occurrence of prompt and skip to end of line. | |
575 ;Search starts from beginning of current line." | |
576 ; (interactive) | |
577 ; (let ((p (save-excursion | |
578 ; (beginning-of-line) | |
579 ; (cond ((re-search-backward comint-prompt-regexp (point-min) t) | |
580 ; (end-of-line) | |
581 ; (point)) | |
582 ; (t nil))))) | |
583 ; (if p (goto-char p) | |
584 ; (error "No occurrence of prompt found")))) | |
585 ; | |
586 ;(defun comint-msearch-input-matching (str) | |
587 ; "Search backwards for occurrence of prompt followed by STRING. | |
588 ;STRING is prompted for, and is NOT a regular expression." | |
589 ; (interactive (let ((s (read-from-minibuffer | |
590 ; (format "Command (default %s): " | |
591 ; comint-last-input-match)))) | |
592 ; (list (if (string= s "") comint-last-input-match s)))) | |
593 ;; (interactive "sCommand: ") | |
594 ; (setq comint-last-input-match str) ; update default | |
595 ; (let* ((r (concat comint-prompt-regexp (regexp-quote str))) | |
596 ; (p (save-excursion | |
597 ; (beginning-of-line) | |
598 ; (cond ((re-search-backward r (point-min) t) | |
599 ; (end-of-line) | |
600 ; (point)) | |
601 ; (t nil))))) | |
602 ; (if p (goto-char p) | |
603 ; (error "No match")))) | |
114 | 604 |
605 ;;; | |
606 ;;; Similar input -- contributed by ccm and highly winning. | |
607 ;;; | |
608 ;;; Reenter input, removing back to the last insert point if it exists. | |
609 ;;; | |
584 | 610 (defvar comint-last-similar-string "" |
611 "The string last used in a similar string search.") | |
114 | 612 (defun comint-previous-similar-input (arg) |
613 "Reenters the last input that matches the string typed so far. If repeated | |
614 successively older inputs are reentered. If arg is 1, it will go back | |
615 in the history, if -1 it will go forward." | |
616 (interactive "p") | |
584 | 617 (if (not (comint-after-pmark-p)) |
114 | 618 (error "Not after process mark")) |
619 (if (not (eq last-command 'comint-previous-similar-input)) | |
620 (setq input-ring-index -1 | |
584 | 621 comint-last-similar-string |
622 (buffer-substring | |
623 (process-mark (get-buffer-process (current-buffer))) | |
624 (point)))) | |
114 | 625 (let* ((size (length comint-last-similar-string)) |
626 (len (ring-length input-ring)) | |
627 (n (+ input-ring-index arg)) | |
628 entry) | |
629 (while (and (< n len) | |
630 (or (< (length (setq entry (ring-ref input-ring n))) size) | |
631 (not (equal comint-last-similar-string | |
632 (substring entry 0 size))))) | |
633 (setq n (+ n arg))) | |
634 (cond ((< n len) | |
635 (setq input-ring-index n) | |
636 (if (eq last-command 'comint-previous-similar-input) | |
584 | 637 (delete-region (mark) (point)) ; repeat |
638 (push-mark (point))) ; 1st time | |
114 | 639 (insert (substring entry size))) |
584 | 640 (t (message "Not found.") (ding) (sit-for 1))) |
641 (message "%d" (1+ input-ring-index)))) | |
642 | |
114 | 643 |
584 | 644 (defun comint-send-input () |
645 "Send input to process. After the process output mark, sends all text | |
646 from the process mark to point as input to the process. Before the process | |
647 output mark, calls value of variable comint-get-old-input to retrieve old | |
648 input, copies it to the process mark, and sends it. A terminal newline is | |
649 also inserted into the buffer and sent to the process. In either case, value | |
650 of variable comint-input-sentinel is called on the input before sending it. | |
651 The input is entered into the input history ring, if the value of variable | |
652 comint-input-filter returns non-nil when called on the input. | |
114 | 653 |
584 | 654 If variable comint-eol-on-send is non-nil, then point is moved to the end of |
655 line before sending the input. | |
114 | 656 |
657 comint-get-old-input, comint-input-sentinel, and comint-input-filter are chosen | |
584 | 658 according to the command interpreter running in the buffer. E.g., |
114 | 659 If the interpreter is the csh, |
584 | 660 comint-get-old-input is the default: take the current line, discard any |
661 initial string matching regexp comint-prompt-regexp. | |
662 comint-input-sentinel monitors input for \"cd\", \"pushd\", and \"popd\" | |
663 commands. When it sees one, it cd's the buffer. | |
664 comint-input-filter is the default: returns T if the input isn't all white | |
665 space. | |
114 | 666 |
667 If the comint is Lucid Common Lisp, | |
584 | 668 comint-get-old-input snarfs the sexp ending at point. |
669 comint-input-sentinel does nothing. | |
670 comint-input-filter returns NIL if the input matches input-filter-regexp, | |
114 | 671 which matches (1) all whitespace (2) :a, :c, etc. |
672 | |
584 | 673 Similarly for Soar, Scheme, etc.." |
114 | 674 (interactive) |
675 ;; Note that the input string does not include its terminal newline. | |
584 | 676 (let ((proc (get-buffer-process (current-buffer)))) |
677 (if (not proc) (error "Current buffer has no process") | |
678 (let* ((pmark (process-mark proc)) | |
679 (pmark-val (marker-position pmark)) | |
680 (input (if (>= (point) pmark-val) | |
681 (progn (if comint-eol-on-send (end-of-line)) | |
682 (buffer-substring pmark (point))) | |
705 | 683 (let ((copy (funcall comint-get-old-input))) |
684 (goto-char pmark) | |
685 (insert copy) | |
686 copy)))) | |
584 | 687 (insert ?\n) |
688 (if (funcall comint-input-filter input) (ring-insert input-ring input)) | |
689 (funcall comint-input-sentinel input) | |
690 (funcall comint-input-sender proc input) | |
705 | 691 (set-marker comint-last-input-start pmark) |
692 (set-marker comint-last-input-end (point)) | |
693 (set-marker (process-mark proc) (point)))))) | |
114 | 694 |
695 (defun comint-get-old-input-default () | |
584 | 696 "Default for comint-get-old-input: take the current line, and discard |
697 any initial text matching comint-prompt-regexp." | |
114 | 698 (save-excursion |
584 | 699 (beginning-of-line) |
700 (comint-skip-prompt) | |
701 (let ((beg (point))) | |
702 (end-of-line) | |
703 (buffer-substring beg (point))))) | |
704 | |
705 (defun comint-skip-prompt () | |
706 "Skip past the text matching regexp comint-prompt-regexp. | |
707 If this takes us past the end of the current line, don't skip at all." | |
708 (let ((eol (save-excursion (end-of-line) (point)))) | |
709 (if (and (looking-at comint-prompt-regexp) | |
710 (<= (match-end 0) eol)) | |
711 (goto-char (match-end 0))))) | |
712 | |
713 | |
714 (defun comint-after-pmark-p () | |
715 "Is point after the process output marker?" | |
716 ;; Since output could come into the buffer after we looked at the point | |
717 ;; but before we looked at the process marker's value, we explicitly | |
718 ;; serialise. This is just because I don't know whether or not emacs | |
719 ;; services input during execution of lisp commands. | |
720 (let ((proc-pos (marker-position | |
721 (process-mark (get-buffer-process (current-buffer)))))) | |
722 (<= proc-pos (point)))) | |
723 | |
724 (defun comint-simple-send (proc string) | |
725 "Default function for sending to PROC input STRING. | |
726 This just sends STRING plus a newline. To override this, | |
727 set the hook COMINT-INPUT-SENDER." | |
728 (comint-send-string proc string) | |
729 (comint-send-string proc "\n")) | |
114 | 730 |
731 (defun comint-bol (arg) | |
732 "Goes to the beginning of line, then skips past the prompt, if any. | |
584 | 733 If a prefix argument is given (\\[universal-argument]), then no prompt skip |
734 -- go straight to column 0. | |
114 | 735 |
584 | 736 The prompt skip is done by skipping text matching the regular expression |
737 comint-prompt-regexp, a buffer local variable. | |
738 | |
739 If you don't like this command, reset c-a to beginning-of-line | |
740 in your hook, comint-mode-hook." | |
114 | 741 (interactive "P") |
742 (beginning-of-line) | |
584 | 743 (if (null arg) (comint-skip-prompt))) |
114 | 744 |
745 ;;; These two functions are for entering text you don't want echoed or | |
746 ;;; saved -- typically passwords to ftp, telnet, or somesuch. | |
584 | 747 ;;; Just enter m-x send-invisible and type in your line. |
748 | |
705 | 749 (defun comint-read-noecho (prompt &optional stars) |
584 | 750 "Prompt the user with argument PROMPT. Read a single line of text |
751 without echoing, and return it. Note that the keystrokes comprising | |
752 the text can still be recovered (temporarily) with \\[view-lossage]. This | |
705 | 753 may be a security bug for some applications. Optional argument STARS |
754 causes input to be echoed with '*' characters on the prompt line." | |
114 | 755 (let ((echo-keystrokes 0) |
705 | 756 (cursor-in-echo-area t) |
114 | 757 (answ "") |
758 tem) | |
705 | 759 (if (not (stringp prompt)) (setq prompt "")) |
760 (message prompt) | |
584 | 761 (while (not(or (= (setq tem (read-char)) ?\^m) |
114 | 762 (= tem ?\n))) |
705 | 763 (setq answ (concat answ (char-to-string tem))) |
764 (if stars (setq prompt (concat prompt "*"))) | |
765 (message prompt)) | |
114 | 766 (message "") |
767 answ)) | |
768 | |
705 | 769 |
114 | 770 (defun send-invisible (str) |
584 | 771 "Read a string without echoing, and send it to the process running |
772 in the current buffer. A new-line is additionally sent. String is not | |
773 saved on comint input history list. | |
774 Security bug: your string can still be temporarily recovered with | |
775 \\[view-lossage]." | |
114 | 776 ; (interactive (list (comint-read-noecho "Enter non-echoed text"))) |
777 (interactive "P") ; Defeat snooping via C-x esc | |
778 (let ((proc (get-buffer-process (current-buffer)))) | |
779 (if (not proc) (error "Current buffer has no process") | |
780 (comint-send-string proc | |
781 (if (stringp str) str | |
705 | 782 (comint-read-noecho "Non-echoed text: " t))) |
114 | 783 (comint-send-string proc "\n")))) |
784 | |
785 | |
786 ;;; Low-level process communication | |
787 | |
788 (defvar comint-input-chunk-size 512 | |
789 "*Long inputs send to comint processes are broken up into chunks of this size. | |
790 If your process is choking on big inputs, try lowering the value.") | |
791 | |
792 (defun comint-send-string (proc str) | |
793 "Send PROCESS the contents of STRING as input. | |
794 This is equivalent to process-send-string, except that long input strings | |
795 are broken up into chunks of size comint-input-chunk-size. Processes | |
796 are given a chance to output between chunks. This can help prevent processes | |
797 from hanging when you send them long inputs on some OS's." | |
798 (let* ((len (length str)) | |
799 (i (min len comint-input-chunk-size))) | |
800 (process-send-string proc (substring str 0 i)) | |
801 (while (< i len) | |
802 (let ((next-i (+ i comint-input-chunk-size))) | |
803 (accept-process-output) | |
804 (process-send-string proc (substring str i (min len next-i))) | |
805 (setq i next-i))))) | |
806 | |
807 (defun comint-send-region (proc start end) | |
808 "Sends to PROC the region delimited by START and END. | |
809 This is a replacement for process-send-region that tries to keep | |
810 your process from hanging on long inputs. See comint-send-string." | |
811 (comint-send-string proc (buffer-substring start end))) | |
812 | |
813 | |
814 ;;; Random input hackage | |
815 | |
584 | 816 (defun comint-kill-output () |
114 | 817 "Kill all output from interpreter since last input." |
818 (interactive) | |
584 | 819 (let ((pmark (process-mark (get-buffer-process (current-buffer))))) |
820 (kill-region comint-last-input-end pmark) | |
821 (goto-char pmark) | |
822 (insert "*** output flushed ***\n") | |
823 (set-marker pmark (point)))) | |
114 | 824 |
825 (defun comint-show-output () | |
584 | 826 "Display start of this batch of interpreter output at top of window. |
827 Also put cursor there." | |
114 | 828 (interactive) |
829 (goto-char comint-last-input-end) | |
584 | 830 (backward-char) |
114 | 831 (beginning-of-line) |
832 (set-window-start (selected-window) (point)) | |
584 | 833 (end-of-line)) |
114 | 834 |
835 (defun comint-interrupt-subjob () | |
584 | 836 "Interrupt the current subjob." |
114 | 837 (interactive) |
584 | 838 (interrupt-process nil comint-ptyp)) |
114 | 839 |
840 (defun comint-kill-subjob () | |
584 | 841 "Send kill signal to the current subjob." |
114 | 842 (interactive) |
584 | 843 (kill-process nil comint-ptyp)) |
114 | 844 |
845 (defun comint-quit-subjob () | |
584 | 846 "Send quit signal to the current subjob." |
114 | 847 (interactive) |
584 | 848 (quit-process nil comint-ptyp)) |
114 | 849 |
850 (defun comint-stop-subjob () | |
584 | 851 "Stop the current subjob. |
114 | 852 WARNING: if there is no current subjob, you can end up suspending |
584 | 853 the top-level process running in the buffer. If you accidentally do |
854 this, use \\[comint-continue-subjob] to resume the process. (This | |
855 is not a problem with most shells, since they ignore this signal.)" | |
114 | 856 (interactive) |
584 | 857 (stop-process nil comint-ptyp)) |
114 | 858 |
859 (defun comint-continue-subjob () | |
584 | 860 "Send CONT signal to process buffer's process group. |
114 | 861 Useful if you accidentally suspend the top-level process." |
862 (interactive) | |
584 | 863 (continue-process nil comint-ptyp)) |
114 | 864 |
865 (defun comint-kill-input () | |
584 | 866 "Kill all text from last stuff output by interpreter to point." |
114 | 867 (interactive) |
584 | 868 (let* ((pmark (process-mark (get-buffer-process (current-buffer)))) |
869 (p-pos (marker-position pmark))) | |
870 (if (> (point) p-pos) | |
871 (kill-region pmark (point))))) | |
114 | 872 |
873 (defun comint-delchar-or-maybe-eof (arg) | |
874 "Delete ARG characters forward, or send an EOF to process if at end of buffer." | |
875 (interactive "p") | |
876 (if (eobp) | |
877 (process-send-eof) | |
584 | 878 (delete-char arg))) |
879 | |
880 | |
881 | |
114 | 882 |
883 ;;; Support for source-file processing commands. | |
884 ;;;============================================================================ | |
885 ;;; Many command-interpreters (e.g., Lisp, Scheme, Soar) have | |
886 ;;; commands that process files of source text (e.g. loading or compiling | |
887 ;;; files). So the corresponding process-in-a-buffer modes have commands | |
888 ;;; for doing this (e.g., lisp-load-file). The functions below are useful | |
889 ;;; for defining these commands. | |
890 ;;; | |
891 ;;; Alas, these guys don't do exactly the right thing for Lisp, Scheme | |
892 ;;; and Soar, in that they don't know anything about file extensions. | |
893 ;;; So the compile/load interface gets the wrong default occasionally. | |
894 ;;; The load-file/compile-file default mechanism could be smarter -- it | |
895 ;;; doesn't know about the relationship between filename extensions and | |
896 ;;; whether the file is source or executable. If you compile foo.lisp | |
897 ;;; with compile-file, then the next load-file should use foo.bin for | |
898 ;;; the default, not foo.lisp. This is tricky to do right, particularly | |
899 ;;; because the extension for executable files varies so much (.o, .bin, | |
900 ;;; .lbin, .mo, .vo, .ao, ...). | |
901 | |
902 | |
903 ;;; COMINT-SOURCE-DEFAULT -- determines defaults for source-file processing | |
904 ;;; commands. | |
905 ;;; | |
906 ;;; COMINT-CHECK-SOURCE -- if FNAME is in a modified buffer, asks you if you | |
907 ;;; want to save the buffer before issuing any process requests to the command | |
908 ;;; interpreter. | |
909 ;;; | |
910 ;;; COMINT-GET-SOURCE -- used by the source-file processing commands to prompt | |
911 ;;; for the file to process. | |
912 | |
913 ;;; (COMINT-SOURCE-DEFAULT previous-dir/file source-modes) | |
914 ;;;============================================================================ | |
915 ;;; This function computes the defaults for the load-file and compile-file | |
584 | 916 ;;; commands for tea, soar, cmulisp, and cmuscheme modes. |
114 | 917 ;;; |
918 ;;; - PREVIOUS-DIR/FILE is a pair (directory . filename) from the last | |
919 ;;; source-file processing command. NIL if there hasn't been one yet. | |
920 ;;; - SOURCE-MODES is a list used to determine what buffers contain source | |
921 ;;; files: if the major mode of the buffer is in SOURCE-MODES, it's source. | |
922 ;;; Typically, (lisp-mode) or (scheme-mode). | |
923 ;;; | |
924 ;;; If the command is given while the cursor is inside a string, *and* | |
925 ;;; the string is an existing filename, *and* the filename is not a directory, | |
926 ;;; then the string is taken as default. This allows you to just position | |
927 ;;; your cursor over a string that's a filename and have it taken as default. | |
928 ;;; | |
929 ;;; If the command is given in a file buffer whose major mode is in | |
930 ;;; SOURCE-MODES, then the the filename is the default file, and the | |
931 ;;; file's directory is the default directory. | |
932 ;;; | |
933 ;;; If the buffer isn't a source file buffer (e.g., it's the process buffer), | |
934 ;;; then the default directory & file are what was used in the last source-file | |
935 ;;; processing command (i.e., PREVIOUS-DIR/FILE). If this is the first time | |
936 ;;; the command has been run (PREVIOUS-DIR/FILE is nil), the default directory | |
937 ;;; is the cwd, with no default file. (\"no default file\" = nil) | |
938 ;;; | |
939 ;;; SOURCE-REGEXP is typically going to be something like (tea-mode) | |
940 ;;; for T programs, (lisp-mode) for Lisp programs, (soar-mode lisp-mode) | |
941 ;;; for Soar programs, etc. | |
942 ;;; | |
943 ;;; The function returns a pair: (default-directory . default-file). | |
944 | |
945 (defun comint-source-default (previous-dir/file source-modes) | |
946 (cond ((and buffer-file-name (memq major-mode source-modes)) | |
947 (cons (file-name-directory buffer-file-name) | |
948 (file-name-nondirectory buffer-file-name))) | |
949 (previous-dir/file) | |
950 (t | |
951 (cons default-directory nil)))) | |
952 | |
584 | 953 |
114 | 954 ;;; (COMINT-CHECK-SOURCE fname) |
955 ;;;============================================================================ | |
584 | 956 ;;; Prior to loading or compiling (or otherwise processing) a file (in the CMU |
114 | 957 ;;; process-in-a-buffer modes), this function can be called on the filename. |
958 ;;; If the file is loaded into a buffer, and the buffer is modified, the user | |
959 ;;; is queried to see if he wants to save the buffer before proceeding with | |
960 ;;; the load or compile. | |
961 | |
962 (defun comint-check-source (fname) | |
963 (let ((buff (get-file-buffer fname))) | |
964 (if (and buff | |
965 (buffer-modified-p buff) | |
966 (y-or-n-p (format "Save buffer %s first? " | |
967 (buffer-name buff)))) | |
968 ;; save BUFF. | |
969 (let ((old-buffer (current-buffer))) | |
970 (set-buffer buff) | |
971 (save-buffer) | |
972 (set-buffer old-buffer))))) | |
973 | |
584 | 974 |
114 | 975 ;;; (COMINT-GET-SOURCE prompt prev-dir/file source-modes mustmatch-p) |
976 ;;;============================================================================ | |
977 ;;; COMINT-GET-SOURCE is used to prompt for filenames in command-interpreter | |
978 ;;; commands that process source files (like loading or compiling a file). | |
979 ;;; It prompts for the filename, provides a default, if there is one, | |
980 ;;; and returns the result filename. | |
981 ;;; | |
982 ;;; See COMINT-SOURCE-DEFAULT for more on determining defaults. | |
983 ;;; | |
984 ;;; PROMPT is the prompt string. PREV-DIR/FILE is the (directory . file) pair | |
985 ;;; from the last source processing command. SOURCE-MODES is a list of major | |
986 ;;; modes used to determine what file buffers contain source files. (These | |
987 ;;; two arguments are used for determining defaults). If MUSTMATCH-P is true, | |
988 ;;; then the filename reader will only accept a file that exists. | |
989 ;;; | |
990 ;;; A typical use: | |
991 ;;; (interactive (comint-get-source "Compile file: " prev-lisp-dir/file | |
992 ;;; '(lisp-mode) t)) | |
993 | |
994 ;;; This is pretty stupid about strings. It decides we're in a string | |
995 ;;; if there's a quote on both sides of point on the current line. | |
996 (defun comint-extract-string () | |
997 "Returns string around point that starts the current line or nil." | |
998 (save-excursion | |
999 (let* ((point (point)) | |
1000 (bol (progn (beginning-of-line) (point))) | |
1001 (eol (progn (end-of-line) (point))) | |
1002 (start (progn (goto-char point) | |
1003 (and (search-backward "\"" bol t) | |
1004 (1+ (point))))) | |
1005 (end (progn (goto-char point) | |
1006 (and (search-forward "\"" eol t) | |
1007 (1- (point)))))) | |
1008 (and start end | |
1009 (buffer-substring start end))))) | |
1010 | |
1011 (defun comint-get-source (prompt prev-dir/file source-modes mustmatch-p) | |
1012 (let* ((def (comint-source-default prev-dir/file source-modes)) | |
1013 (stringfile (comint-extract-string)) | |
1014 (sfile-p (and stringfile | |
584 | 1015 (condition-case () |
1016 (file-exists-p stringfile) | |
1017 (error nil)) | |
114 | 1018 (not (file-directory-p stringfile)))) |
1019 (defdir (if sfile-p (file-name-directory stringfile) | |
1020 (car def))) | |
1021 (deffile (if sfile-p (file-name-nondirectory stringfile) | |
1022 (cdr def))) | |
1023 (ans (read-file-name (if deffile (format "%s(default %s) " | |
1024 prompt deffile) | |
1025 prompt) | |
1026 defdir | |
1027 (concat defdir deffile) | |
1028 mustmatch-p))) | |
1029 (list (expand-file-name (substitute-in-file-name ans))))) | |
1030 | |
584 | 1031 ;;; I am somewhat divided on this string-default feature. It seems |
1032 ;;; to violate the principle-of-least-astonishment, in that it makes | |
1033 ;;; the default harder to predict, so you actually have to look and see | |
1034 ;;; what the default really is before choosing it. This can trip you up. | |
1035 ;;; On the other hand, it can be useful, I guess. I would appreciate feedback | |
1036 ;;; on this. | |
1037 ;;; -Olin | |
1038 | |
114 | 1039 |
1040 ;;; Simple process query facility. | |
1041 ;;; =========================================================================== | |
1042 ;;; This function is for commands that want to send a query to the process | |
1043 ;;; and show the response to the user. For example, a command to get the | |
1044 ;;; arglist for a Common Lisp function might send a "(arglist 'foo)" query | |
1045 ;;; to an inferior Common Lisp process. | |
1046 ;;; | |
1047 ;;; This simple facility just sends strings to the inferior process and pops | |
1048 ;;; up a window for the process buffer so you can see what the process | |
1049 ;;; responds with. We don't do anything fancy like try to intercept what the | |
1050 ;;; process responds with and put it in a pop-up window or on the message | |
1051 ;;; line. We just display the buffer. Low tech. Simple. Works good. | |
1052 | |
1053 ;;; Send to the inferior process PROC the string STR. Pop-up but do not select | |
1054 ;;; a window for the inferior process so that its response can be seen. | |
1055 (defun comint-proc-query (proc str) | |
1056 (let* ((proc-buf (process-buffer proc)) | |
1057 (proc-mark (process-mark proc))) | |
1058 (display-buffer proc-buf) | |
1059 (set-buffer proc-buf) ; but it's not the selected *window* | |
1060 (let ((proc-win (get-buffer-window proc-buf)) | |
1061 (proc-pt (marker-position proc-mark))) | |
1062 (comint-send-string proc str) ; send the query | |
1063 (accept-process-output proc) ; wait for some output | |
1064 ;; Try to position the proc window so you can see the answer. | |
1065 ;; This is bogus code. If you delete the (sit-for 0), it breaks. | |
1066 ;; I don't know why. Wizards invited to improve it. | |
1067 (if (not (pos-visible-in-window-p proc-pt proc-win)) | |
1068 (let ((opoint (window-point proc-win))) | |
1069 (set-window-point proc-win proc-mark) (sit-for 0) | |
1070 (if (not (pos-visible-in-window-p opoint proc-win)) | |
1071 (push-mark opoint) | |
1072 (set-window-point proc-win opoint))))))) | |
1073 | |
1074 | |
1075 ;;; Filename completion in a buffer | |
1076 ;;; =========================================================================== | |
1077 ;;; Useful completion functions, courtesy of the Ergo group. | |
1078 ;;; M-<Tab> will complete the filename at the cursor as much as possible | |
1079 ;;; M-? will display a list of completions in the help buffer. | |
1080 | |
1081 ;;; Three commands: | |
1082 ;;; comint-dynamic-complete Complete filename at point. | |
1083 ;;; comint-dynamic-list-completions List completions in help buffer. | |
1084 ;;; comint-replace-by-expanded-filename Expand and complete filename at point; | |
1085 ;;; replace with expanded/completed name. | |
1086 | |
1087 ;;; These are not installed in the comint-mode keymap. But they are | |
584 | 1088 ;;; available for people who want them. Shell-mode installs them: |
1089 ;;; (define-key cmushell-mode-map "\M-\t" 'comint-dynamic-complete) | |
1090 ;;; (define-key cmushell-mode-map "\M-?" 'comint-dynamic-list-completions))) | |
1091 ;;; | |
1092 ;;; Commands like this are fine things to put in load hooks if you | |
1093 ;;; want them present in specific modes. Example: | |
1094 ;;; (setq cmushell-load-hook | |
1095 ;;; '((lambda () (define-key lisp-mode-map "\M-\t" | |
1096 ;;; 'comint-replace-by-expanded-filename)))) | |
1097 ;;; | |
1098 | |
114 | 1099 |
1100 (defun comint-match-partial-pathname () | |
584 | 1101 "Returns the filename at point or causes an error." |
1102 (save-excursion | |
1103 (if (re-search-backward "[^~/A-Za-z0-9---_.$#,=]" nil 'move) | |
1104 (forward-char 1)) | |
1105 ;; Anchor the search forwards. | |
1106 (if (not (looking-at "[~/A-Za-z0-9---_.$#,=]")) (error "")) | |
1107 (re-search-forward "[~/A-Za-z0-9---_.$#,=]+") | |
1108 (substitute-in-file-name | |
1109 (buffer-substring (match-beginning 0) (match-end 0))))) | |
1110 | |
114 | 1111 |
1112 (defun comint-replace-by-expanded-filename () | |
584 | 1113 "Replace the filename at point with an expanded, canonicalised, and |
1114 completed replacement. | |
114 | 1115 \"Expanded\" means environment variables (e.g., $HOME) and ~'s are |
1116 replaced with the corresponding directories. \"Canonicalised\" means .. | |
584 | 1117 and \. are removed, and the filename is made absolute instead of relative. |
1118 See functions expand-file-name and substitute-in-file-name. See also | |
114 | 1119 comint-dynamic-complete." |
1120 (interactive) | |
1121 (let* ((pathname (comint-match-partial-pathname)) | |
1122 (pathdir (file-name-directory pathname)) | |
1123 (pathnondir (file-name-nondirectory pathname)) | |
1124 (completion (file-name-completion pathnondir | |
1125 (or pathdir default-directory)))) | |
1126 (cond ((null completion) | |
584 | 1127 (message "No completions of %s." pathname) |
1128 (ding)) | |
114 | 1129 ((eql completion t) |
584 | 1130 (message "Unique completion.")) |
114 | 1131 (t ; this means a string was returned. |
1132 (delete-region (match-beginning 0) (match-end 0)) | |
1133 (insert (expand-file-name (concat pathdir completion))))))) | |
1134 | |
584 | 1135 |
114 | 1136 (defun comint-dynamic-complete () |
584 | 1137 "Dynamically complete the filename at point. |
114 | 1138 This function is similar to comint-replace-by-expanded-filename, except |
1139 that it won't change parts of the filename already entered in the buffer; | |
1140 it just adds completion characters to the end of the filename." | |
1141 (interactive) | |
1142 (let* ((pathname (comint-match-partial-pathname)) | |
1143 (pathdir (file-name-directory pathname)) | |
1144 (pathnondir (file-name-nondirectory pathname)) | |
584 | 1145 (completion (file-name-completion pathnondir |
114 | 1146 (or pathdir default-directory)))) |
1147 (cond ((null completion) | |
584 | 1148 (message "No completions of %s." pathname) |
1149 (ding)) | |
114 | 1150 ((eql completion t) |
584 | 1151 (message "Unique completion.")) |
114 | 1152 (t ; this means a string was returned. |
1153 (goto-char (match-end 0)) | |
1154 (insert (substring completion (length pathnondir))))))) | |
1155 | |
1156 (defun comint-dynamic-list-completions () | |
584 | 1157 "List in help buffer all possible completions of the filename at point." |
114 | 1158 (interactive) |
1159 (let* ((pathname (comint-match-partial-pathname)) | |
1160 (pathdir (file-name-directory pathname)) | |
1161 (pathnondir (file-name-nondirectory pathname)) | |
1162 (completions | |
1163 (file-name-all-completions pathnondir | |
1164 (or pathdir default-directory)))) | |
1165 (cond ((null completions) | |
584 | 1166 (message "No completions of %s." pathname) |
1167 (ding)) | |
114 | 1168 (t |
1169 (let ((conf (current-window-configuration))) | |
584 | 1170 (with-output-to-temp-buffer "*Help*" |
114 | 1171 (display-completion-list completions)) |
1172 (sit-for 0) | |
1173 (message "Hit space to flush.") | |
1174 (let ((ch (read-char))) | |
1175 (if (= ch ?\ ) | |
1176 (set-window-configuration conf) | |
1177 (setq unread-command-char ch)))))))) | |
1178 | |
584 | 1179 ; Ergo bindings |
1180 ; (global-set-key "\M-\t" 'comint-replace-by-expanded-filename) | |
1181 ; (global-set-key "\M-?" 'comint-dynamic-list-completions) | |
1182 ; (define-key shell-mode-map "\M-\t" 'comint-dynamic-complete) | |
114 | 1183 |
1184 ;;; Converting process modes to use comint mode | |
1185 ;;; =========================================================================== | |
584 | 1186 ;;; Several gnu packages (tex-mode, background, dbx, gdb, kermit, prolog, |
1187 ;;; telnet are some) use the shell package as clients. Most of them would | |
1188 ;;; be better off using the comint package, but they predate it. | |
1189 ;;; | |
1190 ;;; Altering these packages to use comint mode should greatly | |
1191 ;;; improve their functionality, and is fairly easy. | |
1192 ;;; | |
114 | 1193 ;;; Renaming variables |
584 | 1194 ;;; Most of the work is renaming variables and functions. These are the common |
1195 ;;; ones: | |
1196 ;;; Local variables: | |
705 | 1197 ;;; last-input-start comint-last-input-start |
584 | 1198 ;;; last-input-end comint-last-input-end |
1199 ;;; shell-prompt-pattern comint-prompt-regexp | |
1200 ;;; shell-set-directory-error-hook <no equivalent> | |
1201 ;;; Miscellaneous: | |
114 | 1202 ;;; shell-set-directory <unnecessary> |
1203 ;;; shell-mode-map comint-mode-map | |
584 | 1204 ;;; Commands: |
114 | 1205 ;;; shell-send-input comint-send-input |
1206 ;;; shell-send-eof comint-delchar-or-maybe-eof | |
1207 ;;; kill-shell-input comint-kill-input | |
1208 ;;; interrupt-shell-subjob comint-interrupt-subjob | |
1209 ;;; stop-shell-subjob comint-stop-subjob | |
1210 ;;; quit-shell-subjob comint-quit-subjob | |
1211 ;;; kill-shell-subjob comint-kill-subjob | |
1212 ;;; kill-output-from-shell comint-kill-output | |
1213 ;;; show-output-from-shell comint-show-output | |
1214 ;;; copy-last-shell-input Use comint-previous-input/comint-next-input | |
1215 ;;; | |
705 | 1216 ;;; SHELL-SET-DIRECTORY is gone, its functionality taken over by |
1217 ;;; SHELL-DIRECTORY-TRACKER, the shell mode's comint-input-sentinel. | |
1218 ;;; Comint mode does not provide functionality equivalent to | |
114 | 1219 ;;; shell-set-directory-error-hook; it is gone. |
705 | 1220 ;;; |
1221 ;;; comint-last-input-start is provided for modes which want to munge | |
1222 ;;; the buffer after input is sent, perhaps because the inferior | |
1223 ;;; insists on echoing the input. The LAST-INPUT-START variable in | |
1224 ;;; the old shell package was used to implement a history mechanism, | |
1225 ;;; but you should think twice before using comint-last-input-start | |
1226 ;;; for this; the input history ring often does the job better. | |
114 | 1227 ;;; |
1228 ;;; If you are implementing some process-in-a-buffer mode, called foo-mode, do | |
1229 ;;; *not* create the comint-mode local variables in your foo-mode function. | |
1230 ;;; This is not modular. Instead, call comint-mode, and let *it* create the | |
1231 ;;; necessary comint-specific local variables. Then create the | |
1232 ;;; foo-mode-specific local variables in foo-mode. Set the buffer's keymap to | |
1233 ;;; be foo-mode-map, and its mode to be foo-mode. Set the comint-mode hooks | |
1234 ;;; (comint-prompt-regexp, comint-input-filter, comint-input-sentinel, | |
1235 ;;; comint-get-old-input) that need to be different from the defaults. Call | |
1236 ;;; foo-mode-hook, and you're done. Don't run the comint-mode hook yourself; | |
584 | 1237 ;;; comint-mode will take care of it. The following example, from cmushell.el, |
1238 ;;; is typical: | |
1239 ;;; | |
1240 ;;; (defun shell-mode () | |
1241 ;;; (interactive) | |
1242 ;;; (comint-mode) | |
1243 ;;; (setq comint-prompt-regexp shell-prompt-pattern) | |
1244 ;;; (setq major-mode 'shell-mode) | |
1245 ;;; (setq mode-name "Shell") | |
1246 ;;; (cond ((not shell-mode-map) | |
1247 ;;; (setq shell-mode-map (full-copy-sparse-keymap comint-mode-map)) | |
1248 ;;; (define-key shell-mode-map "\M-\t" 'comint-dynamic-complete) | |
1249 ;;; (define-key shell-mode-map "\M-?" | |
1250 ;;; 'comint-dynamic-list-completions))) | |
1251 ;;; (use-local-map shell-mode-map) | |
1252 ;;; (make-local-variable 'shell-directory-stack) | |
1253 ;;; (setq shell-directory-stack nil) | |
1254 ;;; (setq comint-input-sentinel 'shell-directory-tracker) | |
1255 ;;; (run-hooks 'shell-mode-hook)) | |
1256 ;;; | |
114 | 1257 ;;; |
1258 ;;; Note that make-comint is different from make-shell in that it | |
1259 ;;; doesn't have a default program argument. If you give make-shell | |
1260 ;;; a program name of NIL, it cleverly chooses one of explicit-shell-name, | |
1261 ;;; $ESHELL, $SHELL, or /bin/sh. If you give make-comint a program argument | |
1262 ;;; of NIL, it barfs. Adjust your code accordingly... | |
584 | 1263 ;;; |
1264 | |
1265 ;;; Do the user's customisation... | |
1266 | |
1267 (defvar comint-load-hook nil | |
1268 "This hook is run when comint is loaded in. | |
1269 This is a good place to put keybindings.") | |
1270 | |
1271 (run-hooks 'comint-load-hook) | |
1272 | |
1273 ;;; Change log: | |
1274 ;;; 9/12/89 | |
1275 ;;; - Souped up the filename expansion procedures. | |
1276 ;;; Doc strings are much clearer and more detailed. | |
1277 ;;; Fixed a bug where doing a filename completion when the point | |
1278 ;;; was in the middle of the filename instead of at the end would lose. | |
1279 ;;; | |
1280 ;;; 2/17/90 | |
1281 ;;; - Souped up the command history stuff so that text inserted | |
1282 ;;; by comint-previous-input-matching is removed by following | |
1283 ;;; command history recalls. comint-next/previous-input-matching | |
1284 ;;; is now much more smoothly integrated w/the command history stuff. | |
1285 ;;; - Added comint-eol-on-send flag and comint-input-sender hook. | |
1286 ;;; Comint-input-sender based on code contributed by Jeff Peck | |
1287 ;;; (peck@sun.com). | |
1288 ;;; | |
1289 ;;; 3/13/90 ccm@cmu.cs.edu | |
1290 ;;; - Added comint-previous-similar-input for looking up similar inputs. | |
1291 ;;; - Added comint-send-and-get-output to allow snarfing input from | |
1292 ;;; buffer. | |
1293 ;;; - Added the ability to pick up a source file by positioning over | |
1294 ;;; a string in comint-get-source. | |
1295 ;;; - Added add-hook to make it a little easier for the user to use | |
1296 ;;; multiple hooks. | |
1297 ;;; | |
1298 ;;; 5/22/90 shivers | |
1299 ;;; - Moved Chris' multiplexed ipc stuff to comint-ipc.el. | |
1300 ;;; - Altered Chris' comint-get-source string feature. The string | |
1301 ;;; is only offered as a default if it names an existing file. | |
1302 ;;; - Changed comint-exec to directly crank up the process, instead | |
1303 ;;; of calling the env program. This made background.el happy. | |
1304 ;;; - Added new buffer-local var comint-ptyp. The problem is that | |
1305 ;;; the signalling functions don't work as advertised. If you are | |
1306 ;;; communicating via pipes, the CURRENT-GROUP arg is supposed to | |
1307 ;;; be ignored, but, unfortunately it seems to be the case that you | |
1308 ;;; must pass a NIL for this arg in the pipe case. COMINT-PTYP | |
1309 ;;; is a flag that tells whether the process is communicating | |
1310 ;;; via pipes or a pty. The comint signalling functions use it | |
1311 ;;; to determine the necessary CURRENT-GROUP arg value. The bug | |
1312 ;;; has been reported to the Gnu folks. | |
1313 ;;; - comint-dynamic-complete flushes the help window if you hit space | |
1314 ;;; after you execute it. | |
1315 ;;; - Added functions comint-send-string, comint-send-region and var | |
1316 ;;; comint-input-chunk-size. comint-send-string tries to prevent processes | |
1317 ;;; from hanging when you send them long strings by breaking them into | |
1318 ;;; chunks and allowing process output between chunks. I got the idea from | |
1319 ;;; Eero Simoncelli's Common Lisp package. Note that using | |
1320 ;;; comint-send-string means that the process buffer's contents can change | |
1321 ;;; during a call! If you depend on process output only happening between | |
1322 ;;; toplevel commands, this could be a problem. In such a case, use | |
1323 ;;; process-send-string instead. If this is a problem for people, I'd like | |
1324 ;;; to hear about it. | |
1325 ;;; - Added comint-proc-query as a simple mechanism for commands that | |
1326 ;;; want to query an inferior process and display its response. For a | |
1327 ;;; typical use, see lisp-show-arglist in cmulisp.el. | |
1328 ;;; - Added constant comint-version, which is now "2.01". | |
1329 ;;; | |
1330 ;;; 6/14/90 shivers | |
1331 ;;; - Had comint-update-env defined twice. Removed extra copy. Also | |
1332 ;;; renamed mem to be comint-mem, for modularity. The duplication | |
1333 ;;; was reported by Michael Meissner. | |
1334 ;;; 6/16/90 shivers | |
1335 ;;; - Emacs has two different mechanisms for maintaining the process | |
1336 ;;; environment, determined at compile time by the MAINTAIN-ENVIRONMENT | |
1337 ;;; #define. One uses the process-environment global variable, and | |
1338 ;;; one uses a getenv/setenv interface. comint-exec assumed the | |
1339 ;;; process-environment interface; it has been generalised (with | |
1340 ;;; comint-exec-1) to handle both cases. Pretty bogus. We could, | |
1341 ;;; of course, skip all this and just use the etc/env program to | |
1342 ;;; handle the environment tweaking, but that obscures process | |
1343 ;;; queries that other modules (like background.el) depend on. etc/env | |
1344 ;;; is also fairly bogus. This bug, and some of the fix code was | |
1345 ;;; reported by Dan Pierson. | |
1346 ;;; | |
1347 ;;; 9/5/90 shivers | |
1348 ;;; - Changed make-variable-buffer-local's to make-local-variable's. | |
1349 ;;; This leaves non-comint-mode buffers alone. Stephane Payrard | |
1350 ;;; reported the sloppy useage. | |
1351 ;;; - You can now go from comint-previous-similar-input to | |
1352 ;;; comint-previous-input with no problem. | |
1353 ;;; | |
1354 ;;; 12/21/90 shivers | |
1355 ;;; - Added a condition-case to comint-get-source. Bogus strings | |
1356 ;;; beginning with ~ were making the file-exists-p barf. | |
1357 ;;; - Added "=" to the set of chars recognised by file completion | |
1358 ;;; as constituting a filename. | |
1359 ;;; | |
1360 ;;; 1/90 shivers | |
1361 ;;; These changes comprise release 2.02: | |
1362 ;;; - Removed the kill-all-local-variables in comint-mode. This | |
1363 ;;; made it impossible for client modes to set things before calling | |
1364 ;;; comint-mode. (In particular, it messed up ilisp.el) In general, | |
1365 ;;; the client mode should be responsible for a k-a-l-v's. | |
1366 ;;; - Fixed comint-match-partial-pathname so that it works in | |
1367 ;;; more cases: if the filename begins at the start-of-buffer; | |
1368 ;;; if point is on the first char of the filename. Just a question | |
1369 ;;; of getting the tricky bits right. | |
1370 ;;; - Added a hook, comint-exec-hook that is run each time a process | |
1371 ;;; is cranked up. Useful for things like process-kill-without-query. | |
1372 ;;; | |
705 | 1373 ;;; These two were pointed out by tale: |
584 | 1374 ;;; - Improved the doc string in comint-send-input a little bit. |
1375 ;;; - Tweaked make-comint to check process status with comint-check-proc | |
1376 ;;; instead of equivalent inline code. | |
705 | 1377 ;;; |
584 | 1378 ;;; - Prompt-search history commands have been commented out. I never |
1379 ;;; liked them; I don't think anyone used them. | |
705 | 1380 ;;; - Made comint-exec-hook a local var, as it should have been. |
1381 ;;; (This way, for instance, you can have cmushell procs kill-w/o-query, | |
1382 ;;; but let Scheme procs be default.) | |
1383 ;;; | |
1384 ;;; 7/91 Shivers | |
1385 ;;; - Souped up comint-read-noecho with an optional argument, STARS. | |
1386 ;;; Suggested by mjlx@EAGLE.CNSF.CORNELL.EDU. | |
1387 ;;; - Moved comint-previous-input-matching from C-c r to C-M-r. | |
1388 ;;; C-c <letter> bindings are reserved for the user. | |
1389 ;;; These bindings were done by Jim Blandy. | |
1390 ;;; These changes comprise version 2.03. | |
584 | 1391 |
1392 (provide 'comint) | |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
638
diff
changeset
|
1393 |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
638
diff
changeset
|
1394 ;;; comint.el ends here |