Re: [ESS] working directory lost when R session closes

2017-07-17 Thread Mathieu Basille
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
> <maech...@stat.math.ethz.ch> 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] Ever consider changing indentation on #?

2017-05-07 Thread Mathieu Basille
+1 for the current ESS style, I'm with Vincent on this.

Since Stephen also mentioned 'formatR', let's say here that formatR aligns
any comment line starting with any number of #s (1, 2, 3, more…) to the
current indentation level, and does not affect in-line comments.

For once, Hadley Wickham does not seem to have a very developed opinion on
comment indentation:

http://adv-r.had.co.nz/Style.html (at the very bottom)

Mathieu.


On 05/06/2017 10:30 AM, Vincent Goulet wrote:
>> Le 4 mai 2017 à 22:49, Paul Johnson <pauljoh...@gmail.com> a écrit :
>>
>> Please raise your hand if you have EVER used # to document R code in
>> the way mentioned on the LISP coding standards page.
> 
> I do, all the time ever since I (more or less by accident) discovered the 
> functionality. Actually, all the code I distribute to my students is 
> commented this way; see e.g.
> 
>   
> https://github.com/vigou3/introduction-programmation-r/blob/master/bases.R
> 
> It should be noted that this commenting style also works in LaTeX mode 
> (granted, a single % somewhere on the right being less useful with text). For 
> me, it just makes more sense that the higher the number of comment markers, 
> the stronger the emphasis (or vice versa).
> 
> Call me an old timer ;-), but I would vote against a change to the *default* 
> behaviour. I see this commenting style as pure Emacsism and would expect any 
> programming mode (Markdown excepted for obvious reasons) to respect it by 
> default. Furthermore, I think ESS does not have to play catch up or to adapt 
> to RStudio.
> 
> Now, that said, I'm all in favour to have an easy to toggle ESS option to 
> change Emacs/lisp commenting style to Markdown style (since that's what we're 
> talking about) if someone wants to provide the patch.
> 
> v.
> 
>> pj
>>
>> On Thu, May 4, 2017 at 10:52 AM, Brahm, David
>> <david.br...@geodecapital.com> wrote:
>>> Since we're on the topic, is there a style to make the # comments 
>>> right-justified against
>>> "fill-column" (which is 97 for me, as that makes printouts look good) 
>>> and/or the window
>>> width?  So as you type the comment, it marches leftward.  E.g.:
>>>
>>> x <- y + z   # This 
>>> comment ends on column 97
>>> 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
>>>
>>> -- David Brahm (br...@alum.mit.edu)
>>>
>>>
>>> -Original Message-
>>> From: ESS-help [mailto:ess-help-boun...@r-project.org] On Behalf Of Charles 
>>> C. Berry
>>> Sent: Thursday, May 04, 2017 11:38 AM
>>> To: Ista Zahn
>>> Cc: Stephen Eglen; ess-help
>>> Subject: Re: [ESS] Ever consider changing indentation on #?
>>>
>>> On Thu, 4 May 2017, Ista Zahn wrote:
>>>
>>>
>>> And there are a bunch of styles from which to choose a personal default.
>>> See below.
>>>
>>>
>>> There are `off-the-shelf' styles like `Rstudio' that might satisfy Paul's
>>> student.
>>>
>>> Setting `ess-default-style' to `Rstudio' gives these settings:
>>>
>>>  (RStudio
>>>   (ess-indent-offset . 2)
>>>   (ess-offset-arguments . open-delim)
>>>   (ess-offset-arguments-newline . prev-line)
>>>   (ess-offset-block . prev-line)
>>>   (ess-offset-continued . straight)
>>>   (ess-align-nested-calls)
>>>   (ess-align-arguments-in-calls "function[ ]*(")
>>>   (ess-align-continuations-in-calls)
>>>   (ess-align-blocks)
>>>   (ess-indent-from-lhs arguments)
>>>   (ess-indent-from-chain-start . t)
>>>   (ess-indent-with-fancy-comments))
>>>
>>>
>>> Or one can customize the `OWN' style and select it. See the
>>> `ess-style-alist' docstring for more details.
>>>
>>> HTH,
>>>
>>> Chuck
>>>
>>> __
>>> 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
>>
>>
>>
>> -- 
>> 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] Auto-completion with Company

2017-01-15 Thread Mathieu Basille
Hi,

After some time using auto-complete in Emacs, I'm now trying to modernize
my configuration and switch to Company. I understand that Company is fully
integrated to ESS now, and works out of the box, however, I get a weird
error message when I try to "use" it.

Here are the steps that I followed:

* Install Emacs 25.1, ESS 16.10 and Company (elpa-company) 0.8.12 from
Debian repository (I am running Testing/Stretch).

* Prepare a minimal .emacs.d/init.el with only this:

(add-hook 'after-init-hook 'global-company-mode)

(require 'ess-site)

* Open any file with Emacs: auto-completion works as expected, for instance
if I type the same word twice, auto-completion kicks in for the second type.

* Open a .R script in Emacs, open R (M-x R), and try auto-completion on a
function (for instance, typing "hi" to get hist/history/... Auto-completion
does not work, and I get a message in the echo area instead:

Company: An error occurred in auto-begin
Company: Back-end (company-R-args company-R-objects :separate) error
"Symbol’s function definition is void: :separate" with args (ignore-case)

I couldn't find much help in the doc, or other on-line resources.

Any help would be greatly appreciated! Thanks in advance,
Mathieu Basille.


-- 

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