1 #### File showing off things that go wrong -- with R-mode
4 ### Here, the indentation is wrong:
11 indic <- ifelse(jinf+1 <= 1 & jsup >= 1,1,0)
12 E.cond <- ch*(-pbinom(jinf,ni,prb) + 1-pbinom(js.n,ni,prb)) +
13 ifelse(ni == 1, prb*indic,
14 mu*(pbinom(js.n-1,pmax(ni-1,1),prb)-
15 pbinom(jinf-1,pmax(ni-1,1),prb))) / sV -
16 ### why is the following line wrongly indented by Emacs/ESS ?
17 mu/sV*(pbinom(js.n,ni,prb) - pbinom(jinf,ni,prb))
19 indic2 <- ifelse(jinf+1 <= 1 & jsup >= 1 & ni == 2,1,0)
25 ### Here, the beginning of function is not found correctly, and hence
26 ### all "ess-*-function" (C-M-a, C-M-e, ...) fail:
29 ## It is clearly allowed to have comments here.
30 ## S version 4, and John Chambers in particular like it.
32 ## BUG: M-C-e or M-C-a fails from ``here'' --
33 ## --- effectively because of ess-beginning-of-function fails
34 ## and that really relies on finding ess-function-pattern;
35 ## i.e., ess-R-function-pattern in ~/emacs/ess/lisp/ess-cust.el
37 function(name, def = NULL, group = list(), valueClass = character(),
38 where = topenv(parent.frame()), genericFunction = NULL)
40 ## comments in here are at least kept via "source" attribute
41 if(exists(name, "package:base") &&
42 typeof(get(name, "package:base")) != "closure") {
48 ## this has one line more before 'function' than "typically:"
49 setMethod("[", signature(x = "dgTMatrix", i = "numeric", j = "missing",
51 function (x, i, j, ..., drop) { ## select rows
52 storage.mode(i) <- "integer"
53 xi <- x@i + 1:1 # 1-indexing
54 ## ...................
55 if (drop && any(nd == 1)) drop(as(x,"matrix")) else x
58 "dimnames<-.data.frame" <- function(x, value) {
60 if(!is.list(value) || length(value) != 2
61 || d[[1]] != length(value[[1]])
62 || d[[2]] != length(value[[2]]))
63 stop("invalid 'dimnames' given for data frame")
64 row.names(x) <- as.character(value[[1]]) # checks validity
65 names(x) <- as.character(value[[2]])
69 '[.foo' <- function(x, i, value)
77 '[[.bar' <- function(x, i, value)
80 y <- as.foo(x) ; y[[i]] <- value
84 "[<-.foobar" <- function(x,i,j,value) {
89 "names<-.foobar" <- function(x, value) {
90 ## just something else
94 "[<-.data.frame" <- function(x, i, j, value)
96 nA <- nargs() # value is never missing, so 3 or 4.
104 "[[<-.data.frame"<- function(x, i, j, value)
107 ## delete class: Version 3 idiom
108 ## to avoid any special methods for [[<-
118 "$<-.data.frame"<- function(x, i, value)
121 ## delete class: Version 3 idiom
122 ## to avoid any special methods for [[<-