[ESS-bugs] ess-mode 12.09 [<unknown>]; problem with indentation

Ilya Lavrik ilya.lavrik at gmail.com
Sat Oct 13 03:46:10 CEST 2012


Hello,
I'm experiencing problem with indentation of my R code. I'm following
recommendation and have the following in my .emacs file

;; R-internals manual
;;; ESS
(add-hook 'ess-mode-hook
       (lambda ()
         (ess-set-style 'C++ 'quiet)
         ;; Because
         ;;                                 DEF GNU BSD K&R C++
         ;; ess-indent-level                  2   2   8   5   4
         ;; ess-continued-statement-offset    2   2   8   5   4
         ;; ess-brace-offset                  0   0  -8  -5  -4
         ;; ess-arg-function-offset           2   4   0   0   0
         ;; ess-expression-offset             4   2   8   5   4
         ;; ess-else-offset                   0   0   0   0   0
         ;; ess-close-brace-offset            0   0   0   0   0
         (add-hook 'local-write-file-hooks
               (lambda ()
             (ess-nuke-trailing-whitespace)))))
;;(setq ess-nuke-trailing-whitespace-p 'ask)
;; or even
(setq ess-nuke-trailing-whitespace-p t)
;; Perl
(add-hook 'perl-mode-hook
       (lambda () (setq perl-indent-level 4)))
;-------------------------------------------


This is the problem this is piece of code that indented correctly when
it just part of the R scrip.

ggplot(data = overtime.by.month,
        aes(x="",
            y=Percent,
            fill = Overtime)) +
     geom_bar(width = 1) +
     xlab('') +
     ylab(sub.txt) +
     labs(title = title.txt) +
     facet_wrap(~Year.Month) +
     geom_text(aes(y = txt.pos, label = Per.txt)) +
     coord_polar(theta = "y") +
     scale_fill_manual(values = c('green', 'red')) +
     theme(axis.ticks = element_blank(),
           axis.text.y = element_blank(),
           axis.text.x = element_blank())

This is piece of the same code indented weirdly. As soon as it becomes
part of the function something strange is happening with the
indentation.

a <- function(){
     a <- ggplot(data = overtime.by.month,
                 aes(x="",
                     y=Percent,
                     fill = Overtime)) +
                         geom_bar(width = 1) +
                             xlab('') +
                                 ylab(sub.txt) +
                                     labs(title = title.txt) +
                                         facet_wrap(~Year.Month) +
                                             geom_text(aes(y = txt.pos, 
label = Per.txt)) +
                                                 coord_polar(theta = "y") +
 
scale_fill_manual(values = c('green', 'red')) +
 
theme(axis.ticks = element_blank(),
 
axis.text.y = element_blank(),
 
axis.text.x = element_blank())

}

There are other similar indentation issues.
Is there a way around it? I'm new emacs + ess user, and any help would
be appreciated. I posted this question on stackoverflow and I was
recommended to submit a bug report. Thank you for all your hard work on
such a wonderful software.

Best regards
ilya

-------------------------------------------------------
This bug report will be sent to the ESS bugs email list
Press C-c C-c when you are ready to send your message.
-------------------------------------------------------

[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=t, 
comint..sender=comint-simple-send
(ess-mode-1): ess-language=S, ess-dialect=R 
buf=local.service.overtime.report.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) (ess-smart-operators . 
ess-R-smart-operators) (inferior-ess-program . inferior-R-program-name) 
(inferior-ess-objects-command . inferior-R-objects-command) 
(inferior-ess-font-lock-keywords quote inferior-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-start-file) (inferior-ess-start-args . ) 
(ess-error-regexp-alist . ess-R-error-regexp-alist) (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 . t) (comint-process-echoes . t) 
(inferior-ess-primary-prompt . > ) (inferior-ess-secondary-prompt . + ) 
(comment-start . #) (comment-add . 1) (comment-start-skip . #+ *) 
(comment-use-syntax) (comment-column . 40) (ess-no-skip-regexp concat ^ 
*@\| (default-value (quote ess-no-skip-regexp))) (inferior-ess-prompt . 
inferior-S-prompt) (ess-get-help-topics-function quote 
ess-get-S-help-topics-function) (ess-getwd-command . getwd()
) (ess-setwd-command . setwd('%s')
))
(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) 
(indent-line-function quote ess-indent-line) (parse-sexp-ignore-comments 
. t) (ess-style . ess-default-style) (ess-mode-syntax-table . 
S-syntax-table) (add-log-current-defun-header-regexp . ^\(.+\)\s-+<-[ 	
]*function) (ess-font-lock-keywords quote ess-R-font-lock-keywords) 
(ess-font-lock-defaults ess--extract-default-fl-keywords 
ess-R-font-lock-keywords) (font-lock-defaults quote 
(ess-font-lock-defaults nil nil ((46 . w) (95 . w)))))
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t, 
comint..sender=comint-simple-send

Finished setting up ESS-mode.
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t, 
comint..sender=comint-simple-send
(ess-mode-1): ess-language=S, ess-dialect=R buf=*scratch*
(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) (ess-smart-operators . 
ess-R-smart-operators) (inferior-ess-program . inferior-R-program-name) 
(inferior-ess-objects-command . inferior-R-objects-command) 
(inferior-ess-font-lock-keywords quote inferior-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-start-file) (inferior-ess-start-args . ) 
(ess-error-regexp-alist . ess-R-error-regexp-alist) (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 . t) (comint-process-echoes . t) 
(inferior-ess-primary-prompt . > ) (inferior-ess-secondary-prompt . + ) 
(comment-start . #) (comment-add . 1) (comment-start-skip . #+ *) 
(comment-use-syntax) (comment-column . 40) (ess-no-skip-regexp concat ^ 
*@\| (default-value (quote ess-no-skip-regexp))) (inferior-ess-prompt . 
inferior-S-prompt) (ess-get-help-topics-function quote 
ess-get-S-help-topics-function) (ess-getwd-command . getwd()
) (ess-setwd-command . setwd('%s')
))
(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) 
(indent-line-function quote ess-indent-line) (parse-sexp-ignore-comments 
. t) (ess-style . ess-default-style) (ess-mode-syntax-table . 
S-syntax-table) (add-log-current-defun-header-regexp . ^\(.+\)\s-+<-[ 	
]*function) (ess-font-lock-keywords quote ess-R-font-lock-keywords) 
(ess-font-lock-defaults ess--extract-default-fl-keywords 
ess-R-font-lock-keywords) (font-lock-defaults quote 
(ess-font-lock-defaults nil nil ((46 . w) (95 . w)))))
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t, 
comint..sender=comint-simple-send

Finished setting up ESS-mode.


Emacs  : GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
  of 2012-09-21 on batsu, modified by Debian
Package: ess-mode 12.09 [<unknown>]

current state:
==============
(setq
  ess-language "S"
  ess-dialect "R"
  ess-ask-for-ess-directory nil
  ess-ask-about-transfile nil
  ess-directory nil
  ess-keep-dump-files "always"
  ess-source-directory "/tmp"
  ess-use-ido t
  ess-use-eldoc t
  ess-use-tracebug nil
  ess-use-auto-complete t
  ess-eval-visibly-p nil
  ess-can-eval-in-background nil
  ess-local-process-name nil
  )

-- 
Many people would sooner die than think. In fact they do. B Russell



More information about the ESS-bugs mailing list