comparison lisp/comint.el @ 50966:379cf00d7016

(comint-carriage-motion, comint-output-filter): Bind inhibit-read-only rather than buffer-read-only. (comint-truncate-buffer): Bind inhibit-read-only.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 13 May 2003 18:30:46 +0000
parents 99be3a1e2589
children 79dc5a8eacfe
comparison
equal deleted inserted replaced
50965:c1e6923f4f9b 50966:379cf00d7016
1 ;;; comint.el --- general command interpreter in a window stuff 1 ;;; comint.el --- general command interpreter in a window stuff
2 2
3 ;; Copyright (C) 1988, 90, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002 3 ;; Copyright (C) 1988,90,92,93,94,95,96,97,98,99,2000,01,02,2003
4 ;; Free Software Foundation, Inc. 4 ;; Free Software Foundation, Inc.
5 5
6 ;; Author: Olin Shivers <shivers@cs.cmu.edu> 6 ;; Author: Olin Shivers <shivers@cs.cmu.edu>
7 ;; Simon Marshall <simon@gnu.org> 7 ;; Simon Marshall <simon@gnu.org>
8 ;; Maintainer: FSF 8 ;; Maintainer: FSF
680 (defun comint-exec (buffer name command startfile switches) 680 (defun comint-exec (buffer name command startfile switches)
681 "Start up a process in buffer BUFFER for comint modes. 681 "Start up a process in buffer BUFFER for comint modes.
682 Blasts any old process running in the buffer. Doesn't set the buffer mode. 682 Blasts any old process running in the buffer. Doesn't set the buffer mode.
683 You can use this to cheaply run a series of processes in the same comint 683 You can use this to cheaply run a series of processes in the same comint
684 buffer. The hook `comint-exec-hook' is run after each exec." 684 buffer. The hook `comint-exec-hook' is run after each exec."
685 (save-excursion 685 (with-current-buffer buffer
686 (set-buffer buffer)
687 (let ((proc (get-buffer-process buffer))) ; Blast any old process. 686 (let ((proc (get-buffer-process buffer))) ; Blast any old process.
688 (if proc (delete-process proc))) 687 (if proc (delete-process proc)))
689 ;; Crank up a new process 688 ;; Crank up a new process
690 (let ((proc 689 (let ((proc
691 (if (consp command) 690 (if (consp command)
1560 (when (< (skip-chars-forward "^\b\r" end) (- end start)) 1559 (when (< (skip-chars-forward "^\b\r" end) (- end start))
1561 (save-match-data 1560 (save-match-data
1562 (save-restriction 1561 (save-restriction
1563 (widen) 1562 (widen)
1564 (let ((inhibit-field-text-motion t) 1563 (let ((inhibit-field-text-motion t)
1565 (buffer-read-only nil)) 1564 (inhibit-read-only t))
1566 ;; CR LF -> LF 1565 ;; CR LF -> LF
1567 ;; Note that this won't work properly when the CR and LF 1566 ;; Note that this won't work properly when the CR and LF
1568 ;; are in different output chunks, but this is probably an 1567 ;; are in different output chunks, but this is probably an
1569 ;; exceedingly rare case (because they are generally 1568 ;; exceedingly rare case (because they are generally
1570 ;; written as a unit), and to delay interpretation of a 1569 ;; written as a unit), and to delay interpretation of a
1599 (setq functions (cdr functions)))) 1598 (setq functions (cdr functions))))
1600 (setq string (funcall (car functions) string))) 1599 (setq string (funcall (car functions) string)))
1601 (setq functions (cdr functions)))) 1600 (setq functions (cdr functions))))
1602 1601
1603 ;; Insert STRING 1602 ;; Insert STRING
1604 (let ((buffer-read-only nil) 1603 (let ((inhibit-read-only t)
1605 ;; Avoid the overhead of save-excursion, since we just 1604 ;; Avoid the overhead of save-excursion, since we just
1606 ;; fiddle with the point 1605 ;; fiddle with the point
1607 (saved-point (point-marker))) 1606 (saved-point (point-marker)))
1608 1607
1609 ;; The point should float after any insertion we do 1608 ;; The point should float after any insertion we do
1770 (interactive) 1769 (interactive)
1771 (save-excursion 1770 (save-excursion
1772 (goto-char (process-mark (get-buffer-process (current-buffer)))) 1771 (goto-char (process-mark (get-buffer-process (current-buffer))))
1773 (forward-line (- comint-buffer-maximum-size)) 1772 (forward-line (- comint-buffer-maximum-size))
1774 (beginning-of-line) 1773 (beginning-of-line)
1775 (delete-region (point-min) (point)))) 1774 (let ((inhibit-read-only t))
1775 (delete-region (point-min) (point)))))
1776 1776
1777 (defun comint-strip-ctrl-m (&optional string) 1777 (defun comint-strip-ctrl-m (&optional string)
1778 "Strip trailing `^M' characters from the current output group. 1778 "Strip trailing `^M' characters from the current output group.
1779 This function could be on `comint-output-filter-functions' or bound to a key." 1779 This function could be on `comint-output-filter-functions' or bound to a key."
1780 (interactive) 1780 (interactive)