Re: R session error (org-babel)

2024-03-19 Thread Esteban Venialgo
hi William and Ihor,

Apologies for the late answer. I did some test on ESS and indeed that was the 
problem:

I was using: org version 9.6.17 and ess-version: 18.10.2. But, after I updated 
Gentoo (last weekend), the R code export worked fine! The current ESS version 
is: 24.01.1 and the org-version is the same.

   Thanks a lot for your help, Tetumetal

On 2024-03-07 00:30:03, William Denton wrote:
> On Wednesday, March 6th, 2024 at 05:56, Esteban Venialgo 
>  wrote:
> 
> > I tried the =emacs -Q=, and still get the same problem. Before exporting 
> > the code, I ran this lisp from the scratch pad:
> > 
> > ;; enable language support for R
> > (org-babel-do-load-languages
> > 'org-babel-load-languages
> > '((R . t)
> > (shell . t)
> > (latex . t)
> > (emacs-lisp . nil)))
> 
> Hmm! It does work for me.  I'm on Ubuntu 22.04, running Emacs and Org from 
> the development tree (so 30.0.50 and 9.7-pre).
> 
> I ran =emacs -Q= (and also =make repro= from in the Org source tree, which is 
> another useful tool for testing), and executed these lines in a scratch 
> buffer:
> 
> # -
> (org-babel-do-load-languages 'org-babel-load-languages '(
>  (R . t)
>  (shell . t)
>  ))
> (add-to-list 'load-path "~/.emacs.d/elpa/ess-20240229.2054") 
> (require 'ess-r-mode)
> # -
> 
> We're the same up to ESS.  (I had to check the version number on ESS to get 
> the path right, but that's the latest release installed.)  Looking back, did 
> you not mention using ESS?  I've never used R in Emacs without it.  If you 
> weren't using ESS, what happens if you install it and use it? 
> 
> Just for the sake of documentation: then I made an r.org file with the 
> snippet and ran it, and it worked:
> 
> # 
> #+begin_src R :session test
>   A <- 1
> #+end_src
> #
> 
> 
> Cheers,
> 
> Bill
> 
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada



Re: R session error (org-babel)

2024-03-06 Thread William Denton
On Wednesday, March 6th, 2024 at 05:56, Esteban Venialgo  
wrote:

> I tried the =emacs -Q=, and still get the same problem. Before exporting the 
> code, I ran this lisp from the scratch pad:
> 
> ;; enable language support for R
> (org-babel-do-load-languages
> 'org-babel-load-languages
> '((R . t)
> (shell . t)
> (latex . t)
> (emacs-lisp . nil)))

Hmm! It does work for me.  I'm on Ubuntu 22.04, running Emacs and Org from the 
development tree (so 30.0.50 and 9.7-pre).

I ran =emacs -Q= (and also =make repro= from in the Org source tree, which is 
another useful tool for testing), and executed these lines in a scratch buffer:

# -
(org-babel-do-load-languages 'org-babel-load-languages '(
 (R . t)
 (shell . t)
 ))
(add-to-list 'load-path "~/.emacs.d/elpa/ess-20240229.2054") 
(require 'ess-r-mode)
# -

We're the same up to ESS.  (I had to check the version number on ESS to get the 
path right, but that's the latest release installed.)  Looking back, did you 
not mention using ESS?  I've never used R in Emacs without it.  If you weren't 
using ESS, what happens if you install it and use it? 

Just for the sake of documentation: then I made an r.org file with the snippet 
and ran it, and it worked:

# 
#+begin_src R :session test
  A <- 1
#+end_src
#


Cheers,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada



Re: R session error (org-babel)

2024-03-06 Thread Esteban Venialgo
hi Bill,

I tried the =emacs -Q=, and still get the same problem. Before exporting the 
code, I ran this lisp from the scratch pad:

;; enable language support for R
(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)
   (shell . t)
   (latex . t)
   (emacs-lisp . nil)))

(setq load-path '("~/.emacs.d/lisp/" "/etc/emacs" "/usr/share/emacs/site-lisp" 
"/usr/share/emacs/site-lisp/auctex" "/usr/share/emacs/site-lisp/auto-complete" 
"/usr/share/emacs/site-lisp/color-theme" 
"/usr/share/emacs/site-lisp/company-mode" "/usr/share/emacs/site-lisp/counsel" 
"/usr/share/emacs/site-lisp/dictionary" "/usr/share/emacs/site-lisp/elpy" 
"/usr/share/emacs/site-lisp/ess" 
"/usr/share/emacs/site-lisp/highlight-indentation" 
"/usr/share/emacs/site-lisp/ivy" "/usr/share/emacs/site-lisp/lua-mode" 
"/usr/share/emacs/site-lisp/matlab" "/usr/share/emacs/site-lisp/org-mode" 
"/usr/share/emacs/site-lisp/popup" "/usr/share/emacs/site-lisp/python-mode" 
"/usr/share/emacs/site-lisp/pyvenv" "/usr/share/emacs/site-lisp/s" 
"/usr/share/emacs/site-lisp/site-gentoo.d" "/usr/share/emacs/site-lisp/swiper" 
"/usr/share/emacs/site-lisp/which-key" "/usr/share/emacs/site-lisp/xclip" 
"/usr/share/emacs/site-lisp/yasnippet" 
"/usr/share/emacs/site-lisp/color-theme/themes" "/usr/share/emacs/29.2/lisp" 
"/usr/share/emacs/29.2/lisp/vc" "/usr/share/emacs/29.2/lisp/use-package" 
"/usr/share/emacs/29.2/lisp/url" "/usr/share/emacs/29.2/lisp/textmodes" 
"/usr/share/emacs/29.2/lisp/progmodes" "/usr/share/emacs/29.2/lisp/play" 
"/usr/share/emacs/29.2/lisp/org" "/usr/share/emacs/29.2/lisp/nxml" 
"/usr/share/emacs/29.2/lisp/net" "/usr/share/emacs/29.2/lisp/mh-e" 
"/usr/share/emacs/29.2/lisp/mail" "/usr/share/emacs/29.2/lisp/leim" 
"/usr/share/emacs/29.2/lisp/language" 
"/usr/share/emacs/29.2/lisp/international" "/usr/share/emacs/29.2/lisp/image" 
"/usr/share/emacs/29.2/lisp/gnus" "/usr/share/emacs/29.2/lisp/eshell" 
"/usr/share/emacs/29.2/lisp/erc" "/usr/share/emacs/29.2/lisp/emulation" 
"/usr/share/emacs/29.2/lisp/emacs-lisp" "/usr/share/emacs/29.2/lisp/cedet" 
"/usr/share/emacs/29.2/lisp/calendar" "/usr/share/emacs/29.2/lisp/calc" 
"/usr/share/emacs/29.2/lisp/obsolete"))

