[ESS] Function template

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Wed Jan 23 01:51:18 CET 2013



hi Marc,

>> > ess-function-template is a variable defined in `ess-custom.el'.
>> > Its value is " <- function( )
>> > {
>> > }"
>> > Original value was
>> > " <- function( )\n{\n\n}\n"

I'm a bit confused as to why it gives 'original value was' in the help
buffer.  Have you changed the value of this variable anywhere?  

However, like Vitalie, I don't use this function, and I think there is a
problem; when I do C-c C-e C-d somenewname RET I get an empty buffer.  A
quick scan showed that ess-dump-object is making the new buffer
contents, ess-function-template is not invoked.  The critical logic of
using ess-function-template is within the defun
ess-find-dump-file-other-window where we have:

  (if ess-function-template
      (progn
        (goto-char (point-max))
        (if (re-search-backward ess-dumped-missing-re nil t)
            (progn


That re-search-backward seems to be nil for me.

Martin: is this anything to do with old S (not R) behaviour?  We are
clearly at odds with the documentation:

----------------------------------------------------------------------
8.1 Creating or modifying S objects
===================================

To edit an S object, type

   * `C-c C-d' (`ess-dump-object-into-edit-buffer')
     Edit an S object in its own edit buffer.

   from within the ESS process buffer (`*S*').  You will then be
prompted for an object to edit: you may either type in the name of an
existing object (for which completion is available using the `TAB' key), or
you may enter the name of a new object.  A buffer will be created
containing the text representation of the requested object or, if you
entered the name of a non-existent object at the prompt and the
variable `ess-function-template' is non-`nil', you will be presented
with a template defined by that variable, which defaults to a skeleton
function construct.
----------------------------------------------------------------------

BTW, if we update this code, the (if cond (progn ...) can be simplified
to (when cond ...)  Also the doc refers to C-c C-d (at least twice I
think) as the keybinding, which is now out of date.  I can update the
code, with my suggestion being that if the buffer is empty, we just
insert the template and move point accordingly... 


Stephen




>> >
>> > Documentation:
>> > If non-nil, function template used when editing nonexistent objects.
>> >
>> > The edit buffer will contain the object name in quotes, followed by
>> > this string. Point will be placed after the first parenthesis or
>> > bracket.
>> >
>> > You can customize this variable.
>> >
>> -----------------------------------------------------------------------------
>> >
>> > Do I need to add something to my .emacs to make this work? Thanks in
>> > advance.
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > ESS-help at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/ess-help
>>
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list