# [ESS] [R] .Rd vs. .R, was: matrix multiplication

Kasper Daniel Hansen kasperdanielhansen at gmail.com
Thu Dec 6 22:15:09 CET 2012

Marc is right, I am specifically looking for

not
(which would be dir username in my home dir).

This is really useful to refer to other peoples home directories.
Really nice and useful if you work with other people on the same
system.  Especially since at my institution, our home dirs are not
just /home/khansen or /Users/khansen, but rather something like
/home/DEPARTMENT/STATUS/khansen
with STATUS being student/faculty/etc  And since I would with people
with different statuses in different departments, fully expanding
their homedir path is ... irritating.  And several people I share
scripts with don't user ESS, so they freely user the ~username syntax.

I can confidently say that my entire set of colleagues here at Hopkins
would be delighted if this gets "fixed" (or at least the subset who
run R inside emacs).

Kasper

On Thu, Dec 6, 2012 at 3:57 PM, Marc Schwartz <marc_schwartz at me.com> wrote:
> On Dec 6, 2012, at 2:40 PM, Vitalie Spinu <spinuvit at gmail.com> wrote:
>
>>>> Kasper Daniel Hansen <kasperdanielhansen at gmail.com>
>>>> on Thu, 6 Dec 2012 15:09:51 -0500 wrote:
>>
>>> This is semi-tangential.  One thing I really miss from readline is the
>>> ability to designate paths like
>>
>>
>> You mean load("~/khansen/data.rda")? Never heard of ~foo to be
>> substituted, with readline or otherwise. R substitutes ~/foo and ../foo
>> correctly in emacs session.
>
>
> Just to confirm Vitalie, it is ~username/PATH.TO.FILE/FILENAME. That is a standard part of the bash shell with readline support:
>
>  http://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html
>
>
> On OSX, for example:
>
>> capabilities("cledit")
> cledit
>   TRUE
>
>> path.expand("~/.RData")
> [1] "/Users/marcschwartz/.RData"
>
>> path.expand("~marcschwartz/.RData")
> [1] "/Users/marcschwartz/.RData"
>
>
> However, in ESS:
>
>> capabilities("cledit")
> cledit
>  FALSE
>
>> path.expand("~/.RData")
> [1] "/Users/marcschwartz/.RData"
>
>> path.expand("~marcschwartz/.RData")
> [1] "~marcschwartz/.RData"
>
>
> Note that the second incantation is not properly expanded and this is due to the lack of readline support when R is run under ESS by default.
>
> This is explicitly mentioned in ?path.expand:
>
> On \emph{some} Unix builds of R, a leading ~user will expand to the home directory of user, but not on Unix versions without readline installed, nor if R is invoked with --no-readline.
>
> In an interactive session capabilities("cledit") will report if readline is available.
>
>
> Regards,
>
> Marc Schwartz
>
>
>> As to readline, I am not aware of a single feature that would be missing
>> in emacs comint buffers. Limitations you might see are those imposed by
>> the dumbness of emacs terminal. Particularly interactive features (like
>> less filter) don't work.
>>
>>    Vitalie
>>
>>> ie. use the ~khansen to mean home dir of user khansen.  I want to use
>>> this all the time, since I sit on a multiuser system and frequently
>>> load stuff from other peoples homedir.
>>
>>> My understanding is that readline is what makes this work in normal
>>> command line R, and this is why it doesn't work inside of Emacs.
>>
>>> Is there a way to address this particular issue?
>>
>>> Kasper
>>
>>> On Thu, Dec 6, 2012 at 2:53 PM, Vitalie Spinu <spinuvit at gmail.com> wrote:
>>>>>> Christian Hoffmann <c-w.hoffmann at sunrise.ch>
>>>>>> on Thu, 06 Dec 2012 14:29:02 +0100 wrote:
>>>>
>>>> [...]
>>>>
>>>>
>>>>> (3) I found out that M-x R  starts R --no-readline , which I want to avoid!  I
>>>>> want to browse the history in a (mini?) buffer to search and select before
>>>>> execution, using C-up-arrow is cumbersome. I am lazy !
>>>>
>>>> This is comint-previous-input and is also bound to M-p by default, could
>>>> not be faster than that. Comint-previous-matching-input-from-input is
>>>> much more useful IMO, so I would recommend this in your .emacs:
>>>>
>>>> (define-key comint-mode-map [(meta ?p)] 'comint-previous-matching-input-from-input)
>>>> (define-key comint-mode-map [(meta ?n)] 'comint-next-matching-input-from-input)
>>>>
>>>> These commands are bound to C-c M-r and C-c M-s by default.
>>>>
>>>> Vitalie
>