[ESS] problems with curly braces {}

martin lysy martin.lysy at gmail.com
Sat Sep 11 17:33:26 CEST 2010


I get the same problem using ESS-5.11, but not using ESS-5.4.  It turns out that
the definitions of ess-electric-brace in the ess-mode.el files of these two
versions are slightly different: version 5.11 has an extra bit about
"skeleton-pair takes precedence".  I don't know what that is, but removing this
clause seems to fix the problem.  I copied the following definition of
ess-electric-brace from the ESS-5.4 ess-mode.el file into my init.el file and
the problem went away.

Martin

I get the same problem using ESS-5.11, but not using ESS-5.4.  It turns out that
the definitions of ess-electric-brace in the ess-mode.el files of these two
versions are slightly different: version 5.11 has an extra bit "skeleton-pair
takes precedence".  I don't know what that is, but removing this clause seems to
fix the problem.  I copied the following definition of ess-electric-brace from
the ESS-5.4 ess-mode.el file into my init.el file and the problem went away.

Martin

(defun ess-electric-brace (arg)
  "Insert character and correct line's indentation."
  (interactive "P")
  (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-char)
	  (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)))))



More information about the ESS-help mailing list