[ESS-bugs] ess-mode 12.09 [<unknown>]; problem with indentation
Vitalie Spinu
spinuvit at gmail.com
Sat Oct 13 18:30:33 CEST 2012
Noted, thanks. Will try to look into it soon.
Vitalie
>> Ilya Lavrik <ilya.lavrik at gmail.com>
>> on Fri, 12 Oct 2012 21:46:10 -0400 wrote:
IL> Hello,
IL> I'm experiencing problem with indentation of my R code. I'm following
IL> recommendation and have the following in my .emacs file
IL> ;; R-internals manual
IL> ;;; ESS
IL> (add-hook 'ess-mode-hook
IL> (lambda ()
IL> (ess-set-style 'C++ 'quiet)
IL> ;; Because
IL> ;; DEF GNU BSD K&R C++
IL> ;; ess-indent-level 2 2 8 5 4
IL> ;; ess-continued-statement-offset 2 2 8 5 4
IL> ;; ess-brace-offset 0 0 -8 -5 -4
IL> ;; ess-arg-function-offset 2 4 0 0 0
IL> ;; ess-expression-offset 4 2 8 5 4
IL> ;; ess-else-offset 0 0 0 0 0
IL> ;; ess-close-brace-offset 0 0 0 0 0
IL> (add-hook 'local-write-file-hooks
IL> (lambda ()
IL> (ess-nuke-trailing-whitespace)))))
IL> ;;(setq ess-nuke-trailing-whitespace-p 'ask)
IL> ;; or even
IL> (setq ess-nuke-trailing-whitespace-p t)
IL> ;; Perl
IL> (add-hook 'perl-mode-hook
IL> (lambda () (setq perl-indent-level 4)))
IL> ;-------------------------------------------
IL> This is the problem this is piece of code that indented correctly when
IL> it just part of the R scrip.
IL> ggplot(data = overtime.by.month,
IL> aes(x="",
IL> y=Percent,
IL> fill = Overtime)) +
IL> geom_bar(width = 1) +
IL> xlab('') +
IL> ylab(sub.txt) +
IL> labs(title = title.txt) +
IL> facet_wrap(~Year.Month) +
IL> geom_text(aes(y = txt.pos, label = Per.txt)) +
IL> coord_polar(theta = "y") +
IL> scale_fill_manual(values = c('green', 'red')) +
IL> theme(axis.ticks = element_blank(),
IL> axis.text.y = element_blank(),
IL> axis.text.x = element_blank())
IL> This is piece of the same code indented weirdly. As soon as it becomes
IL> part of the function something strange is happening with the
IL> indentation.
IL> a <- function(){
IL> a <- ggplot(data = overtime.by.month,
IL> aes(x="",
IL> y=Percent,
IL> fill = Overtime)) +
IL> geom_bar(width = 1) +
IL> xlab('') +
IL> ylab(sub.txt) +
IL> labs(title = title.txt) +
IL> facet_wrap(~Year.Month) +
IL> geom_text(aes(y = txt.pos, label =
IL> Per.txt)) +
IL> coord_polar(theta = "y") +
IL> scale_fill_manual(values = c('green', 'red')) +
IL> theme(axis.ticks = element_blank(),
IL> axis.text.y = element_blank(),
IL> axis.text.x = element_blank())
IL> }
IL> There are other similar indentation issues.
IL> Is there a way around it? I'm new emacs + ess user, and any help would
IL> be appreciated. I posted this question on stackoverflow and I was
IL> recommended to submit a bug report. Thank you for all your hard work on
IL> such a wonderful software.
IL> Best regards
IL> ilya
IL> -------------------------------------------------------
IL> This bug report will be sent to the ESS bugs email list
IL> Press C-c C-c when you are ready to send your message.
IL> -------------------------------------------------------
IL> [ess-site.el]: ess-customize-alist=nil
IL> [ess-site.el _2_]: ess-customize-alist=nil
IL> (S): ess-s-versions-create making M-x defuns for
IL> (R): ess-r-versions-create making M-x defuns for
IL> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t,
IL> comint..sender=comint-simple-send
IL> (ess-mode-1): ess-language=S, ess-dialect=R buf=local.service.overtime.report.r
IL> (ess-mode-1.5): alist=((ess-local-customize-alist quote R-customize-alist)
IL> (ess-dialect . R) (ess-suffix . R) (ess-dump-filename-template
IL> ess-replace-regexp-in-string S$ ess-suffix ess-dump-filename-template-proto)
IL> (ess-mode-syntax-table . R-syntax-table) (ess-mode-editing-alist
IL> . R-editing-alist) (ess-change-sp-regexp . ess-R-change-sp-regexp)
IL> (ess-help-sec-regex . ess-help-R-sec-regex) (ess-help-sec-keys-alist
IL> . ess-help-R-sec-keys-alist) (ess-loop-timeout . ess-S-loop-timeout)
IL> (ess-cmd-delay . ess-R-cmd-delay) (ess-function-pattern
IL> . ess-R-function-pattern) (ess-object-name-db-file . ess-r-namedb.el)
IL> (ess-imenu-mode-function quote ess-imenu-R) (ess-smart-operators
IL> . ess-R-smart-operators) (inferior-ess-program . inferior-R-program-name)
IL> (inferior-ess-objects-command . inferior-R-objects-command)
IL> (inferior-ess-font-lock-keywords quote inferior-R-font-lock-keywords)
IL> (inferior-ess-search-list-command . search()
IL> ) (inferior-ess-help-command . inferior-ess-r-help-command)
IL> (inferior-ess-help-filetype) (inferior-ess-exit-command . q())
IL> (inferior-ess-exit-prompt . Save workspace image? [y/n/c]: )
IL> (inferior-ess-start-file) (inferior-ess-start-args . ) (ess-error-regexp-alist
IL> . ess-R-error-regexp-alist) (ess-STERM . iESS) (ess-editor . R-editor)
IL> (ess-pager . R-pager) (ess-language . S) (inferior-ess-exit-command . q()
IL> ) (inferior-ess-language-start eval inferior-S-language-start)
IL> (comint-use-prompt-regexp . t) (comint-process-echoes . t)
IL> (inferior-ess-primary-prompt . > ) (inferior-ess-secondary-prompt . + )
IL> (comment-start . #) (comment-add . 1) (comment-start-skip . #+ *)
IL> (comment-use-syntax) (comment-column . 40) (ess-no-skip-regexp concat ^ *@\|
IL> (default-value (quote ess-no-skip-regexp))) (inferior-ess-prompt
IL> . inferior-S-prompt) (ess-get-help-topics-function quote
IL> ess-get-S-help-topics-function) (ess-getwd-command . getwd()
IL> ) (ess-setwd-command . setwd('%s')
IL> ))
IL> (ess-mode-1.6): editing-alist=((paragraph-start concat \s-*$\| page-delimiter)
IL> (paragraph-separate concat \s-*$\| page-delimiter) (paragraph-ignore-fill-prefix
IL> . t) (require-final-newline . t) (indent-line-function quote ess-indent-line)
IL> (parse-sexp-ignore-comments . t) (ess-style . ess-default-style)
IL> (ess-mode-syntax-table . S-syntax-table) (add-log-current-defun-header-regexp
IL> . ^\(.+\)\s-+<-[
IL> ]*function) (ess-font-lock-keywords quote ess-R-font-lock-keywords)
IL> (ess-font-lock-defaults ess--extract-default-fl-keywords
IL> ess-R-font-lock-keywords) (font-lock-defaults quote (ess-font-lock-defaults nil
IL> nil ((46 . w) (95 . w)))))
IL> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t,
IL> comint..sender=comint-simple-send
IL> Finished setting up ESS-mode.
IL> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t,
IL> comint..sender=comint-simple-send
IL> (ess-mode-1): ess-language=S, ess-dialect=R buf=*scratch*
IL> (ess-mode-1.5): alist=((ess-local-customize-alist quote R-customize-alist)
IL> (ess-dialect . R) (ess-suffix . R) (ess-dump-filename-template
IL> ess-replace-regexp-in-string S$ ess-suffix ess-dump-filename-template-proto)
IL> (ess-mode-syntax-table . R-syntax-table) (ess-mode-editing-alist
IL> . R-editing-alist) (ess-change-sp-regexp . ess-R-change-sp-regexp)
IL> (ess-help-sec-regex . ess-help-R-sec-regex) (ess-help-sec-keys-alist
IL> . ess-help-R-sec-keys-alist) (ess-loop-timeout . ess-S-loop-timeout)
IL> (ess-cmd-delay . ess-R-cmd-delay) (ess-function-pattern
IL> . ess-R-function-pattern) (ess-object-name-db-file . ess-r-namedb.el)
IL> (ess-imenu-mode-function quote ess-imenu-R) (ess-smart-operators
IL> . ess-R-smart-operators) (inferior-ess-program . inferior-R-program-name)
IL> (inferior-ess-objects-command . inferior-R-objects-command)
IL> (inferior-ess-font-lock-keywords quote inferior-R-font-lock-keywords)
IL> (inferior-ess-search-list-command . search()
IL> ) (inferior-ess-help-command . inferior-ess-r-help-command)
IL> (inferior-ess-help-filetype) (inferior-ess-exit-command . q())
IL> (inferior-ess-exit-prompt . Save workspace image? [y/n/c]: )
IL> (inferior-ess-start-file) (inferior-ess-start-args . ) (ess-error-regexp-alist
IL> . ess-R-error-regexp-alist) (ess-STERM . iESS) (ess-editor . R-editor)
IL> (ess-pager . R-pager) (ess-language . S) (inferior-ess-exit-command . q()
IL> ) (inferior-ess-language-start eval inferior-S-language-start)
IL> (comint-use-prompt-regexp . t) (comint-process-echoes . t)
IL> (inferior-ess-primary-prompt . > ) (inferior-ess-secondary-prompt . + )
IL> (comment-start . #) (comment-add . 1) (comment-start-skip . #+ *)
IL> (comment-use-syntax) (comment-column . 40) (ess-no-skip-regexp concat ^ *@\|
IL> (default-value (quote ess-no-skip-regexp))) (inferior-ess-prompt
IL> . inferior-S-prompt) (ess-get-help-topics-function quote
IL> ess-get-S-help-topics-function) (ess-getwd-command . getwd()
IL> ) (ess-setwd-command . setwd('%s')
IL> ))
IL> (ess-mode-1.6): editing-alist=((paragraph-start concat \s-*$\| page-delimiter)
IL> (paragraph-separate concat \s-*$\| page-delimiter) (paragraph-ignore-fill-prefix
IL> . t) (require-final-newline . t) (indent-line-function quote ess-indent-line)
IL> (parse-sexp-ignore-comments . t) (ess-style . ess-default-style)
IL> (ess-mode-syntax-table . S-syntax-table) (add-log-current-defun-header-regexp
IL> . ^\(.+\)\s-+<-[
IL> ]*function) (ess-font-lock-keywords quote ess-R-font-lock-keywords)
IL> (ess-font-lock-defaults ess--extract-default-fl-keywords
IL> ess-R-font-lock-keywords) (font-lock-defaults quote (ess-font-lock-defaults nil
IL> nil ((46 . w) (95 . w)))))
IL> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t,
IL> comint..sender=comint-simple-send
IL> Finished setting up ESS-mode.
IL> Emacs : GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
IL> of 2012-09-21 on batsu, modified by Debian
IL> Package: ess-mode 12.09 [<unknown>]
IL> current state:
IL> ==============
IL> (setq
IL> ess-language "S"
IL> ess-dialect "R"
IL> ess-ask-for-ess-directory nil
IL> ess-ask-about-transfile nil
IL> ess-directory nil
IL> ess-keep-dump-files "always"
IL> ess-source-directory "/tmp"
IL> ess-use-ido t
IL> ess-use-eldoc t
IL> ess-use-tracebug nil
IL> ess-use-auto-complete t
IL> ess-eval-visibly-p nil
IL> ess-can-eval-in-background nil
IL> ess-local-process-name nil
IL> )
More information about the ESS-bugs
mailing list