[ESS-bugs] ess-mode 5.12; `ess-indent-line' error

Sebastian P. Luque spluque at gmail.com
Tue Aug 17 20:08:25 CEST 2010


With the following input, and point on the line with "Table 8.3":

if (require(lme4)) {
    ## Model in p. 213
    (fm1 <- lmer(logFEV1 ~ age + log(height) + age0 + log(height0) + (age | id),
                 data=fev1, subset=logFEV1 > -0.5))
    ## Table 8.3
    VarCorr(fm1)$id * 100
    
    ## Model in p. 216
    (fm2 <- update(fm1, . ~ . - (age | id) + (log(height) | id)))
}

hitting TAB (`ess-indent-command'), which calls `ess-indent-line' I get
the following trace:

---<--------------------cut here---------------start------------------->---
Debugger entered--Lisp error: (scan-error "Containing expression ends prematurely" 20 20)
  scan-sexps(177 -2)
  forward-sexp(-2)
  (cond ((memq ... ...) nil) ((= ... 41) (forward-sexp -2) (looking-at "if\\b[ 	]*(\\|function\\b[ 	]*(\\|for\\b[ 	]*(\\|while\\b[ 	]*(")) ((progn ... ...) (skip-chars-backward " 	") (or ... ...)) (t (progn ... ... ...)))
  (save-excursion (cond (... nil) (... ... ...) (... ... ...) (t ...)))
  (let ((eol ...)) (save-excursion (cond ... ... ... ...)))
  ess-continued-statement-p()
  (if (ess-continued-statement-p) (progn (ess-backward-to-start-of-continued-exp containing-sexp) (+ ess-continued-statement-offset ... ...)) (goto-char containing-sexp) (or (save-excursion ... ... ...) (+ ... ... ...)))
  (cond ((or ... ...) (nth 4 state)) ((null containing-sexp) (beginning-of-line) (if ... ess-continued-statement-offset 0)) ((/= ... 123) (goto-char containing-sexp) (let ... ...)) (t (goto-char indent-point) (ess-backward-to-noncomment containing-sexp) (while ... ... ... ...) (if ... ... ... ...)))
  (let ((indent-point ...) (case-fold-search nil) state containing-sexp) (if parse-start (goto-char parse-start) (beginning-of-defun)) (while (< ... indent-point) (setq parse-start ...) (setq state ...) (setq containing-sexp ...)) (cond (... ...) (... ... ...) (... ... ...) (t ... ... ... ...)))
  (save-excursion (beginning-of-line) (let (... ... state containing-sexp) (if parse-start ... ...) (while ... ... ... ...) (cond ... ... ... ...)))
  ess-calculate-indent(nil)
  (let ((indent ...) beg shift-amt (case-fold-search nil) (pos ...)) (beginning-of-line) (setq beg (point)) (cond (... ...) (t ... ...)) (skip-chars-forward " 	") (setq shift-amt (- indent ...)) (if (zerop shift-amt) (if ... ...) (delete-region beg ...) (indent-to indent) (if ... ...)) shift-amt)
  ess-indent-line()
  (if (and (not ess-tab-always-indent) (save-excursion ... ...)) (insert-tab) (ess-indent-line))
  (if whole-exp (let (... beg end) (save-excursion ... ... ... ... ... ... ... ...) (if ... ...)) (if (and ... ...) (insert-tab) (ess-indent-line)))
  ess-indent-command(nil)
  call-interactively(ess-indent-command nil nil)
---<--------------------cut here---------------end--------------------->---

Interestingly, if the lines 2-4 are absent, then the problem is gone.
The problem is also there in ESS 5.11.

I'll try to find out what is going on in `ess-continued-statement-p' but
given that I'm not very familiar with the stuff in ess-mode.el, I'm
submitting the report in case somebody can detect the issue sooner.


[ess-site.el]: ess-customize-alist=nil 
[ess-site.el _2_]: ess-customize-alist=nil 
(S): ess-s-versions-create making M-x defuns for 
 
(R): ess-r-versions-create making M-x defuns for 
 
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
(ess-mode-1): ess-language=S, ess-dialect=R buf=ess-bug.R 
(ess-mode-1.5): alist=((ess-local-customize-alist quote R-customize-alist) (ess-dialect . R) (ess-suffix . R) (ess-dump-filename-template ess-replace-regexp-in-string S$ ess-suffix ess-dump-filename-template-proto) (ess-mode-syntax-table . R-syntax-table) (ess-mode-editing-alist . R-editing-alist) (ess-change-sp-regexp . ess-R-change-sp-regexp) (ess-help-sec-regex . ess-help-R-sec-regex) (ess-help-sec-keys-alist . ess-help-R-sec-keys-alist) (ess-loop-timeout . ess-S-loop-timeout) (ess-cmd-delay . ess-R-cmd-delay) (ess-function-pattern . ess-R-function-pattern) (ess-object-name-db-file . ess-r-namedb.el) (ess-imenu-mode-function quote ess-imenu-R) (inferior-ess-program . inferior-R-program-name) (inferior-ess-objects-command . inferior-R-objects-command) (inferior-ess-font-lock-keywords . inferior-ess-R-font-lock-keywords) (inferior-ess-search-list-command . search()
) (inferior-ess-help-command . inferior-ess-r-help-command) (inferior-ess-help-filetype) (inferior-ess-exit-command . q()) (inferior-ess-exit-prompt . Save workspace image? [y/n/c]: ) (inferior-ess-primary-prompt . \([A-Z][][A-Za-z0-9.]*\)?> ) (inferior-ess-secondary-prompt . + ?) (inferior-ess-start-file) (inferior-ess-start-args . ) (ess-STERM . iESS) (ess-editor . R-editor) (ess-pager . R-pager) (ess-language . S) (inferior-ess-exit-command . q()
) (inferior-ess-language-start eval inferior-S-language-start) (comint-use-prompt-regexp-instead-of-fields . t)) 
(ess-mode-1.6): editing-alist=((paragraph-start concat \s-*$\| page-delimiter) (paragraph-separate concat \s-*$\| page-delimiter) (paragraph-ignore-fill-prefix . t) (require-final-newline . t) (comment-start . #) (comment-add . 1) (comment-start-skip . #+ *) (comment-column . 40) (indent-line-function quote S-indent-line) (parse-sexp-ignore-comments . t) (ess-style . ess-default-style) (ess-local-process-name) (ess-mode-syntax-table . S-syntax-table) (add-log-current-defun-header-regexp . ^\(.+\)\s-+<-[ 	
]*function) (font-lock-defaults quote (ess-R-mode-font-lock-keywords nil nil ((46 . w) (95 . w))))) 
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send

Finished setting up ESS-mode.


Emacs  : GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2010-08-15 on barber, modified by Debian
Package: ess-mode 5.12

current state:
==============
(setq
 ess-language "S"
 ess-dialect "R"
 ess-ask-for-ess-directory t
 ess-ask-about-transfile nil
 ess-directory nil
 ess-keep-dump-files "always"
 ess-source-directory "/tmp/"
 )


Cheers,

-- 
Seb



More information about the ESS-bugs mailing list