[ESS] Using anything.el for R help / object browsing

Rainer M Krug r.m.krug at gmail.com
Wed Dec 17 15:13:34 CET 2008


I now have a problem with the Imenu-s menu: it does not show in
"anything" - everything else works nicely.

attached my .emacs file

Thanks

Rainer

On Wed, Dec 17, 2008 at 3:13 PM, Rainer M Krug <r.m.krug at gmail.com> wrote:
> On Mon, Dec 15, 2008 at 2:06 PM, Short, Tom <TShort at epri.com> wrote:
>> I'm not sure how to debug that one. The left and right arrow keys should
>> switch between anything sources (they don't work in the minibuffer). For
>> the configuration below, the right arrow should jump from buffers to
>> recent files to R local objects (if R is attached to the current buffer)
>> and so on. If you've already typed something in the minibuffer, it won't
>> show anything sources where there are no results, so if it's narrowed it
>> down to just one answer, then the left and right arrows won't do
>> anything.
>
> It is working fine now - it was a problem with recentf.
> And I must say it is a very nice addition to ESS.
>
> Rainer
>
>>
>> - Tom
>>
>> -----Original Message-----
>> From: Rainer M Krug [mailto:r.m.krug at gmail.com]
>> Sent: Monday, December 15, 2008 1:28 AM
>> To: Short, Tom
>> Cc: ess-help at stat.math.ethz.ch
>> Subject: Re: [ESS] Using anything.el for R help / object browsing
>>
>> On Mon, Dec 15, 2008 at 8:09 AM, Rainer M Krug <r.m.krug at gmail.com>
>> wrote:
>>> Thanks a lot - it works brilliantly.
>>>
>>> I'll be back, if I have any problems.
>>
>> And here I am again....
>>
>> When I start emacs, f11 displays a temporary buffer with anything in
>> it, showing the buffers, and the mii-buffer showing "pattern:". I
>> really like it. But when I try to use the left and right arrow keys,
>> nothing happens (arrows up and down selects another buffer, and tab
>> shows the different options).
>> I have used the three files as supplied and appended the
>> R-anything-config.el to my .emacs file.
>>
>> Rainer
>>
>>
>>>
>>> Rainer
>>>
>>>
>>> On Mon, Dec 15, 2008 at 4:32 AM, Short, Tom <TShort at epri.com> wrote:
>>>>> Rainer M Krug <r.m.krug <at> gmail.com> writes:
>>>>>
>>>>> On Mon, Dec 8, 2008 at 5:06 AM, Short, Tom <TShort at epri.com> wrote:
>>>>> > I added another anything source for local R objects at:
>>>>> >
>>>>> > http://www.emacswiki.org/emacs/AnythingSources#toc38
>>>>> >
>>>>> > In the anything list, it shows a list of the R objects in your
>>>> workspace
>>>>> > along with a few details (using ls.str). The default action is
>> str,
>>>> with
>>>>> > summary, head, tail, print, and dput also available.
>>>>> >
>>>>> > I thought about trying to add details to the larger list that
>> looks
>>>>> > through the whole searchpath. It might be some work as it would
>>>> require
>>>>> > caching for performance.
>>>>>
>>>>> That sounds all really fascinating and I would love to try it, but
>>>>> emacs is still (after more then two years) still a mystery,
>> especially
>>>>> how to deal with installing these add-ons.
>>>>>
>>>>> Therefore my question: would it be possible to draw up an easy to
>>>>> follow HowTo which describes the process on hot to install
>> "anything"
>>>>> and how to activate it?
>>>>
>>>> I'll take a crack at it. For some general tips on installing
>>>> and configuring add-ons to emacs, see:
>>>>
>>>> http://www.lns.cornell.edu/~bxin/computer/emacs/emacs24/emacs206.htm
>>>>
>>>> (1) Download
>>>>
>>>> Download anything.el and anything-sources.el from here:
>>>>
>>>> http://www.emacswiki.org/emacs/download/anything.el
>>>> http://www.emacswiki.org/emacs/download/anything-config.el
>>>>
>>>> Put these somewhere where emacs can find them. I use
>>>> c:/e/home/site-lisp on winXP.
>>>>
>>>> anything.el is the base system, and anything-config.el is a
>>>> fairly wide-ranging setup for anything.
>>>>
>>>> (2) Emacs path
>>>>
>>>> In your .emacs file, make sure the emacs load-path points to the
>>>> directory where you put anything.el and anything-sources.el. In
>>>> my .emacs, I have the following:
>>>>
>>>> (add-to-list 'load-path "c:/e/home/site-lisp")
>>>>
>>>> This adds my directory to emacs' load-path.
>>>>
>>>> (3) Anything configuration
>>>>
>>>> I'm including a configuration section in my .emacs file that adds
>>>> anything to emacs and configures it. I'll describe some of the
>>>> contents with comments (things after semicolons). Anything
>>>> uses "anything-sources" to build the list that it searches
>>>> from. You can have several. In the configuration included, I've
>>>> added two for R objects, and the rest are built into
>>>> anything-config. "setq" does variable assignment in lisp. You can
>>>> do a lot of emacs customizing just with that. Here's the partial
>>>> listing with comments:
>>>>
>>>> ;; Load anything and anything-config
>>>> (require 'anything)
>>>> (require 'anything-config)
>>>>
>>>> ;; My hotkey for anything
>>>> (global-set-key [f11] 'anything)
>>>> ;; This gets around a bug in part of anything:
>>>> (remove-hook 'kill-emacs-hook 'anything-c-adaptive-save-history)
>>>>
>>>> ;; The anything-source for all R objects in the searchpath
>>>> (setq anything-c-source-R-help
>>>>  '((name . "R objects / help")
>>>> ;; more code here...
>>>>
>>>> ;; The anything-source for local objects
>>>> (setq anything-c-source-R-local
>>>>  '((name . "R local objects")
>>>> ;; more code here...
>>>> ;; You can add or change actions by modifying the configuration.
>>>> ;; The R commands run can be tailored to what you want.
>>>> ;; Just edit or add items as follows. This is for the "str"
>>>> ;; function. The "str(" part is where you enter the command.
>>>> ;; The "R str: " part is the name of the buffer where results go.
>>>>     ("str" . (lambda(obj-name)
>>>>                (ess-execute (concat "str(" obj-name ")\n") nil
>>>>                             (concat "R str: " obj-name))))
>>>>
>>>> ;; This is the part of the configuration that tells anything what
>>>> ;; you want to include in the list of things to search for. I've
>>>> ;; highlighted a few with comments. Note that some things need
>>>> ;; external tools (like locate) or emacs packages loaded (like
>>>> ;; recentf). You can rearrange them for a different order. Comment
>>>> ;; some out if you don't want them or something isn't working.
>>>>
>>>> (setq
>>>>  anything-sources
>>>>  (list
>>>>  anything-c-source-buffers ; buffers
>>>>  anything-c-source-recentf ; recent files: needs (require 'recentf)
>>>>  anything-c-source-R-local
>>>>  anything-c-source-R-help
>>>>  anything-c-source-imenu   ; e.g. Imenu-S menu
>>>>  anything-c-source-files-in-current-dir
>>>>  anything-c-source-occur
>>>>  anything-c-source-locate  ; needs the utility locate
>>>>  ))
>>>>
>>>>
>>>> - Tom
>>>>
>>>
>>>
>>>
>>> --
>>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>>> Biology, UCT), Dipl. Phys. (Germany)
>>>
>>> Centre of Excellence for Invasion Biology
>>> Faculty of Science
>>> Natural Sciences Building
>>> Private Bag X1
>>> University of Stellenbosch
>>> Matieland 7602
>>> South Africa
>>>
>>
>>
>>
>> --
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>> Biology, UCT), Dipl. Phys. (Germany)
>>
>> Centre of Excellence for Invasion Biology
>> Faculty of Science
>> Natural Sciences Building
>> Private Bag X1
>> University of Stellenbosch
>> Matieland 7602
>> South Africa
>>
>
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Faculty of Science
> Natural Sciences Building
> Private Bag X1
> University of Stellenbosch
> Matieland 7602
> South Africa
>



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa


More information about the ESS-help mailing list