(defun display-r-instance ()
"Display the currently running R instance in another window"
(interactive)
(condition-case err
(progn
(display-buffer (ess-get-process-buffer) t))
(error (ess-start-process-specific ess-language ess-dialect))))
(use-package poly-markdown
:mode "\\.Rmd\\'")
(use-package ess
;; :ensure t
;; :init (require 'ess-site)
:mode (("\\.R$" . R-mode)
("\\.Rprofile$" . R-mode))
:config
(setq
;; comint-input-ring-size 99999
;; comint-move-point-for-output t
;; comint-prompt-read-only t
;; comint-scroll-to-bottom-on-input t
;; comint-scroll-to-bottom-on-output t
ess-ask-for-ess-directory t
ess-offset-continued 4
ess-eval-visibly-p nil
;; ess--prettify-symbols-alist '(("ANY" . 8707)
;; ("any" . 8707)
;; ("ALL" . 8704)
;; ("all" . 8704)
;; ("NOT" . 172)
;; ("not" . 172)
;; ("OR" . 8744)
;; ("or" . 8744)
;; ("AND" . 8743)
;; ("and" . 8743)
;; ("**n" . 8319)
;; ("**3" . 179)
;; ("**2" . 178)
;; ("phi" . 966)
;; ("PI" . 960)
;; ("pi" . 960)
;; ("LAMBDA" . 955)
;; ("lambda" . 955)
;; ("theta" . 952)
;; ("epsilon" . 949)
;; ("DELTA" . 916)
;; ("delta" . 916)
;; ("GAMMA" . 947)
;; ("gamma" . 947)
;; ("BETA" . 946)
;; ("beta" . 946)
;; ("ALPHA" . 945)
;; ("alpha" . 945)
;; ("SUM" . 8721)
;; ("sum" . 8721)
;; ("SQRT" . 8730)
;; ("sqrt" . 8730)
;; ("NOT IN" . 8713)
;; ("not in" . 8713)
;; ("IN" . 8712)
;; ("in" . 8712)
;; ("union" . 8899)
;; ("intersect" . 8898)
;; ("NONE" . 8709)
;; ("None" . 8709)
;; (">=" . 8805)
;; ("<=" . 8804)
;; ("!=" . 8800))
flycheck-lintr-linters "with_defaults(object_usage_linter = NULL, camel_case_linter = NULL, assignment_linter = NULL, infix_spaces_linter = NULL, line_length_linter = NULL, multiple_dots_linter = NULL, object_length_linter = NULL, absolute_paths_linter = NULL, spaces_left_parentheses_linter = NULL, single_quotes_linter = NULL)"
inferior-ess-r-program "/usr/local/bin/R"
smartscan-symbol-selector "symbol")
;; (use-package ess-smart-underscore)
;; (use-package helm-R)
;; (add-hook 'ess-mode-hook
;; #'(lambda ()
;; (turn-on-smartparens-strict-mode)
;; (flycheck-mode 1)
;; (rainbow-delimiters-mode-enable)
;; (smartscan-mode 1)
;; (subword-mode 1)
;; (add-hook 'after-save-hook #'delete-trailing-whitespace nil t)
;; ))
(add-hook 'ess-r-mode-hook
#'(lambda ()
(turn-on-smartparens-strict-mode)
(flycheck-mode 1)
(rainbow-delimiters-mode-enable)
(smartscan-mode 1)
(subword-mode 1)
(add-hook 'after-save-hook #'delete-trailing-whitespace nil t)
(define-key ess-r-mode-map (kbd "C-\\") 'ess-eval-line)
(define-key ess-r-mode-map (kbd "C-|") 'eval-at-cursor)
(define-key ess-r-mode-map (kbd "M-\\") 'display-r-instance)
))
(add-hook 'inferior-ess-mode-hook
#'(lambda ()
(smartparens-mode 1)
(helm-mode 1)
(turn-on-smartparens-strict-mode)
;; (auto-complete-mode t)
;; (company-mode 1)
(subword-mode 1)
;; (define-key inferior-ess-mode-map (kbd "M-<up>") 'move-text-up)
;; (define-key inferior-ess-mode-map (kbd "M-<down>") 'move-text-down)
(define-key inferior-ess-mode-map (kbd "\C-ct") 'ess-R-object-tooltip)
;; (ess-rdired)
;; (define-key ess-rdired-mode-map "t" 'ess-R-object-tooltip)
;; (define-key ess-rdired-mode-map "\C-c\C-t" 'ess-R-object-tooltip)
))
)
(use-package stan-mode
:mode ("\\.stan\\'" . stan-mode)
:hook (stan-mode . stan-mode-setup)
:config
;; The officially recommended offset is 2.
(setq stan-indentation-offset 2))
(use-package company-stan
:hook (stan-mode . company-stan-setup)
:config
(setq company-stan-fuzzy nil))
(use-package eldoc-stan
:hook (stan-mode . eldoc-stan-setup)
)
(use-package flycheck-stan
;; Add a hook to setup `flycheck-stan' upon `stan-mode' entry
:hook ((stan-mode . flycheck-stan-stanc2-setup)
(stan-mode . flycheck-stan-stanc3-setup))
:config
;; A string containing the name or the path of the stanc2 executable
;; If nil, defaults to `stanc2'
(setq flycheck-stanc-executable nil)
;; A string containing the name or the path of the stanc2 executable
;; If nil, defaults to `stanc3'
(setq flycheck-stanc3-executable nil))
(use-package stan-snippets
:hook (stan-mode . stan-snippets-initialize)
)