[ESS] skeleton-pair and XEmacs (Was: skeleton-pair and {})

Rodney Sparapani rsparapa at mcw.edu
Tue Aug 4 16:15:49 CEST 2009


Gregor Gorjanc wrote:
> Hi!
> 
> I use skeleton-pair (see bellow for lines in my .emacs) and it works OK,
> except for {} pair in mode for editing R files i.e. in ESS[S] mode. Does
> anyone have the same issue?
> 
> ;; enable skeleton-pair insert globally
> (setq skeleton-pair t)
> ; (setq skeleton-pair-on-word t) ; apply skeleton trick even in front of
> a word.
> (global-set-key "("  'skeleton-pair-insert-maybe)
> (global-set-key "["  'skeleton-pair-insert-maybe)
> (global-set-key "{"  'skeleton-pair-insert-maybe)
> (global-set-key "\"" 'skeleton-pair-insert-maybe)
> (global-set-key "'"  'skeleton-pair-insert-maybe)
> 

I finally broke down and tried this tip; only took a little over 2 years 
to get to it.  However, it doesn't work for XEmacs.  On XEmacs, you 
always get repeating rather than pairing.  I tried to debug this for 
about an hour before I gave up and just reported it to the XEmacs bug 
tracker.  But, I realized this can be mimicked quite simply (I'll 
probably add ess-skeleton or some such to ess-emcs.el):

(global-set-key "(" '(lambda ()
(interactive)
(let ((save-point nil))
  (insert "(")
  (setq save-point (point))
  (insert ")")
  (goto-char save-point))))

(global-set-key "[" '(lambda ()
(interactive)
(let ((save-point nil))
  (insert "[")
  (setq save-point (point))
  (insert "]")
  (goto-char save-point))))

(global-set-key "{" '(lambda ()
(interactive)
(let ((save-point nil))
  (insert "{")
  (setq save-point (point))
  (insert "}")
  (goto-char save-point))))

(global-set-key "'" '(lambda ()
(interactive)
(let ((save-point nil))
  (insert "'")
  (setq save-point (point))
  (insert "'")
  (goto-char save-point))))

(global-set-key "\"" '(lambda ()
(interactive)
(let ((save-point nil))
  (insert "\"")
  (setq save-point (point))
  (insert "\"")
  (goto-char save-point))))

Rodney



More information about the ESS-help mailing list