btw, what emacs version are you using? and OS? Also, when you exported the 
code, did you set up org-babel-load-languages to run R?

My system details are:
Gentoo Linux
I tried GNU Emacs 29.2 and 28.2
org-mode version 9.6.17

   Thanks for your help, 





On 2024-03-06 06:21:10, William Denton wrote:
> On Tuesday, March 5th, 2024 at 09:12, Esteban Venialgo  
> wrote:
> 
> > I'm a newbie with org-babel, but I think I'm facing a bug for R code 
> > execution. Basically, I have a simple code for testing:
> > 
> > #+begin_src R :session test
> > A = 1
> > #+end_src
> > 
> > I get a lisp error when I try to export this code to latex. Also, if I 
> > remove the session name "test", the code will run in the second attempt. 
> > I'm using Emacs version 28.2 and org-mode version 9.6.17.
> 
> I can't help understand the error message, but I did try the R sample and 
> have no problem running it and exporting it.  I suspect it might be something 
> about your local setup.  Could you try starting with =emacs -Q= and loading 
> in Org and enough else to run the R snippet?  How to get started with that is 
> here:
> 
> https://orgmode.org/manual/Feedback.html
> 
> It doesn't cover getting R working, but we can help with that.  I can look 
> for a snippet of code if you need one.
> 
> Cheers,
> 
> Bill
> 
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada
> 
> 



Re: R session error (org-babel)

2024-03-06 Thread Ihor Radchenko
Esteban Venialgo  writes:

> hi Org-people,
>
> I'm a newbie with org-babel, but I think I'm facing a bug for R code 
> execution. Basically, I have a simple code for testing:
> ...
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   org-babel-R-initiate-session...

As William pointed, it does look like some mis-configuration of ESS.
However, I am concerned about the obscurity of the error.
May you try testing with the latest development version of Org mode? (I
do hope that the error is less cryptic there)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: R session error (org-babel)

2024-03-05 Thread William Denton
On Tuesday, March 5th, 2024 at 09:12, Esteban Venialgo  
wrote:

> I'm a newbie with org-babel, but I think I'm facing a bug for R code 
> execution. Basically, I have a simple code for testing:
> 
> #+begin_src R :session test
> A = 1
> #+end_src
> 
> I get a lisp error when I try to export this code to latex. Also, if I remove 
> the session name "test", the code will run in the second attempt. I'm using 
> Emacs version 28.2 and org-mode version 9.6.17.

I can't help understand the error message, but I did try the R sample and have 
no problem running it and exporting it.  I suspect it might be something about 
your local setup.  Could you try starting with =emacs -Q= and loading in Org 
and enough else to run the R snippet?  How to get started with that is here:

https://orgmode.org/manual/Feedback.html

It doesn't cover getting R working, but we can help with that.  I can look for 
a snippet of code if you need one.

Cheers,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada





R session error (org-babel)

2024-03-05 Thread Esteban Venialgo
hi Org-people,

I'm a newbie with org-babel, but I think I'm facing a bug for R code execution. 
Basically, I have a simple code for testing:

#+begin_src R :session test
  A = 1
#+end_src

