[ESS] Defining custom functions and menus
Sebastian Luque
sluque at mun.ca
Fri Oct 22 00:26:44 CEST 2004
Dear List,
I'm trying to recreate some of the functionality of Dr. John Fox's init.el
file (http://socserv.mcmaster.ca/jfox/Books/Companion/ESS/) in Emacs (GNU
Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2004-08-03
on raven, modified by Debian). I only need some of the functions and have
them available in a similar menu. I'm not an elisp expert, so some help would
be very much appreciated.
I began by stripping down Dr. Fox's init.el file to the function definitions
and the menu creation commands which I'm interested in. As an example, below
is a first attempt at adapting Dr. Fox's definition of a function to load a
package:
(defun menu-load-package (pkg)
"Load package from a library."
(interactive "sName of library: ")
(ess-switch-to-end-of-ESS)
(ess-eval-linewise
(concat "library(" pkg ")"))
(comint-show-maximum-output)
(other-window 1))
Originally, I wanted to have this function (and others with a similar goal)
offer completion, but don't know how to do that yet.
My next step is to adapt the inclusion of these functions in a submenu and
perhaps bind them to some key sequence. In the original code for XEmacs this
was done as:
(defun R-menu ()
"Hook to install R menu and sub-menus"
(add-menu-item '("ESS" "R" "Packages") "Load package ..."
'menu-load-package))
But this seems to require quite different syntax in Emacs, which I'm not yet
able to put to use here.
Help? Thanks in advance.
--
Best,
Sebastian
More information about the ESS-help
mailing list