Mercurial > hg > xemacs-beta
comparison lisp/comint/comint.el @ 32:e04119814345 r19-15b99
Import from CVS: tag r19-15b99
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:52:56 +0200 |
parents | ec9a17fef872 |
children | d620409f5eb8 |
comparison
equal
deleted
inserted
replaced
31:b9328a10c56c | 32:e04119814345 |
---|---|
352 (put 'comint-output-filter-functions 'permanent-local t) | 352 (put 'comint-output-filter-functions 'permanent-local t) |
353 (put 'comint-scroll-to-bottom-on-input 'permanent-local t) | 353 (put 'comint-scroll-to-bottom-on-input 'permanent-local t) |
354 (put 'comint-scroll-to-bottom-on-output 'permanent-local t) | 354 (put 'comint-scroll-to-bottom-on-output 'permanent-local t) |
355 (put 'comint-scroll-show-maximum-output 'permanent-local t) | 355 (put 'comint-scroll-show-maximum-output 'permanent-local t) |
356 (put 'comint-ptyp 'permanent-local t) | 356 (put 'comint-ptyp 'permanent-local t) |
357 | |
358 (defface comint-input-face '((((class color) | |
359 (background dark)) | |
360 (:foreground "red")) | |
361 (((class color) | |
362 (background light)) | |
363 (:foreground "blue")) | |
364 (((class mono)) | |
365 (:bold t)) | |
366 (((class grayscale)) | |
367 (:bold t)) | |
368 (t | |
369 (:bold t))) | |
370 "How to display user input for comint shells." | |
371 :group 'comint-input-face) | |
372 | |
373 | |
357 | 374 |
358 (defun comint-mode () | 375 (defun comint-mode () |
359 "Major mode for interacting with an inferior interpreter. | 376 "Major mode for interacting with an inferior interpreter. |
360 Interpreter name is same as buffer name, sans the asterisks. | 377 Interpreter name is same as buffer name, sans the asterisks. |
361 Return at end of buffer sends line as input. | 378 Return at end of buffer sends line as input. |
1344 ;; Update the markers before we send the input | 1361 ;; Update the markers before we send the input |
1345 ;; in case we get output amidst sending the input. | 1362 ;; in case we get output amidst sending the input. |
1346 (set-marker comint-last-input-start pmark) | 1363 (set-marker comint-last-input-start pmark) |
1347 (set-marker comint-last-input-end (point)) | 1364 (set-marker comint-last-input-end (point)) |
1348 (set-marker (process-mark proc) (point)) | 1365 (set-marker (process-mark proc) (point)) |
1366 (comint-input-done) | |
1349 (funcall comint-input-sender proc input) | 1367 (funcall comint-input-sender proc input) |
1368 (comint-input-setup) | |
1350 ;; XEmacs - A kludge to prevent the delay between insert and | 1369 ;; XEmacs - A kludge to prevent the delay between insert and |
1351 ;; process output affecting the display. A case for a | 1370 ;; process output affecting the display. A case for a |
1352 ;; comint-send-input-hook? | 1371 ;; comint-send-input-hook? |
1353 (run-hook-with-args 'comint-output-filter-functions | 1372 (run-hook-with-args 'comint-output-filter-functions |
1354 (concat input "\n")) | 1373 (concat input "\n")) |
1355 (comint-output-filter proc "") | 1374 (comint-output-filter proc "") |
1356 ))))) | 1375 ))))) |
1376 (defun comint-input-done () | |
1377 "Finalized comint-input-extent so nothing more is added." | |
1378 (if (not comint-input-extent) | |
1379 (comint-input-setup)) | |
1380 (set-extent-property comint-input-extent 'start-closed nil) | |
1381 (set-extent-property comint-input-extent 'end-closed nil) | |
1382 (set-extent-property comint-input-extent 'detachable t) | |
1383 ) | |
1384 | |
1385 (defun comint-input-setup () | |
1386 "Insure the comint-input-extent is ready." | |
1387 (setq comint-input-extent (make-extent (point) (point-max))) | |
1388 (set-extent-property comint-input-extent 'detachable nil) | |
1389 (set-extent-property comint-input-extent 'start-closed t) | |
1390 (set-extent-property comint-input-extent 'end-closed t) | |
1391 (set-extent-face comint-input-extent 'comint-input-face) | |
1392 ) | |
1393 | |
1394 (defvar comint-input-extent nil | |
1395 "Current extent used for displaying text in buffer."); | |
1396 (make-variable-buffer-local 'comint-input-extent) | |
1357 | 1397 |
1358 ;; The purpose of using this filter for comint processes | 1398 ;; The purpose of using this filter for comint processes |
1359 ;; is to keep comint-last-input-end from moving forward | 1399 ;; is to keep comint-last-input-end from moving forward |
1360 ;; when output is inserted. | 1400 ;; when output is inserted. |
1361 (defun comint-output-filter (process string) | 1401 (defun comint-output-filter (process string) |
1367 (set-buffer oprocbuf) | 1407 (set-buffer oprocbuf) |
1368 (setq string (replace-in-string string "\^M" "") | 1408 (setq string (replace-in-string string "\^M" "") |
1369 opoint (point) | 1409 opoint (point) |
1370 obeg (point-min) | 1410 obeg (point-min) |
1371 oend (point-max)) | 1411 oend (point-max)) |
1412 ;; Keep stuff being output (before input) from using input-extent | |
1413 (if comint-input-extent | |
1414 (set-extent-property comint-input-extent 'start-closed nil)) | |
1372 (let ((buffer-read-only nil) | 1415 (let ((buffer-read-only nil) |
1373 (nchars (length string)) | 1416 (nchars (length string)) |
1374 (ostart nil)) | 1417 (ostart nil)) |
1375 (widen) | 1418 (widen) |
1376 (goto-char (process-mark process)) | 1419 (goto-char (process-mark process)) |
1391 (= (point) comint-last-input-end)) | 1434 (= (point) comint-last-input-end)) |
1392 (set-marker comint-last-input-end (- comint-last-input-end nchars))) | 1435 (set-marker comint-last-input-end (- comint-last-input-end nchars))) |
1393 (set-marker comint-last-output-start ostart) | 1436 (set-marker comint-last-output-start ostart) |
1394 (set-marker (process-mark process) (point)) | 1437 (set-marker (process-mark process) (point)) |
1395 (redraw-modeline)) | 1438 (redraw-modeline)) |
1439 ;; Now insure everything inserted after (user input) is in extent | |
1440 (if (not comint-input-extent) | |
1441 (comint-input-setup)) | |
1442 (set-extent-endpoints comint-input-extent (point) (point-max)) | |
1443 (set-extent-property comint-input-extent 'start-closed t) | |
1396 | 1444 |
1397 (narrow-to-region obeg oend) | 1445 (narrow-to-region obeg oend) |
1398 (goto-char opoint) | 1446 (goto-char opoint) |
1399 (run-hook-with-args 'comint-output-filter-functions string) | 1447 (run-hook-with-args 'comint-output-filter-functions string) |
1400 (set-buffer obuf))))) | 1448 (set-buffer obuf))))) |