[ESS] C-c C-c inside latice panel function - was Font lock bug?
Kiermeier, Andreas (PIRSA - SARDI)
Kiermeier.Andreas at saugov.sa.gov.au
Wed Jun 14 01:23:47 CEST 2006
Hi Rodney & others,
after reading your response I'm wondering whether the following
behaviour may even be related.
I noticed yesterday while using C-c C-c (which is a great new addition
to ESS) inside a lattice panel function, that only the lines containing
the panel function get submitted to R. For example, I copied the
ethanol example from the xyplot documentation to file containing other R
commands.
EE <- equal.count(ethanol$E, number=9, overlap=1/4)
xyplot(NOx ~ C | EE, data = ethanol,
prepanel = function(x, y) prepanel.loess(x, y, span = 1),
xlab = "Compression Ratio", ylab = "NOx (micrograms/J)",
panel = function(x, y) {
panel.grid(h=-1, v= 2)
panel.xyplot(x, y)
panel.loess(x,y, span=1)
},
aspect = "xy")
If you place the cursor inside any of the lines 1, 2, or 3 and Press C-c
C-c then everything works as expected. However, if the curser is
somewhere within the lines containing the prepanel or panel functions
(except for the whitespace at the beginning of the line) then only that
function gets submitted to R, e.g.
> prepanel = function(x, y) prepanel.loess
(which is missing the bit at the end), or
> panel = function(x, y) {
+ panel.grid(h=-1, v= 2)
+ panel.xyplot(x, y)
+ panel.loess(x,y, span=1)
+ }
Cheers,
Andreas
_____________________________
Dr Andreas Kiermeier
Statistician
SARDI FOOD SAFETY PROGRAM
33 Flemington Street
Glenside SA 5065
Ph: +61 8 8207 7884
Fax: +61 8 8207 7854
Mob: 0423 028 565
Email: Kiermeier.Andreas at saugov.sa.gov.au
Web: http://www.sardi.sa.gov.au/
_____________________________
If you would like to correspond with me in a secure way, using public
key encryption, please contact me directly for details of my GPG public
key or visit the SARDI website, where you can download my public key
from my personal staff page.
The information in this e-mail and attachments (if any) may be
confidential and/or legally privileged. If you are not the intended
recipient, any disclosure, copying, distribution or action taken is
prohibited. SARDI, The South Australian Research and Development
Institute, is the research division of Primary Industries and Resources
(SA)
-----Original Message-----
From: ess-help-bounces at stat.math.ethz.ch
[mailto:ess-help-bounces at stat.math.ethz.ch] On Behalf Of Rodney
Sparapani
Sent: Wednesday, 14 June 2006 04:26
To: ess-help at stat.math.ethz.ch
Subject: Re: [ESS] Font lock bug?
Kevin Wright wrote:
> My setup: Windows 2000, R 2.3.1, ESS 5.3.1
>
> If you start R and type sqrt("a"), is "Error in" fontified in the
output?
>
> For me, neither "Error in" nor "Warning in" are properly fontified.
> Only the "in" part is fontified as a keyword (in the usual face for
> "in").
>
> If I change ess-R-message-prefixes from:
>
> (defvar ess-R-message-prefixes
> '("Error:" "Error in"
> "Warning:" "Warning in"
> "Warning messages"))
>
> to
>
> (defvar ess-R-message-prefixes
> '("Error" "Warning"))
>
> then I do get fontification of "Error" in the output (and "in" has a
> different display face). Interestingly enough, using
> '("Error" "Error:" "Error in"
> doesn't seem to work for me.
>
> Naive speculation: I wonder if the fontification of "in" as a keyword
> is interfering with fontification of "Error in". Font-lock patterns
> are scary things and since I have a working hack, I'm not going to dig
> further.
>
> Best,
>
> Kevin Wright
>
>
Hi Kevin:
It's not a bug per se. There are two layers. The font-locking which
operates on keywords and the "grammar" which is related to
"punctuation". And, that is a simplification since they each have
precedence rules and interact with each other. It can be very tricky to
get right. And no matter what you do, it always seems like there are
exceptions like these. Tony has been working on newer, more advanced
features that create a parser of an ESS supported language like R.
Until that is complete, these kind of nuisance cases are likely to be a
part of the ESS experience.
Rodney
______________________________________________
ESS-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help
More information about the ESS-help
mailing list