[ESS] help files with R
Martin Maechler
maechler at stat.math.ethz.ch
Tue Aug 2 17:36:48 CEST 2005
>>>>> "StEgl" == Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk>
>>>>> on Tue, 2 Aug 2005 15:52:22 +0100 writes:
StEgl> Sundar Dorai-Raj writes:
>> Hi,
>>
>> This one has got me stumped, but I believe it's an ESS issue. Try the
>> following:
>>
>> 1. Start R
>> M-x R
>> 2. create the following function
>> consolidateHelp <- function(package = NULL) { package }
>> 3. execute the function
>> > consolidateHelp("lm")
>> This opens a new frame with the help file for ?lm.
>> 4. Now change the name to
>> helpConsolidate <- function(package = NULL) { package }
>> 5. execute the function
>> > consolidateHelp("lm")
>> [1] "lm"
>>
>> The consildateHelp function creates the following two lines in the ESS
>> buffer:
>>
>> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil,
>> comint..echoes=nil, comint..sender=comint-simple-send
>> (ess-help-bogus-buffer-p *help[R](lm)*) |--> nil [searching t]
>>
>> Any clues?
>>
>> version info:
>> R-2.1.1pat
>> Windows XP
>> ess 5.2.8
>> Xemacs 21.4 (patch 13)
>>
>> I also tested this on Linux using ess 5.2.4 (haven't upgraded yet) with
>> the same problem. Also, this is not an issue in either rterm or rgui.
>>
>> BTW, for now, I'll just change the name of the function.
StEgl> I think what you are seeing is a side effect of our efforts to catch
StEgl> ?lm
StEgl> so that if a user types that at the command line within an *R* buffer,
StEgl> the help frame is shown.
StEgl> ;;> <PD writes>:
StEgl> ;;> Also, invoking help() from the command line may lead to confusing
StEgl> ;;> output, somewhat worse with R than with S. You're not really supposed
StEgl> ;;> to do that (use C-c C-v to invoke ess-display-help-on-object), but it's
StEgl> ;;> an obvious newcomer's mistake.
StEgl> ;;>
StEgl> ;;> (I wonder: could the elisp-code not quite easily recognize help
StEgl> ;;> calls (at least in the ?xxx form) and do the right thing automagically?)
StEgl> ;;>
StEgl> ;;> As promised, here is a quick hack:
StEgl> ;; ___hack much improved by MM___ , both help(.) and ?... now work
StEgl> ;; FIXME: Note that '??' nicely works in *R*, but
StEgl> ;; 'type ? topic' doesn't use ess-help {but display in *R*}
StEgl> (defconst inferior-R-1-input-help (format "help *(%s)" ess-help-arg-regexp))
StEgl> (defconst inferior-R-2-input-help (format "^ *\\? *%s" ess-help-arg-regexp))
StEgl> (defconst inferior-R-page (format "^ *page *(%s)" ess-help-arg-regexp))
StEgl> So, maybe the first regexp could be tightened to match help only at a
StEgl> start boundary (Martin - is that something like \bhelp ?)
yes, "\\bhelp" or "\\<help" [\b = word boundary;
\< and \> = one-sided word boundary ]
but I think we should use
"^ *help *(%s)"
in the *-R-1-* line above.
Though I'm wondering if there wasn't a good reason why "^ "
wasn't used for "help(.)" when it *was* expressively used for
'?' and 'page()' ...
Martin
More information about the ESS-help
mailing list