all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Eshell - `Text is read-only`
@ 2013-12-29 18:47 deech
  2013-12-29 21:40 ` Guido Van Hoecke
  0 siblings, 1 reply; 4+ messages in thread
From: deech @ 2013-12-29 18:47 UTC (permalink / raw)
  To: help-gnu-emacs

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'm currently using Emacs 24.3.50.1 and it appears to be back and the above snippet doesn't seem to work.

Any help is appreciated.

-deech


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Eshell - `Text is read-only`
  2013-12-29 18:47 Eshell - `Text is read-only` deech
@ 2013-12-29 21:40 ` Guido Van Hoecke
  2013-12-29 22:04   ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Guido Van Hoecke @ 2013-12-29 21:40 UTC (permalink / raw)
  To: deech; +Cc: help-gnu-emacs

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.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Eshell - `Text is read-only`
  2013-12-29 21:40 ` Guido Van Hoecke
@ 2013-12-29 22:04   ` Drew Adams
  2013-12-30  7:50     ` Guido Van Hoecke
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2013-12-29 22:04 UTC (permalink / raw)
  To: Guido Van Hoecke, deech; +Cc: help-gnu-emacs

> > 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:
> 
> I just hit the problem today. I'd say it occurs once a month at the
> most.
>
> 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!

The standard error that shows that error message is `text-read-only'.
(See (elisp) `Standard Errors'.)

You could try wrapping whatever code you use that ends up calling
calling code that raises the error with this:

(condition-case handle-text-read-only
  ... ; Your code that leads to the error goes here
  (text-read-only (debug)))

That should put you in the debugger whenever that error is raised.
From there you can evaluate expressions (using `e') to possibly
get more info about what the problem (cause) is.

Note that this is a subcategory of standard error `buffer-read-only'.
It arises when something tries to modify a character that has text
property `read-only' (see (elisp) `Text Properties').

You can also just try setting `debug-on-error' to t, in which case
the debugger should be entered for any error.

However you get to the debugger, it provides a backtrace of the
functions that led to the error.  With that knowledge, you can
use `debug-on-entry FUNCTION', to instead enter the debugger for
a FUNCTION you see on the backtrace stack, and then step through
its evaluation using `d'.  That will give you a better idea of
what's going on.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Eshell - `Text is read-only`
  2013-12-29 22:04   ` Drew Adams
@ 2013-12-30  7:50     ` Guido Van Hoecke
  0 siblings, 0 replies; 4+ messages in thread
From: Guido Van Hoecke @ 2013-12-30  7:50 UTC (permalink / raw)
  To: Drew Adams; +Cc: deech, help-gnu-emacs

Hi Drew,

Drew Adams <drew.adams@oracle.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:
>> 
>> I just hit the problem today. I'd say it occurs once a month at the
>> most.
>>
>> 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!
>
> The standard error that shows that error message is `text-read-only'.
> (See (elisp) `Standard Errors'.)
>
> You could try wrapping whatever code you use that ends up calling
> calling code that raises the error with this:
>
> (condition-case handle-text-read-only
>   ... ; Your code that leads to the error goes here
>   (text-read-only (debug)))

Unfortunately I have no idea what code is causing the bug, and right now
there's not enough time to hunt down an annoying but infrequent
bug. I'll keep your suggestions in my archive. That way I'll be able to
use them when any of the above condition change.

> That should put you in the debugger whenever that error is raised.
> From there you can evaluate expressions (using `e') to possibly
> get more info about what the problem (cause) is.
>
> Note that this is a subcategory of standard error `buffer-read-only'.
> It arises when something tries to modify a character that has text
> property `read-only' (see (elisp) `Text Properties').
>
> You can also just try setting `debug-on-error' to t, in which case
> the debugger should be entered for any error.

I'll try that one.

> However you get to the debugger, it provides a backtrace of the
> functions that led to the error.  With that knowledge, you can
> use `debug-on-entry FUNCTION', to instead enter the debugger for
> a FUNCTION you see on the backtrace stack, and then step through
> its evaluation using `d'.  That will give you a better idea of
> what's going on.


Thanks for your help,

Guido



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-30  7:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-29 18:47 Eshell - `Text is read-only` deech
2013-12-29 21:40 ` Guido Van Hoecke
2013-12-29 22:04   ` Drew Adams
2013-12-30  7:50     ` Guido Van Hoecke

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.