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

Rainer M Krug r.m.krug at gmail.com
Mon Dec 15 07:09:07 CET 2008


Thanks a lot - it works brilliantly.

I'll be back, if I have any problems.

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




More information about the ESS-help mailing list