Re: [ESS] Need help installing ess using M-x package-install-file

2022-12-11 Thread Jeremie Juste via ESS-help
Hello Naresh,

On Saturday, 10 Dec 2022 at 08:46, Naresh Gurbuxani via ESS-help wrote:
> In my organization, IT security set up disables emacs package
> installation from package archives (e.g. MELPA) using M-x
> package-install.  Therefore, I am downloading package tar files from
> package archives, then using M-x package-install-file command.  This
> method has successfully installed several packages (e.g., auctex) on
> my computer.  But with ess, I have run into problems.


I feel for you. Do you have a personal computer that you can control? I
see that you are working in a Windows environment. Many times I installed
all the packages one machine then just copied the .emacs.d directory
to the other machine, with  most packages working as expected.

If this is an option for you ESS might work out of the box as well. You
might just have to let ESS know where to find R.

|(setq inferior-ess-r-program 
"c:/Users/JeremieJuste/Documents/R/R-4.2.0/bin/x64/Rterm")
|(add-to-list 'exec-path "c:/Users/JeremieJuste/Documents/R/R-4.2.0/bin/")

Alternatively, for ESS you also have the git repo 
https://github.com/emacs-ess/ESS.
>From that you can switch to branch 18.10.

You have more information in the manual
https://ess.r-project.org/Manual/ess.html#Installation.



As far as I understand ESS is supposed to work even without compiling it
on your machine. Although it won't provide the best experience but is
expected to work.


| (add-to-list 'load-path "/path/to/ESS/lisp")
| (require 'ess-site)
| (setq-default inferior-R-program-name
|"c:/Program Files/Microsoft/R 
Open/R-3.5.1/bin/x64/Rterm.exe")


I also note that you are running R 3.5. From the 4.2,
R uses UTF-8 as the native encoding. This has been a real pain before.

Please see https://cran.r-project.org/doc/manuals/r-release/NEWS.html


HTH,
Jeremie

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


[ESS] column auto completion for data.frame

2022-11-23 Thread Jeremie Juste via ESS-help
Hello,

I found myself always complaining about the lack of auto-completion
feature for data.frame columns.
I decided try my hand at writing a backend that seems to be working, so
I thought of sharing it on the mailing list.

It is just a small hack that mainly relies on the
ess--get-cached-completions function.


Hope this helps,
Jeremie

;;; usage

(require 'company-df-backend)
(setq ess-r-company-backends
  '((company-R-library company-R-args company-df-backend company-R-objects 
company-files company-yasnippet :separate)))


; file company-df-backend.el
(defun data-frame ()
 "Returns the name of the current data frame in use. If no data.frame is
begin written returns nil"
 (interactive)
 (format "%S" (data--frame)))

(defun data--frame ()
 "Returns thw sexp at point of the current data frame in use. If no
data.frame is begin written returns nil
 wrap with message to test."
 (interactive)
 (save-excursion
  (progn (re-search-forward ".*\\[" nil t -1) (backward-char) 
(sexp-at-point

(defun sample-fuzzy-match (prefix candidate )
 (interactive)
(cl-subsetp (string-to-list prefix)
(string-to-list candidate)))

(defun fuzzy-match-list1 (arg dt)
 "Filter candidate. ARG the symbol at point. DT the name of the
data.frame."
 (interactive)
  (cl-remove-if-not
  (lambda (c) (sample-fuzzy-match arg c))
  (let ((proc (ess-get-next-available-process)))
 (when proc
  (with-current-buffer (process-buffer proc)
   (mapcar (lambda (x) (replace-regexp-in-string ".*\
\$" "" x)) (ess--get-cached-completions (concat dt "$" arg   

(defun company-df-backend (command  arg  ignored)
(interactive (list 'interactive))
 (cl-case command
  (interactive (company-begin-backend 'company-df-backend))
  (prefix (company-grab-symbol))
  (candidates (fuzzy-match-list1 arg (data-frame)))
  (annotation " ")))

(provide 'company-df-backend)

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


[ESS] Removing extra > when evaluating region

2021-11-26 Thread Jeremie Juste via ESS-help
Hello,

I would like to remove the extra > and + generated when evaluating
a region, with ess-eval-visibly set to nil.  I saw issue #576 on github
and tried to set inferior-ess-replace-long+ to `strip` but I still get
misalignement as shown in the example below.

I favour the right alignment when prinint over any information that the
repetition of the primary and secondary prompt provide.

  (setq ess-eval-visibly nil)


I'm using ess-version: 18.10.3snapshot [elpa: 20211122.1708] (loaded
from /home/djj/.emacs.d/elpa/ess-20211122.1708/).

Any help would be greatly appreciated

Best regards,
Jeremie



# file test.R
library(data.table)
acbi <- function(){

}

acbi <- function(){

}


aa <- data.frame(a=1:10,b=letters[1:10])
aa



> + + > > > > + + > > > > > > a b
1   1 a
2   2 b
3   3 c
4   4 d
5   5 e
6   6 f
7   7 g
8   8 h
9   9 i
10 10 j

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Style: avoid new lines in chains of square brackets [][]

2021-06-03 Thread Jeremie Juste via ESS-help
Hello Vincent,

> On Wed, Jun 2, 2021, at 19:01, Vincent Arel-Bundock via ESS-help wrote:
>> Jeremie,
>> 
>> This is quite embarrassing, but the behavior does NOT replicate under 
>> vanilla emacs. I should have done my research!

I have fallen into this trap (many times) as well so rest assured you
are in good company.

On Thursday,  3 Jun 2021 at 11:40, Vincent Arel-Bundock via ESS-help wrote:
> On a Windows 10 machine with emacs 27.1, I was able to get the intended 
> formatting with:
>
> (setq lsp-enable-on-type-formatting nil)
>
> Apologies for posting to the wrong list, and thanks again.

Glad you found the culprit and thanks for sharing.

> Apologies for posting to the wrong list, and thanks again.
Learning to seek for help is an quality I cherish and is at the heart of
free software. I never imagined how much I would have learned by doing
so. So no need to apologize. ;-)

Best regards,
Jeremie

PS: We think therefore we R (with ESS).

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Style: avoid new lines in chains of square brackets [][]

2021-06-02 Thread Jeremie Juste via ESS-help


Hello Vincent,

On Wednesday,  2 Jun 2021 at 09:14, Vincent Arel-Bundock via ESS-help wrote:
> Hi all,
>
> Thanks for your awesome work on ESS!
>
> I use the data.table package with chains of square brackets, and would like 
> to indent my code as follows:
>
> library(data.table)
> dat = data.table(mtcars)
> dat[
> cyl == 4][
>   , gear := gear * 3]
>
> However, when I type this code, new lines get inserted automatically and I 
> get this:
>
> dat[
> cyl == 4
> ][
> , gear := gear * 3
> ]
I cannot reproduce this behavior. Could you try with a vanilla emacs?

In the terminal

$ emacs -Q

then execute

(add-to-list 'load-path "path to ess")
(require 'ess-site)

Can you still reproduce the behavior?
If yes, could you specify which OS, emacs version and ESS version are
you currently using?

HTH,
Jeremie

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] User-space installation of ESS 18.10.2 failing

2021-03-15 Thread Jeremie Juste via ESS-help
Hello,

> Note: I tried installation from MELPA first, but the version of ess
> there insists on Emacs 25.1, and my available options are 26.1 or
> 27.1.
For info I have installed ess-version: 18.10.3snapshot [elpa:
20210307.735] both on linux and windows, from Melpa without any difficulties.

# emacs version on linux
GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5,
cairo version 1.16.0) of 2020-09-01

# emacs version on windows
GNU Emacs 27.1 (build 1, x86_64-w64-mingw32) of 2020-08-21


Best regards,
Jeremie

On Monday, 15 Mar 2021 at 11:29, Steve Gutreuter via ESS-help wrote:
> I am trying to install ess-18.10.2 from the tarball into .emac.d on a
> compute server for which I am not root.  After extracting the tarball
> into ~/.emacs.d/ess-18.10.2, entering that directory and executing
> make (all per the instructions in the ESS manual), I am getting
>
> $> make
> cd lisp; make all
> make[1]: Entering directory
> `/scicomp/home-pure/wqh4/.emacs.d/ess-18.10.2/lisp'
> emacs -batch -no-site-file -no-init-file --directory . -f
> batch-byte-compile julia-mode.el
> Opening directory: Permission denied,
> /apps/x86_64/emacs/27.1/share/emacs/site-lisp/ess
> make[1]: *** [julia-mode.elc] Error 255
> make[1]: Leaving directory
> `/scicomp/home-pure/wqh4/.emacs.d/ess-18.10.2/lisp'
> make: *** [all] Error 2
>
> There is no .configure file.  How doe one avoid the apparent need to
> write to /apps/x86_64/emacs/27.1/share/emacs/site-lisp/ess in order to
> install ess in .emacs.d?
>
> Note: I tried installation from MELPA first, but the version of ess
> there insists on Emacs 25.1, and my available options are 26.1 or
> 27.1.
>
> Thanks in advance for any tips.

-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] [External] Re: ESS M-x R failing in a Windows installation

2021-03-10 Thread Jeremie Juste via ESS-help
To be clear, for my part I was referring to the latest MELPA version

"ess-version: 18.10.3snapshot [elpa: 20210307.735]

And once inferior-ess-r-program is properly set, I didn't experience any
trouble loading R and in using ess-flymake on windows.

Best regards,
Jeremie

On Wednesday, 10 Mar 2021 at 19:54, Richard M. Heiberger via ESS-help wrote:
> The relevant question is what version of ess are you using?
> more specifically which version of ess is included with VIncent Goulet's 
> emacs-26.1?
>
> the "bin/x64/Rterm.exe" construction is not in ess-16.10
> It is in ess-18.10
>
> the /x64/ wasn't meaningful until R stsarted releasing both 32-bit versions 
> and 64-bit versions.
>
> I don't remember ever using the Windows directory.
> U introduced ess-rterm-version-paths at some point.  It has been rewritten
> since then, but should still be working as long as you have a recent enough 
> ess.
>
> 
> From: ESS-help  on behalf of Sparapani, 
> Rodney via ESS-help 
> Sent: Wednesday, March 10, 2021 10:40
> To: ess-help@r-project.org
> Subject: [External] Re: [ESS] ESS M-x R failing in a Windows installation
>
> Hi Jeremie:
>
> As you say, Windows installs do depend on the user’s preferences.
> However, in ancient ESS (circa 2004), we coded around this by
> going to the Windows registry.  However, I have rarely used
> Windows since so I can’t say how that approach might be
> used today (or if it is, how it might be failing).  I think a big
> issue is that few (if any) ESS developers are using Windows.
> Rich was probably the rear guard and he switched to Mac.
>
> PS. the old registry discussions are probably in the archives
> https://stat.ethz.ch/pipermail/ess-help/
>
> --
> Rodney Sparapani, Associate Professor of Biostatistics
> Chair ISBA Section on Biostatistics and Pharmaceutical Statistics
> Institute for Health and Equity, Division of Biostatistics
> Medical College of Wisconsin, Milwaukee Campus
>
> [[alternative HTML version deleted]]
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>

-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] ESS M-x R failing in a Windows installation

2021-03-10 Thread Jeremie Juste via ESS-help
Hello,

I suspect there is a bug regarding the variable ess-rterm-version-paths
It is now available in ess-custom.el but is nil by default.

This should not be the case. It should have the value

(setq ess-rterm-version-paths
  (ess-flatten-list
   (delete-dups
(if (not ess-directory-containing-R)
(if (getenv "ProgramW6432")
(let ((P-1 (getenv "ProgramFiles(x86)"))
  (P-2 (getenv "ProgramFiles(x64)")))
  (nconc
   ;; Always 32 on 64 bit OS, nil on 32 bit OS
   (ess-find-rterm (concat P-1 "/R/") "bin/Rterm.exe")
   (ess-find-rterm (concat P-1 "/R/") "bin/i386/Rterm.exe")

   ;; Keep this both for symmetry and because it can happen:
   (ess-find-rterm (concat P-1 "/R/") "bin/x64/Rterm.exe")

   ;; Always 64 on 64 bit OS, nil on 32 bit OS
   (ess-find-rterm (concat P-2 "/R-4.03/") "bin/Rterm.exe")
   (ess-find-rterm (concat P-2 "/R-4.03/") "bin/i386/Rterm.exe")
   (ess-find-rterm (concat P-2 "/R-4.03/") 
"bin/x64/Rterm.exe")))
  (let ((PF (getenv "ProgramFiles")))
(nconc
 ;; Always 32 on 32 bit OS, depends on 32 or 64 process on 64 
bit OS
 (ess-find-rterm (concat PF "/R/") "bin/Rterm.exe")
 (ess-find-rterm (concat PF "/R/") "bin/i386/Rterm.exe")
 (ess-find-rterm (concat PF "/R/") "bin/x64/Rterm.exe"
  (let ((PF ess-directory-containing-R))
(nconc
 (ess-find-rterm (concat PF "/R/") "bin/Rterm.exe")
 (ess-find-rterm (concat PF "/R/") "bin/i386/Rterm.exe")
 (ess-find-rterm (concat PF "/R/")
   "bin/x64/Rterm.exe")))
   
as in ess-r-mode.el. Please check again as I may have modified it. 

Best regards,
Jeremie



On Wednesday, 10 Mar 2021 at 15:40, Sparapani, Rodney via ESS-help wrote:
> Hi Jeremie:
>
> As you say, Windows installs do depend on the user’s preferences.
> However, in ancient ESS (circa 2004), we coded around this by
> going to the Windows registry.  However, I have rarely used
> Windows since so I can’t say how that approach might be
> used today (or if it is, how it might be failing).  I think a big
> issue is that few (if any) ESS developers are using Windows.
> Rich was probably the rear guard and he switched to Mac.
>
> PS. the old registry discussions are probably in the archives
> https://stat.ethz.ch/pipermail/ess-help/
>
> --
> Rodney Sparapani, Associate Professor of Biostatistics
> Chair ISBA Section on Biostatistics and Pharmaceutical Statistics
> Institute for Health and Equity, Division of Biostatistics
> Medical College of Wisconsin, Milwaukee Campus
>
>   [[alternative HTML version deleted]]
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] ESS M-x R failing in a Windows installation

2021-03-10 Thread Jeremie Juste via ESS-help
Hello Steve,

Is there any reason for this downgrade?
In general R is harder to find on windows because installation configuration
depends too much on the user. 

It might be a good idea to live it to the user in this case.

A possible solution is to take the override the default command.

For instance on a windows setting, locate Rterm.exe, wherever it may be.
I have a window config R is in D directory: "d:/R/R-4.0.3/bin/x64/Rterm.exe"

Then in the init.el file override the ess-rterm-version-paths variable
(setq ess-rterm-version-paths '("d:/R/R-4.0.3/bin/x64/Rterm.exe"))

Then M-x R-newest, should let through.

I have even binded it to a key

(global-set-key (kbd "C-'") 'R-newest)

HTH,
Jeremie

On Friday,  5 Mar 2021 at 17:26, Steve Gutreuter wrote:
> Thank you Jeremie.
>
> M-x ess-r-newest returns "[No match]" on my system.
>
> Does it not seem odd that everything worked properly until I
> downgraded from emacs-27.1-modified-1.exe to
> emacs-26.1-modified-2.exe?
>
> Again, thanks,
>
> Steve
>

On Wednesday, 10 Mar 2021 at 09:59, Dominic Steinitz via ESS-help wrote:
> I am not on windows but for me a way round this is to start R in a shell (in 
> emacs) and then ess-remote. I’ve moved on to using direnv and lorri but 
> that’s not an option for windows.
>
> Dominic Steinitz
> domi...@steinitz.org
> http://idontgetoutmuch.org
> Twitter: @idontgetoutmuch
>
>> 
>>   1. Re:  ESS M-x R failing in a Windows installation (Jeremie Juste)
>> 
>> --
>> 
>> Message: 1
>> Date: Fri, 05 Mar 2021 22:37:44 +0100
>> From: Jeremie Juste 
>> To: Steve Gutreuter via ESS-help 
>> Subject: Re: [ESS] ESS M-x R failing in a Windows installation
>> Message-ID: <87eegtxown@gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>> 
>> Hello Steve,
>> 
>> Yest this is a known problem on windows.
>> 
>> A temporary solution might be to use the command M-x ess-r-newest.
>> For my part I have rebinded  the above command to a key C-'.
>> It is not the best solution but it works for me.
>> If I come up with a better fix I'll update.
>> 
>> HTH,
>> Jeremie
>> 
>> 
>> 
>> 
>> On Friday,  5 Mar 2021 at 15:51, Steve Gutreuter via ESS-help wrote:
>>> M-x R is returning the message "Searching for program: No such file or
>>> directory, Rterm" under MS Windows.
>>> 
>>> R 4.0.3 is installed in c:\Program Files\R\4.0.3, and Rterm.exe is
>>> present in c:/Program Files/R/R-4.0.3/bin/x64.
>>> My path environment variable includes c:\Program Files\R\4.0.3.
>>> R starts fine outside of Emacs.
>>> My .emacs file includes:
>>>(require 'ess-rutils)
>>>(setq inferior-ess-r-program "c:/Program
>>> Files/R/R-4.0.3/bin/x64/Rterm.exe)
>>> I am using Vincent Goulet's emacs-26.1-modified-2.exe and
>>> emacs-27.1-modified-1.exe which bundle ESS within the Emacs
>>> installation.
>>> Everything worked fine under Emacs 26.1 and earlier.  I upgraded to
>>> Emacs 27.1 and M-x R still worked.  I backed down to Emacs 26.1 and
>>> now M-x R is broken.
>>> 
>>> I am baffled as to why ESS is not finding R.  Any clues?
>>> 
>>> Many thanks
>> 
>> -- 
>> Jeremie Juste
>> 
>
>   [[alternative HTML version deleted]]
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>

-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] ESS M-x R failing in a Windows installation

2021-03-05 Thread Jeremie Juste via ESS-help
Hello Steve,

Yest this is a known problem on windows.

A temporary solution might be to use the command M-x ess-r-newest.
For my part I have rebinded  the above command to a key C-'.
It is not the best solution but it works for me.
If I come up with a better fix I'll update.

HTH,
Jeremie




On Friday,  5 Mar 2021 at 15:51, Steve Gutreuter via ESS-help wrote:
> M-x R is returning the message "Searching for program: No such file or
> directory, Rterm" under MS Windows.
>
> R 4.0.3 is installed in c:\Program Files\R\4.0.3, and Rterm.exe is
> present in c:/Program Files/R/R-4.0.3/bin/x64.
> My path environment variable includes c:\Program Files\R\4.0.3.
> R starts fine outside of Emacs.
> My .emacs file includes:
>    (require 'ess-rutils)
>    (setq inferior-ess-r-program "c:/Program
> Files/R/R-4.0.3/bin/x64/Rterm.exe)
> I am using Vincent Goulet's emacs-26.1-modified-2.exe and
> emacs-27.1-modified-1.exe which bundle ESS within the Emacs
> installation.
> Everything worked fine under Emacs 26.1 and earlier.  I upgraded to
> Emacs 27.1 and M-x R still worked.  I backed down to Emacs 26.1 and
> now M-x R is broken.
>
> I am baffled as to why ESS is not finding R.  Any clues?
>
> Many thanks

-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


[ESS] readline with trailing space

2021-03-05 Thread Jeremie Juste via ESS-help
Hello,

I have noticed a behavior that I don't understand. When I call the
following function from the prompt.
test <- function(){
a <- readline("selection: ")
a
}

> test()
> selection: |
I can only type one character and the readline function exits before I can
press enter.

however

test1 <- function(){
a <- readline("selection:")
a
}
> test1()
> selection:|
works as expected.
> selection: abc[Ret]

However calling directly readline with a space in the prompt does what I
would expect.

> a <- readline("selection: ")
> selection: abc[Ret]
> a
> "abc"

It is the expected behavior or am I missing something?


I can reproduce this behavior on Windows and Linux.
I cannot reproduce this behavior in a bash terminal, or on RStudio.
I'm using ess-version: 18.10.3snapshot [elpa: 20200825.829] (loaded from
/home/djj/.emacs.d/elpa/ess-20200825.829/) but the problem still persist
in the latest version. 

Best regards.
-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Error message when starting R

2021-02-05 Thread Jeremie Juste via ESS-help
Hello Jaime,

> Strangely, I can see a ess-20210204.856 directory, but not the
> "ess-20210202.836" . Should I just reinstall the package then?
This would be my first approach.


HTH,
Jeremie



On Thursday,  4 Feb 2021 at 21:58, Jaime Alvarez Gerding wrote:
> Thank you Jeremie.
>
> Strangely, I can see a ess-20210204.856 directory, but not the
> "ess-20210202.836" . Should I just reinstall the package then?
>
> Jaime
>
> On Thu, Feb 4, 2021 at 2:59 PM Jeremie Juste  wrote:
>
>> Hello Jaime,
>>
>> Could you check the mentioned directory to see if anything is there?
>>
>> For my part, if I check the following path where ESS is installed,
>> c:/Users/Jeremie/AppData/Roaming/.emacs.d/elpa/ess-20201122.814/etc/ESSR/R/
>>
>> I can see the .load.R file.
>> A potential solution would be to delete the package and install it
>> again.
>>
>>
>> HTH,
>> Jeremie
>>
>>
>> On Thursday,  4 Feb 2021 at 12:41, Jaime Alvarez Gerding via ESS-help
>> wrote:
>> > Hello, I just updated ESS from MELPA and Iget the following message after
>> > starting R
>> >
>> > Messages while loading ESSR: + + + Error in file(filename, "r", encoding
>> =
>> > encoding) :
>> >   cannot open the connection
>> > In addition: Warning message:
>> > In file(filename, "r", encoding = encoding) :
>> >   cannot open file
>> >
>> ’/Users/jaimealvarezgerding/.emacs.d/elpa/ess-20210202.836/etc/ESSR/R/.load.R’:
>> > No such file or directory
>> >
>> > if: Timeout during background ESS command ‘options(STERM='iESS',
>> > str.dendrogram.last="'", editor='emacsclient',
>> show.error.locations=TRUE)’
>> >
>> > I'd appreciate any assistance.
>> >
>> > Jaime
>> >
>> >   [[alternative HTML version deleted]]
>> >
>> > __
>> > ESS-help@r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/ess-help
>> >
>>
>> --
>> Jeremie Juste
>>

-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Error message when starting R

2021-02-04 Thread Jeremie Juste via ESS-help
Hello Jaime,

Could you check the mentioned directory to see if anything is there?

For my part, if I check the following path where ESS is installed,
c:/Users/Jeremie/AppData/Roaming/.emacs.d/elpa/ess-20201122.814/etc/ESSR/R/

I can see the .load.R file.
A potential solution would be to delete the package and install it
again.


HTH,
Jeremie


On Thursday,  4 Feb 2021 at 12:41, Jaime Alvarez Gerding via ESS-help wrote:
> Hello, I just updated ESS from MELPA and Iget the following message after
> starting R
>
> Messages while loading ESSR: + + + Error in file(filename, "r", encoding =
> encoding) :
>   cannot open the connection
> In addition: Warning message:
> In file(filename, "r", encoding = encoding) :
>   cannot open file
> ’/Users/jaimealvarezgerding/.emacs.d/elpa/ess-20210202.836/etc/ESSR/R/.load.R’:
> No such file or directory
>
> if: Timeout during background ESS command ‘options(STERM='iESS',
> str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)’
>
> I'd appreciate any assistance.
>
> Jaime
>
>   [[alternative HTML version deleted]]
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>

-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


[ESS] ess-watch over tramp

2021-01-19 Thread Jeremie Juste via ESS-help
Hello,

I would like to use ess-watch from a remote session but I receive the
follow error. When I execute M-x ess-watch

Error in as.environment("ESSR") : 
no item called "ESSR" on the search list

The problem seems to lie with, as.environment("ESSR") that cannot be
found on the remote

on my local R session as.environment("ESSR") works
as.environment("ESSR")



Do you have any clue?

Best regards,
-- 
Jeremie Juste

- ess-version: 18.10.3snapshot [elpa: 20200825.829]
- emacs: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
- 3.24.5, cairo version 1.16.0) of 2020-09-01
- R version 4.0.3 (2020-10-10)

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


[ESS] feature request support autocompletion of data.table colum names

2021-01-15 Thread Jeremie Juste via ESS-help
Hello,

I was wondering if it is possible to support the auto-completion of
data.table column names with company. I know that dt$... works find but
I was looking for dt[...]

I investigated a little bit the company-R-objects backend function in
the file ess-r-completion.el. But I got stuck with this mysterious
function: ess-bounds-of-symbol. Do you have a clearer picture than me?

Best regards,
Jeremie




-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Running R over tramp

2020-12-19 Thread Jeremie Juste via ESS-help
Hello Chris,

Sorry I am not sure to see what would cause the issue.

I see two options for further investigation:
1. update R to 4.0
2. do you have a particular script that runs at the start of your R
session on the remote computer? I would suggest trying setting
(setq inferior-R-args "--vanilla") before running launching the session
on the remote  to check if it solves the problem. 

HTH,
Jeremie


On Saturday, 19 Dec 2020 at 15:04, Chris Wallace wrote:
> Dear Jeremie,

>
> short answer:
> - ess version 18.10.3snapshot
> - R version 3.6.1 (2019-07-05) -- "Action of the Toes"
> - local system: Ubuntu 20.04.1 LTS
> - remote system: Scientific Linux release 7.9 (Nitrogen)
>
> long answer (sorry):
> I do not believe this is a problem with ess. It is a long standing
> issue for me that has persisted across multiple versions of emacs, ess,
> R and (local) Ubuntu.  It does not occur when I have run R via tramp on
> other remote systems. I believe it is a problem particular to this
> remote system, and am seeking a workaround.
>
> Chris
>
> On Fri, 2020-12-18 at 22:42 +0100, Jeremie Juste wrote:
>> Hello,
>> 
>> I'm running R over tramp without any issues you described.
>> Could you please specify versions of the ESS package you are using?
>> 
>> 
>> Please, keep it straight to the point and keep in mind that someone
>> is
>> reading your mail trying to help.
>> 
>> Best regards,
>> Jeremie
>> 
>> - ess-version: 18.10.3snapshot [elpa: 20200825.829] 
>> - R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"  
>> - GNU/Linux Debian 10
>> 
>> 
>> On Friday, 18 Dec 2020 at 10:48, Chris Wallace via ESS-help wrote:
>> > Dear ESS-help,
>> > 
>> > it is frankly still magic to me that I can run R over tramp, and
>> > this
>> > is my main mode of working.  When starting a new R session, I open
>> > a .R
>> > file on the remote machine via tramp, and then M-x R. About 20% of
>> > the
>> > time this just works, and I have all the nice ESS help etc.  The
>> > result
>> > of the time, either the R prompt hangs, and I have to C-c C-c out
>> > of
>> > the hang, or the code that is being silently sourced appears at the
>> > prompt (I have pasted an example of this below). After this the
>> > session
>> > still works, but I might not have completion, and help doesn't
>> > work.
>> >  Eg writing ?ls at the prompt gives an error "Error in
>> > .ess.command(.ess.help("ls")) : object 'withVisib' not found".
>> > 
>> > The remote server does have relatively slow IO, and I suspect this
>> > may
>> > be the cause of the issue.
>> > 
>> > My question (finally) is: how can I find out the code that is being
>> > sourced and sent to the remote process, and can I source this code
>> > manually myself to "fix" these cases when it has failed itself?
>> > 
>> > Thanks for a wonderful package,
>> > 
>> > Chris
>> > 
>> > R version 3.6.1 (2019-07-05) -- "Action of the Toes"
>> > Copyright (C) 2019 The R Foundation for Statistical Computing
>> > Platform: x86_64-pc-linux-gnu (64-bit)
>> > 
>> > R is free software and comes with ABSOLUTELY NO WARRANTY.
>> > You are welcome to redistribute it under certain conditions.
>> > Type 'license()' or 'licence()' for distribution details.
>> > 
>> >   Natural language support but running in an English locale
>> > 
>> > R is a collaborative project with many contributors.
>> > Type 'contributors()' for more information and
>> > 'citation()' on how to cite R or R packages in publications.
>> > 
>> > Type 'demo()' for some demos, 'help()' for on-line help, or
>> > 'help.start()' for an HTML browser interface to help.
>> > Type 'q()' to quit R.
>> > 
>> > > Error: unexpected '}' in "}"
>> > > Error: unexpected '}' in "}"
>> > > > . + > Error: unexpected 'else' in:
>> > "
>> > else"
>> > > Error: object 'name' not found
>> > > Error: unexpected '}' in "}"
>> > > Error: object '.ess.' not found
>> > > + + > Error: unexpected symbol in:
>> > "nsenv <- asNamespace(n
>> > stopifnot"
>> > > + > Error in identical(nsenv, .BaseNamespaceEnv) : object 'nsenv'
>> > > not
>> > found
>> > > Error: object 'spr' not found
>> > > > + > Error: unexpected symbol in:
>> > "if (enviro
>> > return"
>> > > Error: unexpected '}' in "}"
>> > > > Error in essenv[[".__ESSENV__."]] <- TRUE : object 'essenv' not
>> > found
>> > > Error: object 'at' not found
>> > > > . + > Error: unexpected symbol in:
>> > "
>> > on.exit"
>> > > + + > Error: unexpected '}' in:
>> > "lockBinding(ns
>> > }"
>> > > > Error: object 'essenv' not found
>> > > Error: unexpected '}' in "}"
>> > > > . + > Error: unexpected symbol in:
>> > ".ess_devtools_functions <- function() {
>> >   if (!requireNamespace("devtools"
>> > > Error in .ess_mpi_send("error", msg) : 
>> >   could not find function ".ess_mpi_send"
>> > > Error: internal error
>> > > Error: unexpected '}' in "  }"
>> > > > > > > . + > > Error in .ess_keep(funs_exported, is.function) : 
>> >   could not find function ".ess_keep"
>> > > Error 

Re: [ESS] Running R over tramp

2020-12-18 Thread Jeremie Juste via ESS-help
Hello,

I'm running R over tramp without any issues you described.
Could you please specify versions of the ESS package you are using?


Please, keep it straight to the point and keep in mind that someone is
reading your mail trying to help.

Best regards,
Jeremie

- ess-version: 18.10.3snapshot [elpa: 20200825.829] 
- R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"  
- GNU/Linux Debian 10


On Friday, 18 Dec 2020 at 10:48, Chris Wallace via ESS-help wrote:
> Dear ESS-help,
>
> it is frankly still magic to me that I can run R over tramp, and this
> is my main mode of working.  When starting a new R session, I open a .R
> file on the remote machine via tramp, and then M-x R. About 20% of the
> time this just works, and I have all the nice ESS help etc.  The result
> of the time, either the R prompt hangs, and I have to C-c C-c out of
> the hang, or the code that is being silently sourced appears at the
> prompt (I have pasted an example of this below). After this the session
> still works, but I might not have completion, and help doesn't work.
>  Eg writing ?ls at the prompt gives an error "Error in
> .ess.command(.ess.help("ls")) : object 'withVisib' not found".
>
> The remote server does have relatively slow IO, and I suspect this may
> be the cause of the issue.
>
> My question (finally) is: how can I find out the code that is being
> sourced and sent to the remote process, and can I source this code
> manually myself to "fix" these cases when it has failed itself?
>
> Thanks for a wonderful package,
>
> Chris
>
> R version 3.6.1 (2019-07-05) -- "Action of the Toes"
> Copyright (C) 2019 The R Foundation for Statistical Computing
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>   Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
>> Error: unexpected '}' in "}"
>> Error: unexpected '}' in "}"
>> > . + > Error: unexpected 'else' in:
> "
> else"
>> Error: object 'name' not found
>> Error: unexpected '}' in "}"
>> > 
>> Error: object '.ess.' not found
>> + + > Error: unexpected symbol in:
> "nsenv <- asNamespace(n
> stopifnot"
>> + > Error in identical(nsenv, .BaseNamespaceEnv) : object 'nsenv' not
> found
>> Error: object 'spr' not found
>> > + > Error: unexpected symbol in:
> "if (enviro
> return"
>> Error: unexpected '}' in "}"
>> > Error in essenv[[".__ESSENV__."]] <- TRUE : object 'essenv' not
> found
>> Error: object 'at' not found
>> > . + > Error: unexpected symbol in:
> "
> on.exit"
>> + + > Error: unexpected '}' in:
> "lockBinding(ns
> }"
>> > Error: object 'essenv' not found
>> Error: unexpected '}' in "}"
>> > . + > Error: unexpected symbol in:
> ".ess_devtools_functions <- function() {
>   if (!requireNamespace("devtools"
>> Error in .ess_mpi_send("error", msg) : 
>   could not find function ".ess_mpi_send"
>> Error: internal error
>> Error: unexpected '}' in "  }"
>> > > > > . + > > Error in .ess_keep(funs_exported, is.function) : 
>   could not find function ".ess_keep"
>> Error in .ess_keep(funs_pkg, is_first_arg, "pkg") : 
>   could not find function ".ess_keep"
>> Error in sort(names(funs_pkg)) : object 'funs_pkg' not found
>> > Error: object 'funs_names' not found
>> Error: unexpected '}' in "}"
>> Error: unexpected '}' in "}"
>> Error in .ess.command(options(STERM = "iESS", str.dendrogram.last =
> "'",  : 
>   object 'withVisib' not found
>> > 
>>
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>

-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] how to change default emacs behavior, upon running R code, from 2 side-by-by side frames to top-and-bottom frames?

2020-11-09 Thread Jeremie Juste via ESS-help
Hello,

> When I execute a line of R code, the R buffer opens up as expected, but
> it opens in a frame adjacent to the frame containing my source buffer. I
> would like it to open the R buffer as a frame below my source code,
> rather than adjacent to it.Â

This section of the documentation might address your issue. You can
execute the command below for quick access.

(info "(ess) Controlling buffer display")

HTH,
Jeremie

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Start R process from project root

2020-10-16 Thread Jeremie Juste via ESS-help
Hello Pavel,

A simple way to achieve that would be to use bookmarks or file
registers.

(info "(emacs) Registers")

For instance you can set a file register like the following in your 
init.el|.emacs
(set-register ?r '(file . "favourite-project/"))

Notice that the file register works fine for directories as well. 

then you can call jump-to-register. I use it all the time so I rebinded
it to C-M-z
(global-set-key (kbd "C-M-z") 'jump-to-register)

Then with the command C-M-z r you are in your favourite-project from
which you can start R.

One more thing, you might also want to do
(setq ess-ask-for-ess-directory nil) 

so that R does ask you where you want to start R. :-)

HTH,
Jeremie

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Best Practice for building R packages

2020-10-08 Thread Jeremie Juste via ESS-help
Hello,

On Thursday,  8 Oct 2020 at 09:05, Dirk Eddelbuettel via ESS-help wrote:
>
> Emacs is natural follow-up to this but there is _so much_ I wanted to cover
> there that I am effectively overwhelmed and hence inactive.  So let's turn
> this upsite down and maybe _just_ focus on ESS. Shall we?  We could / should
> just start with a wiki and hash out, say, half a dozen high-level topics and
> then take turns.  Deal?

This sounds interesting. I'm in.

-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Best Practice for building R packages

2020-10-08 Thread Jeremie Juste via ESS-help
Hello Kasper,

Thanks for sharing.

> Personally, I'm a dinosaur so I'm still editing Rd files myself. I must
> say, I'm not convinced about the merits of roxygen2.
I admire your discipline. For my part, I feel that I would not document my
functions properly unless I constrain myself to do it on the fly. For
that I have created a [1] snippet (from [2] yassnippet package). I admit
that here is still room for improvement.

[2] https://github.com/joaotavora/yasnippet

[1] -- function -- 
# -*- mode: snippet -*-
# name: function
# key: fn
# --

##' .. content for \description{$3} (no empty lines) ..
##'
##' .. content for \details{} ..
##' @title $1 
##' @param $2
##' @return 
##' @author Jeremie Juste
$1 <- function($2){
$0
}

So typing fn[tab] would expand the snippet and force me to write some
documentation.

I used to naively include the documentation in the function itself in
comments but that is not the R way of sharing code.

build..table <- function(obj){
### DD
## obj of class lm
### purpose
## extract coef name, coef, std and pval from estimation of lm

res <- data.table(summary(obj)$coefficients[,c(1,2,4)],keep.rownames=TRUE)
setnames(res,c("name","coef","std","pval"))
res
}


Best regards,
-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Best Practice for building R packages

2020-10-08 Thread Jeremie Juste via ESS-help
Hello Dirk,

On Thursday,  8 Oct 2020 at 06:57, Dirk Eddelbuettel wrote:

> We all may be a little different here.
>
> ESS now wraps around devtools, but my practices predate devtools.  So I still
> build, test, install, ... on the command-line for which I use wrappers (from
> my littler package, just updated yesterday) named
>   build.r
>   check.r
>   rcc.r  # a nicer checker around rmdcheck
>   roxy.r # run roxygen, I use a 'cached' 6.1.1 version that does not 
> force recompile...
>   install.r  # plus various install* variants for BioC, or GitHub, or 
> binaries...
>   kitten.r   # using a wrapper around package.skeleton()
>   render.r   # run rmarkdown::render()
>   ...
Many thanks for sharing this. It is an option that suites me perfectly.

> It may actually make sense for _all of use_ to maybe pool for two or three
> hours and a webinar over Zoom for 'favourite ESS' tricks.  I keep forgetting
> how there is -- just yesterday I once again forgot C-c C-e w and looked for
> the cheat sheet pdf and there are a bootload of options I never used
> ...
I do agree with your suggestion. There is much more to ESS than I
know and it would be great if we could pool our resources to improve
further. For my part `ess-describe-object-at-point` really improved by
workflow as it can be customized to include any function.

Best regards,
-- 
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


[ESS] Best Practice for building R packages

2020-10-08 Thread Jeremie Juste via ESS-help


Hello,

Is anyone using ESS to build R packages? Could you share your workflow please?

I read the doc of ESS about using roxygen to document the functions.
By the way it looks like the link to [1] roxygen is broken and that
roxygen2 has taken its place.


I initially thought that I could use the workflow of the [2] Roxygen
manual. 

[1]:  
[2]: https://web.archive.org/web/20170324200536/http://roxygen.org/roxygen.pdf

For convenience I reproduce it here
hello-roxygen.R-
#' A package to check Roxygen's sanity
#' @name helloRoxygen-package
#' @docType package
NA

---console
$ package.skeleton('helloRoxygen',
code_files="hello-roxygen.R",force=TRUE)

$ roxygen2::roxygenize("helloRoxygen")

But I get the following warning message :
Warning: The existing 'helloRoxygen-package.Rd' file was not generated by 
roxygen2, and will not be overwritten.

And the file helloRoxygen-package.Rd is not updated.

I'll appreciate any lead on this.

Best Regards,
--
Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] How to tame a jumpy iESS buffer?

2020-09-17 Thread Jeremie Juste via ESS-help
Hello Shreyas,

Thanks for your input.
On my side, ess-switch-to-end-of-proc-buffer is set to t by default.
So I am not sure it is the issue. Feel free to chip in if you think I'm
wrong.

Best regards,
Jermeie

Shreyas Ragavan via ESS-help  writes:

> I was wondering if this could be related to the 
> ess-switch-to-end-of-proc-buffer setting.
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] How to tame a jumpy iESS buffer?

2020-09-16 Thread Jeremie Juste via ESS-help


Hello John,

I apologize for the delayed response.

I still cannot reproduce your issue after
> (setq eldoc-echo-area-use-multiline-p t)

I get the multi-line in eldoc but no jumps in the commit buffer.
To test on your side I would suggest.

- $ emacs -Q

- then load ess-site. If you installed it with melpa then
 - (package-initialize)
 - (require 'ess-site)
 (setq eldoc-echo-area-use-multiline-p t)


HTH,
Jeremie

- ess-version: 18.10.3snapshot [elpa: 20200825.829] (loaded from
/home/djj/.emacs.d/elpa/ess-20200825.829/)
- GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5,
cairo version 1.16.0) of 2020-09-01




John Haman  writes:

> Thanks. I bisected my .emacs and found that that jumpiness is being
> caused by my preferred eldoc setup. I use
>
>   (setq eldoc-echo-area-use-multiline-p t)
>
> which let's eldoc use more than one mini-buffer line. When the
> minibuffer expands to 2+ lines, the comint buffer jumps.
>
> Maybe you can try enabling this and see if it causes comint jumpiness.
>
> FWIW I'm using Emacs 26.3, and the latest ESS on Melpa.
>
> Thanks.
>
> -John
>
> On 9/12/20 4:13 PM, Jeremie Juste wrote:
>> Hello John,
>>
>> Unfortunately, I cannot reproduce your error. We can try to figure out
>> how is Ess working with emacs -Q though.
>>
>> - $ emacs -Q
>>
>> - then load ess-site. If you installed it with melpa then
>> - (package-initialize)
>> - (ess-site)
>>
>> - Do you have the same issue when using IESS?
>>
>> Could you please specify the version of emacs and ess you are using? In
>> case someone else comes across this problem.
>>
>> HTH,
>>
>> Jeremie
>>
>>
>>
>>

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] How to tame a jumpy iESS buffer?

2020-09-12 Thread Jeremie Juste via ESS-help


Hello John,

Unfortunately, I cannot reproduce your error. We can try to figure out
how is Ess working with emacs -Q though.

- $ emacs -Q

- then load ess-site. If you installed it with melpa then
   - (package-initialize)
   - (ess-site)

- Do you have the same issue when using IESS?

Could you please specify the version of emacs and ess you are using? In
case someone else comes across this problem.

HTH,

Jeremie

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] how to deal with underscore in ggplot2 etc

2020-09-04 Thread Jeremie Juste via ESS-help


Hello,

> My biggest concern is using ggplot2
> where all the geom functions have an underscore: geom_smooth etc?the
> package is authored by the people behind Rstudio who do not care about
> ESS users

If you tweak ggplots for hours every key stroke saved counts.

Here is my work flow. First I remove this smart underscore entirely as
it is not so smart.

(setq ess-smart-S-assign-key nil)

Then I created a dumb one

(defun dumb-assign ()
  (interactive)
  (insert " <- "))

Then to avoid putting too much strain on my muscle memory I use the key-chord
package on melpa. You can find more information [1] here. So my pressing
-= together very quickly, I have the assign key and the fingers go at
the same place. 

(key-chord-define ess-r-mode-map "-=" 'dumb-assign)

I have been struggling with the naming convention with R for a long
time. At some point I considered leaning towards a more lispy way

`test-fun` <- function(s) print(s) but it would not have been very
popular. I now think [2] Camelcase is the way to go.

[1]: http://irreal.org/blog/?p=344
[2] https://jef.works/R-style-guide/

Hope this helps,

Jeremie Juste

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] [External] Re: Function to copy command to script?

2020-05-19 Thread Jeremie Juste via ESS-help
Hello,

 > Is there a function to copy an inferior-buffer R command back to the R
 > script and insert it at point?
For a while I have considered doing just that but I ended exploring other
options.

* First option
Have you considered using directly a script buffer for prototyping?
This might be a shorter path to what you want to achieve.

Imagine a buffer test.R with your prototype and `ess-eval-buffer` bound
to a single key. You could then save the result of test.R somewhere
whenever you want.

* Second option
Use the same working buffer but narrow to region then `ess-eval-region` bound to
a quick key.

So you can use some tools like key-chords [0] to quickly narrow and
widen, and ess-eval region.

Another secret weapon of ESS that really changed my work flow is
`ess-describe-object-at-point`. This is absolutely great for prototyping
as it is non-invasive, you can customize it at will and it does not
clutter the buffer.


HTH,
Jeremie

[0] https://www.emacswiki.org/emacs/KeyChord

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Feature idea: insert expression before <- at point

2019-05-01 Thread Jeremie Juste via ESS-help


Hello

I can buy you this feature for a one liner
data[ data[,"columnB"] > 123 ,"columnA"] <- gsub("xxx", "yyy",_POINT_
,fixed=TRUE)

To do this you can use the function  r/copy-left-of-assign-r-fun-end
but you will have to load the function r/get-begin-of-line-point as
well (see below)

I have also included r/eval-no-assign-r-fun-end which evaluate an
expression at the right of the assign operator. It is quit handy


(defun r/get-begin-of-line-point ()
  (interactive)
  (save-excursion
(beginning-of-line)
 (point)))


(defun r/eval-no-assign-r-fun-end ()
  "eval expression right of <-"
  (interactive)
  (setq begin (point))  
  (save-excursion 
(re-search-backward "<- " (r/get-begin-of-line-point))
(forward-char 3)
(setq end (point)))
  (ess-eval-region begin end 4)
  )

(defun r/copy-left-of-assign-r-fun-end ()
  "kill-ring-save expression  left of <- and yank it at point"
  (interactive)
  (save-excursion 
(re-search-backward "<- " (r/get-begin-of-line-point))
(setq begin (point))
(kill-ring-save begin (r/get-begin-of-line-point))
)
  (yank)
)

I would advise using data.table though, which is less verbose and
quicker most of the time

library(data.table)
setDT(data)
data[columnB > 123, columnA:= gsub("xxx", "yyy", _POINT_, fixed=TRUE)]

Hope this helps,

Jeremie




Sven Hartenstein via ESS-help  writes:

> Dear ESS users and developers,
>
> when writing R code to manipulate an object or data frame column, I
> often find myself retyping the expression on the left side of "<-" as
> some argument for a function call or assignment on the right side of
> "<-".
>
> Here are two examples. Imagine your point is at _POINT_ and you want to
> insert 'data[,"columnA"]' in the first example and in the second example
> 'data[ data[,"columnB"] < 123 ,"columnA"]' at point.
>
> data[,"columnA"] <- tolower(_POINT_)
>
> data[ data[,"columnB"] > 123 ,"columnA"] <- gsub("xxx",
>  "yyy",
>  _POINT_,
>  fixed=TRUE)
>
> Wouldn't it be handy to have a lisp function which copies the expression
> on the left side of "<-" and inserts it at point?
>
> Or is something like this already available in ESS?
>
> Or is my coding process unusual and you are not in the situation to use
> such a function?
>
> What do you think?
>
> (I am not very familiar with lisp and thus do not try to write such a
> function. I might use a macro.)
>
> Thanks,
>
> Sven
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Error starting R

2018-10-03 Thread Jeremie Juste via ESS-help


Hello,

Can you specify the ess version you are using?

I would suggest disabling global-font-lock-mode (M-x
global-font-lock-mode) before launching R to see if it works.
It is not a fix but just a way to investingate where the problem might
be.


Best regards,

Jeremie




Neil Shephard via ESS-help  writes:

> Hi,
>
> I've recently encountered a problem which prevents me from using M-x R to
> start an R session under Emacs.  On doing so I'm informed that...
>
> autoload-do-load: Wrong type argument: consp, nil
>
> I'm using Emacs 25.3.1 with ESS installed from ELPA (20181003.755).  I've
> asked on the Emacs Stackexchange (
> https://emacs.stackexchange.com/q/45010/10100) and was advised to disable
> in turn different settings that are loaded.  I've gone through this for all
> ESS settings (see below) but the problem persists, I then tried disabling
> loading the other modes I have under Emacs but again the problem persisted.
>
> Any ideas or suggestions on how to resolve this would be very much
> appreciated.
>
> Thanks in advance.
>
> Neil
>
> The traceback on this error is...
>
> Debugger entered--Lisp error: (wrong-type-argument consp nil)
>   byte-code("\301\30\"\303\241\210\301\30\"\305\241\210\306\307\300\"\207"
> [ess-r-customize-alist assoc ess-font-lock-keywords (quote
> ess-R-font-lock-keywords) inferior-ess-font-lock-keywords (quote
> inferior-ess-r-font-lock-keywords) defalias R-customize-alist] 3)
>   autoload-do-load((autoload "ess-r-mode" "Call 'R', the 'GNU S' system
> from the R Foundation.\nOptional prefix (\\[universal-argument]) allows to
> set command line arguments, such as\n--vsize.  This should be OS
> agnostic.\nIf you have certain command line arguments that should always be
> passed\nto R, put them in the variable `inferior-R-args'.\n\nSTART-ARGS can
> be a string representing an argument, a list of\nsuch strings, or any other
> non-nil value.  In the latter case, you\nwill be prompted to enter
> arguments interactively.\n\n(fn  START-ARGS)" t nil) R)
>   command-execute(R record)
>   execute-extended-command(nil "R" "R")
>   funcall-interactively(execute-extended-command nil "R" "R")
>   call-interactively(execute-extended-command nil nil)
>   command-execute(execute-extended-command)
>
> ...and my ESS settings are...
>
> ;;; ESS
> (require 'ess)
> ;;; Some generally useful key-bindings (mostly ESS specific)
> (define-key global-map [f1] 'Control-X-prefix)
> (define-key global-map [f2] 'save-buffer)
> (define-key global-map [f3] 'find-file)
> (define-key global-map [f5] 'switch-to-buffer)
> (define-key global-map [f6] 'other-window)
> (define-key global-map [f8] 'kill-buffer)
> (define-key global-map [f9] 'ess-load-file)
> ;;; Other specific ESS settings you can use are the following:
> (setq comint-input-ring-size 1000)
> (setq ess-indent-level 4)
> (setq ess-arg-function-offset 4)
> (setq ess-else-offset 4)
> (setq ess-eval-visibly-p nil)
> ;;; Set the width of the buffer automatically
> (defun my-ess-post-run-hook ()
>   (ess-execute-screen-options)
>   (local-set-key "\C-cw" 'ess-execute-screen-options))
> (add-hook 'ess-post-run-hook 'my-ess-post-run-hook)
> ;;; Auto-complete and ESS
> (require 'auto-complete)
> (require 'auto-complete-config)
> (add-to-list 'ac-dictionary-directories
> "~/.emacs.d/site-lisp/auto-complete/dict")
> (ac-config-default)
> (auto-complete-mode)
> (setq ess-use-auto-complete t)
> ;;; Smart underscore  https://www.emacswiki.org/emacs/ess-smart-underscore.el
> (require 'ess-smart-underscore)
>
> --
> *Natural selection is a mechanism for generating an exceedingly high **degree
> of improbability.* - R.A. Fisher
>
> *Ignorance more frequently begets confidence than does knowledge* - Charles
> Darwin
>
> PGP Public : https://pgp.mit.edu/pks/lookup?op=get=0x0E7ECE9C10D7B4A0
>
>   [[alternative HTML version deleted]]
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Error starting R

2018-10-03 Thread Jeremie Juste via ESS-help
Hello,

Glad you could sort it out.
I think version controling the .emacs file and the .emacs.d directory
could help solve these issues faster. You could easily go back to a
previous working version. This might be helpful if you are in a
situation where you really need things to work.

I'm currently exploring this idea but I don't know the full pros and
cons of this method.



Best regards,
Jeremie



> Timely
>
> On Wed, 3 Oct 2018 at 20:16, Alex Branham  wrote:
>
>>
>> > I've tried disabling ess-smart-underscore as Alex suggests but no joy.
>>
>> I'm not familiar with how this package works but disabling it (by
>> removing the "require" from your init file) might not be enough. Emacs's
>> package manager autoloads some functionality if the package is simply
>> installed on your system. It doesn't do this if you do "emacs -Q", which
>> might explain why you don't see this error then.
>>
>> Timely as I've just been playing around and you are absolutely right,
> simply commenting out ess-smart-underscore from the settings wasn't
> sufficient.  I decided to try manually delete it and ess from
> ~/.emacs.d/elpa/ess* completely and lo-and-behold  I can now start R under
> Emacs/ESS with M-x R again.
>
> However, this is from the system-wide install of Emacs (currently ess-17.11
> under Gentoo).
>
> I did try installing just ess-20181003.1614 after seeing it had been
> updated today but that didn't work either.
>
> For me personally thats not a problem as I'm happy with not having the
> latest ESS, and I won't miss the functionality of ess-smart-underscore.
>
> As an aside it doesn't look like ess-smart-underscore is that old, current
> version on MELPA is from last month 20180911.523, some of the other ess
> packages are very old (ess-smart-equals was last updated 2015;
> ess-R-data-view 2013).
>
> If there is anything I can do to help fathom out what is going on let me
> know. I've included the debug from installing ess-20181003.1614 below for
> reference.  This happens after installing from MELPA under the same Emacs
> instance, no restarting.  If I delete ~/.emacs.d/elpa/ess-20181003.1614 and
> restart Emacs M-x R works fine (as its using ess-17.11 from the main
> system).
>
> Thanks to yourself and Jeremie for your help and to all
> developers/maintainers.
>
> Neil
>
> Debugger entered--Lisp error: (wrong-type-argument consp nil)
>   byte-code("\301\302 \"\303\241\210\301\304
> \"\305\241\210\306\307\300\"\207" [ess-r-customize-alist assoc
> ess-font-lock-keywords (quote ess-R-font-lock-keywords)
> inferior-ess-font-lock-keywords (quote inferior-ess-r-font-lock-keywords)
> defalias R-customize-alist] 3)
>   autoload-do-load((autoload "ess-r-mode" "Call 'R', the 'GNU S' system
> from the R Foundation.\nOptional prefix (\\[universal-argument]) allows to
> set command line arguments, such as\n--vsize.  This should be OS
> agnostic.\nIf you have certain command line arguments that should always be
> passed\nto R, put them in the variable `inferior-R-args'.\n\nSTART-ARGS can
> be a string representing an argument, a list of\nsuch strings, or any other
> non-nil value.  In the latter case, you\nwill be prompted to enter
> arguments interactively.\n\n(fn  START-ARGS)" t nil) R)
>   command-execute(R record)
>   execute-extended-command(nil "R" "R")
>   funcall-interactively(execute-extended-command nil "R" "R")
>   call-interactively(execute-extended-command nil nil)
>   command-execute(execute-extended-command)
> --
> *Natural selection is a mechanism for generating an exceedingly high **degree
> of improbability.* - R.A. Fisher
>
> *Ignorance more frequently begets confidence than does knowledge* - Charles
> Darwin
>
> PGP Public : https://pgp.mit.edu/pks/lookup?op=get=0x0E7ECE9C10D7B4A0
>
> Website - http://kimura.no-ip.info/
> Photos - http://www.flickr.com/photos/slackline/
>
>   [[alternative HTML version deleted]]
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Error starting R

2018-10-03 Thread Jeremie Juste via ESS-help


Hello,

Be sure to CC ess-help@r-project.org in your reply as your mail can help
others as well. You might find better support in this way too.

I updated by ess to your version : ess-version: 18.10 and could load
R without difficulty.

I'm using GNU Emacs 25.3.3 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2018-08-22 though. So updating emacs might help but it might be
costly depending on your operating system.

Another way around your problem could be trying to switch back to
previous versions of ESS.

If you use melpa and you didn't delete the previous versions of ess, deleting 
the most
recent ones in your directory and reloading emacs should do the job.


Another quick way to see if the problem comes from your .init file is to
start emacs without loading it.

> emacs -Q (from the terminal)

then in the scratch execute 

(add-to-list 'load-path "path to ess site.el ")
;; mine 
(add-to-list 'load-path "/home/djj/.emacs.d/elpa/ess-20181003.755/")
(require 'ess-site)

I got some errors from julia mode but R works fine.

Hope it helps

Jeremie





Neil Shephard  writes:

> Hi,
>
> Thanks for taking the time to reply.
>
> On Wed, 3 Oct 2018 at 12:26, Jeremie Juste  wrote:
>
>>
>> Can you specify the ess version you are using?
>>
>
> Yep its...
>
>> I'm using Emacs 25.3.1 with ESS installed from ELPA (20181003.755).
>
> I started seeing the error last week when I updated packages from MELPA and
> before posting to ESS-ehlp updated ESS today to check the error still
> persisted which it does.  Looks like it was built against Git commit d94388.
>
>>
>> I would suggest disabling global-font-lock-mode (M-x
>> global-font-lock-mode) before launching R to see if it works.
>> It is not a fix but just a way to investingate where the problem might
>> be.
>>
>
> Gave this a try and neither *Messages* nor the *Backtrace* give any more
> information...
>
> *Messages*
> Global Font-Lock mode disabled
> autoload-do-load: Wrong type argument: consp, nil
> Debug on Error enabled globally
> Entering debugger...
>
> *Backtrace*
> Debugger entered--Lisp error: (wrong-type-argument consp nil)
>
> byte-code("\301\30\"\303\241\210\301\30\"\305\241\210\306\307\300\"\207"
> [ess-r-customize-alist assoc ess-font-lock-keywords (quote
> ess-R-font-lock-keywords) inferior-ess-font-lock-keywords (quote
> inferior-ess-r-font-lock-keywords) defalias R-customize-alist] 3)
>   autoload-do-load((autoload "ess-r-mode" "Call 'R', the 'GNU S' system
> from the R Foundation.\nOptional prefix (\\[universal-argument]) allows to
> set command line arguments, such as\n--vsize.  This should be OS
> agnostic.\nIf you have certain command line arguments that should always be
> passed\nto R, put them in the variable `inferior-R-args'.\n\nSTART-ARGS can
> be a string representing an argument, a list of\nsuch strings, or any other
> non-nil value.  In the latter case, you\nwill be prompted to enter
> arguments interactively.\n\n(fn  START-ARGS)" t nil) R)
>   command-execute(R record)
>   execute-extended-command(nil "R" "R")
>   funcall-interactively(execute-extended-command nil "R" "R")
>   call-interactively(execute-extended-command nil nil)
>   command-execute(execute-extended-command)
>
> I read through the comments in issue 596 and followed the suggestion of
> deleting the MELPA installed ESS and disabling loading of any ESS then
> reinstalling (see comment at
> https://github.com/emacs-ess/ESS/issues/596#issuecomment-402053269) but
> that didn't work either.
>
> If there is anything else I can try or any more information please let me
> know.
>
> Thanks for your time,
>
> Neil
>
> --
> *Natural selection is a mechanism for generating an exceedingly high **degree
> of improbability.* - R.A. Fisher
>
> *Ignorance more frequently begets confidence than does knowledge* - Charles
> Darwin
>
> PGP Public : https://pgp.mit.edu/pks/lookup?op=get=0x0E7ECE9C10D7B4A0

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Stopping "Save workspace image?" prompt

2018-09-22 Thread Jeremie Juste via ESS-help


Hello,

Have a look at the variable inferior-R-args. (C-h v
inferior-R-args). You can customize it to include --no-save.
in principle putting (setq inferior-R-args "--no-save") in your .emacs
file should do it.

Best regards,

Jeremie

> Hi everyone,
>
> Does know of a way to stop the "Save workspace image?" prompt when quitting
> the iESS [R] process? I have already aliased the R command to 'R --no-save'
> in bash, but this setting doesn't carry over to ESS.
>
> Thanks,
>
> Ryan
>
>   [[alternative HTML version deleted]]
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help