From mayeul.kauffmann at tiscali.fr  Thu Aug 19 23:32:51 2004
From: mayeul.kauffmann at tiscali.fr (Mayeul KAUFFMANN)
Date: Thu Aug 19 23:33:01 2004
Subject: [Rd] Unbalanced parentheses printed by warnings() crash text editor
Message-ID: <000501c48634$15f86c00$e3489b53@amd>

Hello everyone,

Hope it is the good place for this (I discuss the question of the right
place below).

Most of the time, warnings are more than 1000 characters long and thus are
truncated.
Most of the time, this generates printouts with unbalanced parentheses.

Intelligent text editors which do  parentheses highlighting get very
confused with this.
After too many warnings, they give errors, and may even crash.

Specifically, I use ESS and XEmacs for Windows Users of R (by John Fox)
which is advised to do at http://ess.r-project.org/
with a buffer for text editing and an inferior ESS (R) buffer.
(I downloaded the latest Xemacs and ESS a month ago).

After too many warnings (with unbalanced parentheses), Xemacs  swithes to
an ESS-error buffer which says "error Nesting too deep for parser".
In some case, when back in R buffer, typing any letter switches back to
the ESS-error Buffer.
In other case, it simply takes ages (until you kill Xemacs) or it crashes.
In most case, the R process is lost.

I could have sent this to the ESS or Xemacs devel list, but ESS & Xemacs'
attempt to find balanced parentheses accross many lines seems sensible,
and is needed with very long functions.

A workaround would be to change the function that print warnings.

Instead of, for instance,
"error message xxxxxxxxxx in: function.yyyyyy(zzzzzzzzz,zzzzzzz,   ..."

It may print
"error message xxxxxxxxxx in: function.yyyyyy(zzzzzzzzz,zzzzzzz,   ...)"

The function should truncate the error message, find how many parenthesis
and brackets are open in the remaining part, substract the number of
closing parenthesis and brackets, and add that many parenthesis at the
end.
(Xemacs parentheses highligher regards "(" and "[" as equivalent)


Mayeul KAUFFMANN
Univ. Pierre Mendes France
Grenoble - France


[Rd] Unbalanced parentheses printed by warnings() crash text editor
Mayeul KAUFFMANN