[ESS] problems with curly braces { }

Joshua Wiley jwiley.psych at gmail.com
Thu May 27 22:50:52 CEST 2010


Hi Rodney,

Thanks for the information and for taking the time to write a work around.

Josh


On Thu, May 27, 2010 at 1:22 PM, Rodney Sparapani <rsparapa at mcw.edu> wrote:
> On 05/27/10 01:52 PM, Rodney Sparapani wrote:
>>
>> Hi Josh:
>>
>> Very weird. I see the same thing. This is coming from ess-electric-brace
>> from ess-mode.el This feature is discussed here
>> http://ess.r-project.org/Manual/ess.html#Indenting
>> But, the documentation gives no inkling of turning this feature off or
>> what to do if it is broken?!?
>>
>
> Here's a workaround; use the definition of ess-electric-brace
> below.  It works, but it eats the next character.  That is
> usually a return and is handled correctly; but, if it's, say a
> semicolon for a comment, then you have to do it twice.
> I don't understand what this function is supposed
> to be doing by looking at it's code and I don't know what
> (interactive "P") is all about either.
>
> (defun ess-electric-brace (arg)
>  "Insert character and correct line's indentation."
>  (interactive "c")
> ;; skeleton-pair takes precedence
> (if (and (boundp 'skeleton-pair) skeleton-pair (featurep 'skeleton))
>  (skeleton-pair-insert-maybe "{")
> ;; else
>  (let (insertpos)
>    (if (and (not arg)
>             (eolp)
>             (or (save-excursion
>                   (skip-chars-backward " \t")
>                   (bolp))
>                 (if ess-auto-newline (progn (ess-indent-line) (newline) t)
> nil)))
>        (progn
>          (insert last-command-event)
>          (ess-indent-line)
>          (if ess-auto-newline
>              (progn
>                (newline)
>                ;; (newline) may have done auto-fill
>                (setq insertpos (- (point) 2))
>                (ess-indent-line)))
>          (save-excursion
>            (if insertpos (goto-char (1+ insertpos)))
>            (delete-char -1))))
>    (if insertpos
>        (save-excursion
>          (goto-char insertpos)
>          (self-insert-command (prefix-numeric-value arg)))
>      (self-insert-command (prefix-numeric-value arg))))))
>
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>



-- 
Joshua Wiley
Senior in Psychology
University of California, Riverside
http://www.joshuawiley.com/



More information about the ESS-help mailing list