[ESS] Feature Idea: open help in browser when viewing it in an emacs buffer

Vitalie Spinu spinuvit.list at gmail.com
Mon Oct 31 16:01:01 CET 2011


Hi,

This should do the trick

(defun ess-display-help-in-browser ()
  (interactive)
  (if (not (equal ess-dialect "R"))
      (message "Sorry, not available for the dialect %s " ess-dialect )
    (let ((object (buffer-name)))
      (string-match ".*(\\(.*\\))[^)]*\\'" object)
      (setq object (match-string 1 object))
      (if (not object)
          (message "Cannot infer the help object from buffer name")
        (ess-command (format "help('%s', help_type='html')\n" object))
        (message "Help for '%s' opened in the web-browser" object))
    )))


(define-key ess-help-mode-map "w" 'ess-display-help-in-browser)

The only thing that I am missing in ess R-help is the ability to open
the index of a package directly from ess-help buffer. I will find a
way to do it and post to the thread latter.

Have anyone already given a thought of how to implement html help
directly in emacs? And which text browser should it be based - w3,
w3m, lynx, links, Elinks?

Vitalie.

On Mon, Oct 31, 2011 at 2:08 PM, Steve Lianoglou
<mailinglist.honeypot at gmail.com> wrote:
> Hi Matthew,
>
> On Mon, Oct 31, 2011 at 8:36 AM, Matthew Landis <landis at isciences.com> wrote:
>> Steve,
>>
>> My ESS set up already opens help in HTML.  I can't recall the actual process
>> of setting it up, but it might be as simple as including this in your
>> .emacs:
>>
>> (setq ess-help-own-frame 'one)
>> (setq inferior-ess-r-help-command "help(\"%s\", help_type=\"html\")\n")
>>
>> At least, that's what I've got that seems relevant to help.  I can't claim
>> to follow exactly what it's doing though.
>
> I actually had it set to do the same for some time, but I've come to
> realize that it's a bit more handy to view the help in an emacs
> buffer. What I thought might be cool is to be able to have emacs
> launch the help page in your browser from within the help page you are
> already looking at in emacs.
>
> For example, I'd type `?plot` to get help on plot to pop up in my
> emacs buffer. As I'm browsing it, I (for some reason) think "hey, I
> kind of want to see this in my web browser right now" and then press
> `w` (or whatever) as I'm reading the help in emacs to then launch it
> in the web browser.
>
>
>> By the way, can anyone tell me why, whenever I call help at the R prompt
>> (e.g. ?setZ), the help page opens in my browser but also opens a new ESS
>> buffer in a new frame, called, e.g. *help[R](setZ)*.  This is mildly
>> annoying.  I would love to have a way of not having that little frame get in
>> my way each time I call help.
>
> I think this has come up on the mailing list before -- not sure if
> there was an easy fix for it, though.
>
> -steve
>
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  | Memorial Sloan-Kettering Cancer Center
>  | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>



More information about the ESS-help mailing list