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

From: Mayeul KAUFFMANN <mayeul.kauffmann_at_tiscali.fr>
Date: Fri 20 Aug 2004 - 07:32:51 EST


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



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Aug 20 07:46:03 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 08:59:20 EST