Re: [ESS] working directory lost when R session closes
Well your init file seems very slim to me. At this stage, I would not even worry about it… My own init file is getting close to 700 lines, expurgated from all comments! If yours grows significantly, you may want to modularize it, or use use-package, or, as I did, use Org-mode to keep it readable. See my own configuration here: https://github.com/basille/.emacs.d/blob/master/init.org with explanations about it here: https://github.com/basille/.emacs.d Cheers, Mathieu. On 07/17/2017 12:53 PM, Paul Johnson wrote: > On Mon, Jul 17, 2017 at 5:26 AM, Martin Maechler > wrote: >> >> > Do you notice this: >> > cd into a folder, say "~/tmp/project/R" and start emacs with a file in >> > there. The working directory correctly shows "~/tmp/project/R". >> >> > Then launch an R session. When you quit the R session, and start a new >> > R session, the working directory changed, it becomes "~/tmp/project". >> >> > This is just a little inconvenient if you get an R session with some >> > crap in it and you close it down to start fresh, but the WD is no >> > longer correct. Its necessary to close emacs and re-open the file. >> >> > I'll paste in the Emacs session transcript to show what I mean. The >> > only thing I do after the q() is hit the big blue R button: >> >> >> >> getwd() >> > [1] "/home/pauljohn/GIT/rockchalk/package/rockchalk/R" >> >> q() >> > Save workspace image? [y/n/c]: n >> >> > Process R finished at Fri Jul 14 09:30:04 2017 >> >> >> > R version 3.4.1 (2017-06-30) -- "Single Candle" >> > Copyright (C) 2017 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. >> >> >> > if(identical(getOption('pager'), file.path(R.home('bin'), >> 'pager'))) # rather take the ESS one >> > + options(pager='cat') >> >> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', >> show.error.locations=TRUE) >> >> getwd() >> > [1] "/home/pauljohn/GIT/rockchalk/package/rockchalk" >> >> >> >> This is strange. >> >> I tried this, with /tmp/project/R/foo.R >> but when I quit R (using C-c C-q; and having set >> >> (custom-set-variables >> (inferior-R-args "--no-restore-history --no-save ") >> ) >> >> in my ~/.emacs equivalent, so I'm never asked about saving -- >> the only reasonable thing anyway! >> ) >> > Thanks. I think you solved this. I used the menu to insert > customization and the working directory now stays same on Ubuntu Linux > Emacs 24.5.1. > > '(inferior-R-args "--no-restore-history --no-save") > > The problem is solved. > > I also confirmed your (and Vitalie's) other contention. If I move my > init.el file out, then the R wd stays same between R sessions. So that > means I had something that caused the working directory to change to > one directory above. > > My init file is a jumble of settings while I try to use various > versions of org mode, python, stata, sas, and who knows what else, I > wonder how do your init file in order? Look at all this crap in here. > There must be some better way than keeping one gigantic laundry bag > full of settings. > > http://pj.freefaculty.org/software/Emacs/init.el-20170717 > > Some of these settings are truly necessary, but some are corrections > for old versions of Emacs, or Windows users, or bugs in particular > package versions. > > Got advice about how you keep your act together? > > pj > >> and restart it , my working directory *is* the same, >> >>> getwd() >> [1] "/tmp/project/R" >>> >> >> >> Can anyone reproduce Paul's problem? >> >> If not, Paul, you may have set another non-default somewhere. >> >> Best, >> Martin > > > -- Mathieu Basille basi...@ufl.edu | http://ase-research.org/basille +1 954-577-6314 | University of Florida FLREC « Le tout est de tout dire, et je manque de mots Et je manque de temps, et je manque d'audace. » — Paul Éluard This message is signed to guarantee its authenticity. For a true private correspondence, use my public key to encrypt your messages: http://mathieu.basille.net/pub.asc Learn more: http://mzl.la/1BsOGiZ __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [ESS] working directory lost when R session closes
On Mon, Jul 17, 2017 at 5:26 AM, Martin Maechler wrote: >> Paul Johnson >> on Fri, 14 Jul 2017 09:31:31 -0500 writes: > > > Do you notice this: > > cd into a folder, say "~/tmp/project/R" and start emacs with a file in > > there. The working directory correctly shows "~/tmp/project/R". > > > Then launch an R session. When you quit the R session, and start a new > > R session, the working directory changed, it becomes "~/tmp/project". > > > This is just a little inconvenient if you get an R session with some > > crap in it and you close it down to start fresh, but the WD is no > > longer correct. Its necessary to close emacs and re-open the file. > > > I'll paste in the Emacs session transcript to show what I mean. The > > only thing I do after the q() is hit the big blue R button: > > > >> getwd() > > [1] "/home/pauljohn/GIT/rockchalk/package/rockchalk/R" > >> q() > > Save workspace image? [y/n/c]: n > > > Process R finished at Fri Jul 14 09:30:04 2017 > > > > R version 3.4.1 (2017-06-30) -- "Single Candle" > > Copyright (C) 2017 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. > > >> > if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))) > # rather take the ESS one > > + options(pager='cat') > >> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', > show.error.locations=TRUE) > >> getwd() > > [1] "/home/pauljohn/GIT/rockchalk/package/rockchalk" > >> > > This is strange. > > I tried this, with /tmp/project/R/foo.R > but when I quit R (using C-c C-q; and having set > > (custom-set-variables > (inferior-R-args "--no-restore-history --no-save ") > ) > > in my ~/.emacs equivalent, so I'm never asked about saving -- > the only reasonable thing anyway! > ) > Thanks. I think you solved this. I used the menu to insert customization and the working directory now stays same on Ubuntu Linux Emacs 24.5.1. '(inferior-R-args "--no-restore-history --no-save") The problem is solved. I also confirmed your (and Vitalie's) other contention. If I move my init.el file out, then the R wd stays same between R sessions. So that means I had something that caused the working directory to change to one directory above. My init file is a jumble of settings while I try to use various versions of org mode, python, stata, sas, and who knows what else, I wonder how do your init file in order? Look at all this crap in here. There must be some better way than keeping one gigantic laundry bag full of settings. http://pj.freefaculty.org/software/Emacs/init.el-20170717 Some of these settings are truly necessary, but some are corrections for old versions of Emacs, or Windows users, or bugs in particular package versions. Got advice about how you keep your act together? pj > and restart it , my working directory *is* the same, > >> getwd() > [1] "/tmp/project/R" >> > > > Can anyone reproduce Paul's problem? > > If not, Paul, you may have set another non-default somewhere. > > Best, > Martin -- Paul E. Johnson http://pj.freefaculty.org Director, Center for Research Methods and Data Analysis http://crmda.ku.edu To write to me directly, please address me at pauljohn at ku.edu. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [ESS] working directory lost when R session closes
> Paul Johnson > on Fri, 14 Jul 2017 09:31:31 -0500 writes: > Do you notice this: > cd into a folder, say "~/tmp/project/R" and start emacs with a file in > there. The working directory correctly shows "~/tmp/project/R". > Then launch an R session. When you quit the R session, and start a new > R session, the working directory changed, it becomes "~/tmp/project". > This is just a little inconvenient if you get an R session with some > crap in it and you close it down to start fresh, but the WD is no > longer correct. Its necessary to close emacs and re-open the file. > I'll paste in the Emacs session transcript to show what I mean. The > only thing I do after the q() is hit the big blue R button: >> getwd() > [1] "/home/pauljohn/GIT/rockchalk/package/rockchalk/R" >> q() > Save workspace image? [y/n/c]: n > Process R finished at Fri Jul 14 09:30:04 2017 > R version 3.4.1 (2017-06-30) -- "Single Candle" > Copyright (C) 2017 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. >> > if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))) # rather take the ESS one > + options(pager='cat') >> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE) >> getwd() > [1] "/home/pauljohn/GIT/rockchalk/package/rockchalk" >> This is strange. I tried this, with /tmp/project/R/foo.R but when I quit R (using C-c C-q; and having set (custom-set-variables (inferior-R-args "--no-restore-history --no-save ") ) in my ~/.emacs equivalent, so I'm never asked about saving -- the only reasonable thing anyway! ) and restart it , my working directory *is* the same, > getwd() [1] "/tmp/project/R" > Can anyone reproduce Paul's problem? If not, Paul, you may have set another non-default somewhere. Best, Martin __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [ESS] working directory lost when R session closes
>> On Fri, Jul 14 2017 09:31, Paul Johnson wrote: > Then launch an R session. When you quit the R session, and start a new > R session, the working directory changed, it becomes "~/tmp/project". It's not very clear to me what you are describing. R is started in the working directory that you asked it to start in. What do you mean by "working directory changed"? Vitalie __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
[ESS] working directory lost when R session closes
Do you notice this: cd into a folder, say "~/tmp/project/R" and start emacs with a file in there. The working directory correctly shows "~/tmp/project/R". Then launch an R session. When you quit the R session, and start a new R session, the working directory changed, it becomes "~/tmp/project". This is just a little inconvenient if you get an R session with some crap in it and you close it down to start fresh, but the WD is no longer correct. Its necessary to close emacs and re-open the file. I'll paste in the Emacs session transcript to show what I mean. The only thing I do after the q() is hit the big blue R button: > getwd() [1] "/home/pauljohn/GIT/rockchalk/package/rockchalk/R" > q() Save workspace image? [y/n/c]: n Process R finished at Fri Jul 14 09:30:04 2017 R version 3.4.1 (2017-06-30) -- "Single Candle" Copyright (C) 2017 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. > > if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))) # > > rather take the ESS one + options(pager='cat') > options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', > show.error.locations=TRUE) > getwd() [1] "/home/pauljohn/GIT/rockchalk/package/rockchalk" > -- Paul E. Johnson http://pj.freefaculty.org Director, Center for Research Methods and Data Analysis http://crmda.ku.edu To write to me directly, please address me at pauljohn at ku.edu. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help