Start ESS process in R script - r

I've got the following problem in my Emacs (i am a complete newby and way far from LISP programming): When i open a .R file, no ESS process is starting. This is a problem because i want to configure TAB-completion and see R Documentation in scripts.
This is the Error message:"No ESS process associated with current buffer
"
This is only the case in .R files. When starting inferior ESS i dont have this problem. (hope i got this right: M-x R starts a process und Emacs and is therefore called inferior?)
My .emacs is cofigured like this:
(require 'auto-complete)
(require 'auto-complete-config)
(require 'ess-stata-mode)
(require 'ess-eldoc)
(add-hook 'inferior-ess-mode-hook 'ess-use-eldoc)
(autoload 'R-mode "ess-site.el" "" t)
(add-to-list 'auto-mode-alist '("\\.R\\'" . R-mode))
Those two lines above should start ESS in script, shouldn't they?
(global-auto-complete-mode t)
(setq ess-tab-complete-in-script t)
(setq ess-use-auto-complete 't)
(setq ess-use-eldoc 't)
(setq ess-use-company 't)
And I included ElDoc and AC to get Autocompletion.
I want to get to see the Documentation of R in Emacs.
I'd really appreciate your help. What did I miss?
Greetings and Thanks in advance

Related

spacemacs ess knitr doesn't work with Rmd files

I really want to switch from RStudio to Spacemacs with ess layer. However I can't get it to work. I have the following in my dotfile:
dotspacemacs-configuration-layers
'(
html
;; ----------------------------------------------------------------
;; Example of useful layers you may want to use right away.
;; Uncomment some layer names and press <SPC f e R> (Vim style) or
;; <M-m f e R> (Emacs style) to install them.
;; ----------------------------------------------------------------
markdown
helm
ess
auto-completion
better-defaults
emacs-lisp
git
polymode
mu4e
;; markdown
;; (shell :variables
org
;; shell-default-height 30
;; shell-default-position 'bottom)
spell-checking
syntax-checking
;; version-control
)
I have the following packages.el in my .emacs.d private folder copied with thanks from github.
;;; packages.el --- polymode layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Walmes Zeviani & Fernando Mayer
;; URL: https://github.com/syl20bnr/spacemacs
;;; Code:
(defconst polymode-packages
'(polymode))
(defun polymode/init-polymode ()
(use-package polymode
:mode (("\\.Rmd" . Rmd-mode))
:init
(progn
(defun Rmd-mode ()
"ESS Markdown mode for Rmd files"
(interactive)
(require 'poly-R)
(require 'poly-markdown)
(R-mode)
(poly-markdown+r-mode))
))
)
;;; packages.el ends here
Syntax highlighting and code completeion etc are working fine but if I try and send code chunks to REPL i get 'wrong type argument stringp nil' error with both Rmd and Rmv files.
emacs 25.2.1 with spacemacs
fresh install on both mac and linux with no other config loaded. Own .emacs has been deleted
some functions seem to work but not like they should e.g. eval-buffer will just send the current code chunk to REPL
Very grateful for any help.
It was a bit tricky to me to make it works with Rmd. Have you try with a simple .R file to see if it works?
This is what I currently have in mi .emacs file for the Rmd files
;; MARKDOWN
(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))
;; R modes
(add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
;; polymode
(setq load-path (append '("/home/fer/.emacs.d/elpa/polymode-20170307.322"
"/home/farce/.emacs.d/polymode/modes") load-path))
(require 'poly-R)
(require 'poly-markdown)
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))

Common lisp reading a gzipped stream line by line

I am currently dealing with a problem, where I have to read a zipped file line by line, and further on process each line and do something with it.
I managed to read from stdin using the following code:
(defun process ()
(princ (split-sequence:split-sequence #\Space (read-line))))
(defun main (args)
(process))
*this will be a command line tool
Where I ran it as:
cat file.txt | ./executable
this works fine, but it prints only the first line. I assume I must insert some form of loop in the first part, yet I am not sure how this is to be done.
Thank you for any help!
I solved this using:
(loop for line = (read-line) ; stream, no error, :eof value
until (eq line :eof)
do (princ line))

ESS and R from spacemacs

I hope this isn't a really dumb question, but I've used emacs in the past with ESS to edit R files and run them in an R process. I'd like to do the same with spacemacs. As far as I can read and grasp, it just means I have to enable the ess layer in the .spacemacs file, and that's it.
So in my .spacemacs I have the following:
'(
;; ----------------------------------------------------------------
;; Example of useful layers you may want to use right away.
;; Uncomment some layer names and press <SPC f e R> (Vim style) or
;; <M-m f e R> (Emacs style) to install them.
;; ----------------------------------------------------------------
;; auto-completion
;; better-defaults
emacs-lisp
;; git
markdown
javascript
colors
haskell
c-c++
ess
html
;; org
;; (shell :variables
;; shell-default-height 30
;; shell-default-position 'bottom)
;; spell-checking
;; syntax-checking
;; version-control
)
But if I close spacemacs then, and reboot, and try to create say an R file, there's no ess or formatting/colours or anything like that. The same for something like markdown too. All files are just opened in Fundamental mode. I thought spacemacs had layers so you can just add them and it work out of the box. So what am I missing or what should I check? I'm on OSX.
Thanks,
Ben.

How do I make time$ work with ctrl+t e in ACL2 and emacs?

When trying to copy a form into my ACL2 shell buffer using ctrl+t e, and I've already placed a time$ in my shell buffer, I get an error about not being able to paste the form. How do I change the emacs macro so that I can paste into ACL2 shell buffers that already have (time$ written into them?
Place this at the end of your ~/.emacs file:
(setq *acl2-insert-pats* '(:not ".*%[ ]*$" "[^(]*$[ ]*$" "^$"))

How do you pass arguments (I.E. the binarys name) to the Emacs gdb command?

Right now, I have F5 set to start gdb in emacs for me:
(global-set-key [f5] 'gdb)
This switches to the mini-buffer, which I then type a path to an executable... I'd like to find a way to bypass this path typing...
I wrote an executable that looks at the Makefile, parses it and figures out the full path of the executable and prints it to standard out... Is it possible to call this from my .emacs... And then somehow pass the output to the gdb command?
(defun gdb-getpath ()
"Figures out the path to executable and launches gdb."
(interactive)
(let ((path (shell-command-to-string "/path/to/your/executable")))
(gdb (concat "gdb " path))
))
(global-set-key [f5] 'gdb-getpath)

Resources