Subject: bug#13963: 24.3; eshell: "Text is read-only" and unresponsive eshell to kill-buffer, C-x C-c and C-x C-q

From: Thierry Volpiatto <[email-masked]>
Date: Sat, 23 Mar 2013 11:23:48 +0100

Thierry Volpiatto <[email-masked]> writes:

> Thierry Volpiatto <[email-masked]> writes:
>
> Problem with previous patch i sent is that it allow to delete backward
> the space at end of prompt, so what is needed is make the whole prompt
> read-only but the last char (the space) and give to this last char
> rear-nonsticky read-only property.
> This works fine here and fix the bug.

diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index c1c4d47..db6d74c 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -117,12 +117,17 @@ arriving, or after."
   (run-hooks 'eshell-before-prompt-hook)
   (if (not eshell-prompt-function)
       (set-marker eshell-last-output-end (point))
-    (let ((prompt (funcall eshell-prompt-function)))
+    (let* ((prompt (funcall eshell-prompt-function))
+           (len (length prompt)))
       (and eshell-highlight-prompt
-	   (add-text-properties 0 (length prompt)
+	   (add-text-properties 0 (1- len)
+				'(read-only t
+				  face eshell-prompt)
+				prompt)
+           (add-text-properties (1- len) len
 				'(read-only t
 				  face eshell-prompt
-				  rear-nonsticky (face read-only))
+                                  rear-nonsticky (face read-only))
 				prompt))
       (eshell-interactive-print prompt)))
   (run-hooks 'eshell-after-prompt-hook))

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997