I get a lisp error when I try to export this code to latex. Also, if I remove 
the session name "test", the code will run in the second attempt. I'm using 
Emacs version 28.2 and org-mode version 9.6.17. The lisp error log is bellow:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  org-babel-R-initiate-session("test" ((:colname-names) (:rowname-names) 
(:result-params "silent" "replace") (:result-type . value) (:results . 
"silent") (:exports . "code") (:session . "test") (:tangle . "no") (:hlines . 
"no") (:noweb . "no") (:cache . "no")))
  org-babel-execute:R("A = 1" ((:colname-names) (:rowname-names) 
(:result-params "silent" "replace") (:result-type . value) (:results . 
"silent") (:exports . "code") (:session . "test") (:tangle . "no") (:hlines . 
"no") (:noweb . "no") (:cache . "no")))
  org-babel-execute-src-block(nil ("R" "A = 1" ((:colname-names) 
(:rowname-names) (:result-params "silent" "replace") (:result-type . value) 
(:results . "silent") (:exports . "code") (:cache . "no") (:noweb . "no") 
(:hlines . "no") (:tangle . "no") (:session . "test")) "" nil 1 "(ref:%s)"))
  org-babel-exp-results(("R" "A = 1" ((:colname-names) (:rowname-names) 
(:result-params "replace") (:result-type . value) (:results . "replace") 
(:exports . "code") (:session . "test") (:tangle . "no") (:hlines . "no") 
(:noweb . "no") (:cache . "no")) "" nil 1 "(ref:%s)") block silent)
  #f(compiled-function (info type) #)(("R" "A = 1" 
((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . 
value) (:results . "replace") (:exports . "code") (:session . "test") (:tangle 
. "no") (:hlines . "no") (:noweb . "no") (:cache . "no")) "" nil 1 "(ref:%s)") 
block)
  org-babel-exp-do-export(("R" "A = 1" ((:colname-names) (:rowname-names) 
(:result-params "replace") (:result-type . value) (:results . "replace") 
(:exports . "code") (:session . "test") (:tangle . "no") (:hlines . "no") 
(:noweb . "no") (:cache . "no")) "" nil 1 "(ref:%s)") block nil)
  org-babel-exp-src-block((src-block (:language "R" :switches nil :parameters 
":session test" :begin 1 :end 47 :number-lines nil :preserve-indent nil 
:retain-labels t :use-labels t :label-fmt nil :value "  A = 1\n" :post-blank 0 
:post-affiliated 1 :mode top-comment :granularity element :cached t :parent 
(section (:begin 1 :end 47 :contents-begin 1 :contents-end 47 :robust-begin 1 
:robust-end 45 :post-blank 0 :post-affiliated 1 :mode first-section 
:granularity element :cached t :parent (org-data (:begin 1 :contents-begin 1 
:contents-end 47 :end 47 :robust-begin 3 :robust-end 45 :post-blank 0 
:post-affiliated 1 :path "/home/esteban/test.org" :mode org-data :CATEGORY 
"test" :cached t)))
  org-babel-exp-process-buffer()
  org-export-as(latex nil nil nil (:output-file "test.tex"))
  org-export-to-file(latex "test.tex" nil nil nil nil nil org-latex-compile)
  org-latex-export-to-pdf(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  call-interactively(org-export-dispatch record nil)
  command-execute(org-export-dispatch record)
  counsel-M-x-action("org-export-dispatch")
  ivy-call()
  ivy-read("M-x " [ess-create-temp-buffer table--measure-max-width 
vc-src-responsible-p calendar-forward-week tramp-sudoedit-file-name-handler 
tramp-completion-handle-file-name-all-completions Set\ Slice 
make-mode-line-mouse-map table-source-caption-history Reduce\ To:\ to\ Cc: 
ido-prev-match help-follow-symbol ess-long+replacement 
japanese-hiragana-two-byte gnus-article-nndoc-name 
org-export-before-processing-functions rng-parse-validate-file 
senator-eldoc-use-color speedbar-file-regexp ess-keyword-face 
org-table--descriptor-line Rnw-mode message-expand-name-databases 
info--manual-names 0 nnoo-map-functions gnus-try-warping-via-registry 
compilation-error-list displ-string *table--cell-kill-paragraph 
:odt-styles-file vc-annotate all-packs org-table-get-range vc-bzr-shelve-menu 
rng-match-infer-start-tag-namespace 0 org-agenda-regexp-filter-preset 
gnus-summary-limit-to-marks org-agenda-menu-show-matcher hs-toggle-hiding 0 
article-fill-long-lines smime-buffer-as-string-region org-get-org-file 
check-declare Info-breadcrumbs counsel--async-filter bibtex-text-in-string ! 
...] :predicate #f(compiled-function (sym) #) 
:require-match t :history counsel-M-x-history :action counsel-M-x-action 
:keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . 
counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  call-interactively(counsel-M-x nil nil)
  command-execute(counsel-M-x)
  
Thanks for your help, tetumetal