[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Eshell - `Text is read-only`
From: |
Guido Van Hoecke |
Subject: |
Re: Eshell - `Text is read-only` |
Date: |
Sun, 29 Dec 2013 22:40:34 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) |
deech <aditya.siram@gmail.com> writes:
> Hi all, I've run into the dreaded `Text is read-only` bug which stops
> eshell from closing and Emacs from exiting. I got this in a previous
> version of Emacs and fixed it with the following snippet:
> (setq eshell-prompt-function
> (lambda ()
> (concat (eshell/pwd) "\n$"))
> eshell-prompt-regexp (concat "^" (regexp-quote "$")))
I just hit the problem today. I'd say it occurs once a month at the
most. My prompt is a two line version. It looks like this:
2013-12-29 22:28 ~/src/gvhperls
$
I don't think it is due to the prompt. FWIW, here's my
eshell-prompt-function, which I shamelesly based on snippets collected
on the net:
(setq eshell-prompt-function
(lambda ()
(let ((prompt (eshell/pwd))
(now (format-time-string "\n%Y-%m-%d %H:%M " (current-time)))
(home-dir (expand-file-name "~")))
;; get rid of the nasty backslashes
(while (string-match "\\\\" home-dir)
(setq home-dir (replace-match "/" nil t home-dir)))
;; match home-dir at the begining of the line
;; be careful not to match `/users/foo.old' if $HOME is `/users/foo'
(if (string-match
(concat "^\\(" home-dir "\\)\\(/.*\\)?$")
prompt)
(setq prompt (replace-match
(if (and (match-string 2))
"~\\2"
"~")
nil
nil
prompt
0)))
;; return the prompt
;; -tack on $ or # depending on user id
(concat now prompt
(if (= (user-uid) 0) "\n# " "\n$ ")))))
Although it does not happen frequently, I sure would like to get it
solved. There's only one solution afaik, and that's just killing emacs,
as in `kill -9 emacs_pid`. This is drastic, but the only way I know to
get rid of the buffer :(
Any suggestion and/or help would be really appreciated!
TIA, and a happy and healthy new-year to you all :)
Guido
--
The world needs more people like us and fewer like them.