diff options
| author | Luc Teirlinck | 2004-04-29 03:41:48 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2004-04-29 03:41:48 +0000 |
| commit | 70ac607ee3b6e3786cb2de2d0cee07ac892225e8 (patch) | |
| tree | b82f5a795a073f9a7b8b3def7140209664ff9409 | |
| parent | d70d59e9d7a024883bd551d9c93a2be3ed77a43b (diff) | |
| download | emacs-70ac607ee3b6e3786cb2de2d0cee07ac892225e8.tar.gz emacs-70ac607ee3b6e3786cb2de2d0cee07ac892225e8.zip | |
(comint-prompt-read-only): New variable.
(comint-output-filter): Implement it.
| -rw-r--r-- | lisp/comint.el | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index 7766307f156..52217fa8ad6 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -171,6 +171,14 @@ Good choices: | |||
| 171 | 171 | ||
| 172 | This is a good thing to set in mode hooks.") | 172 | This is a good thing to set in mode hooks.") |
| 173 | 173 | ||
| 174 | (defcustom comint-prompt-read-only nil | ||
| 175 | "If non-nil, the comint prompt is read only. | ||
| 176 | This does not affect existing prompts. | ||
| 177 | Certain derived modes may override this option." | ||
| 178 | :type 'boolean | ||
| 179 | :group 'comint | ||
| 180 | :version "21.4") | ||
| 181 | |||
| 174 | (defvar comint-delimiter-argument-list () | 182 | (defvar comint-delimiter-argument-list () |
| 175 | "List of characters to recognise as separate arguments in input. | 183 | "List of characters to recognise as separate arguments in input. |
| 176 | Strings comprising a character in this list will separate the arguments | 184 | Strings comprising a character in this list will separate the arguments |
| @@ -1687,16 +1695,25 @@ Make backspaces delete the previous character." | |||
| 1687 | (let ((inhibit-read-only t)) | 1695 | (let ((inhibit-read-only t)) |
| 1688 | (add-text-properties comint-last-output-start (point) | 1696 | (add-text-properties comint-last-output-start (point) |
| 1689 | '(rear-nonsticky t | 1697 | '(rear-nonsticky t |
| 1690 | field output | 1698 | field output |
| 1691 | inhibit-line-move-field-capture t)))) | 1699 | inhibit-line-move-field-capture t)))) |
| 1692 | 1700 | ||
| 1693 | ;; Highlight the prompt, where we define `prompt' to mean | 1701 | ;; Highlight the prompt, where we define `prompt' to mean |
| 1694 | ;; the most recent output that doesn't end with a newline. | 1702 | ;; the most recent output that doesn't end with a newline. |
| 1695 | (unless (and (bolp) (null comint-last-prompt-overlay)) | 1703 | (let ((prompt-start (save-excursion (forward-line 0) (point))) |
| 1696 | ;; Need to create or move the prompt overlay (in the case | 1704 | (inhibit-read-only t)) |
| 1697 | ;; where there is no prompt ((bolp) == t), we still do | 1705 | (when comint-prompt-read-only |
| 1698 | ;; this if there's already an existing overlay). | 1706 | (or (= (point-min) prompt-start) |
| 1699 | (let ((prompt-start (save-excursion (forward-line 0) (point)))) | 1707 | (get-text-property (1- prompt-start) 'read-only) |
| 1708 | (put-text-property | ||
| 1709 | (1- prompt-start) prompt-start 'read-only 'fence)) | ||
| 1710 | (add-text-properties | ||
| 1711 | prompt-start (point) | ||
| 1712 | '(read-only t rear-non-sticky t front-sticky (read-only)))) | ||
| 1713 | (unless (and (bolp) (null comint-last-prompt-overlay)) | ||
| 1714 | ;; Need to create or move the prompt overlay (in the case | ||
| 1715 | ;; where there is no prompt ((bolp) == t), we still do | ||
| 1716 | ;; this if there's already an existing overlay). | ||
| 1700 | (if comint-last-prompt-overlay | 1717 | (if comint-last-prompt-overlay |
| 1701 | ;; Just move an existing overlay | 1718 | ;; Just move an existing overlay |
| 1702 | (move-overlay comint-last-prompt-overlay | 1719 | (move-overlay comint-last-prompt-overlay |