[ESS] Skeleton pair insert not working after upgrade.

Marc Schwartz marc_schwartz at me.com
Sat Aug 29 01:30:10 CEST 2009

On Aug 28, 2009, at 2:06 PM, Vinh Nguyen wrote:

> On Fri, Aug 28, 2009 at 7:00 AM, Marc Schwartz<marc_schwartz at me.com>  
> wrote:
>> 1. Why does Vinh not have this same problem on OSX with emacs 23?  
>> What is
>> different on his system?
> I apologize, i just ran emacs with the -q option and ran the require
> ess-site and the skeleton stuff to investigate, and I DID REPLICATE
> the mentioned issue.  of the following list,
> (defvar skeletons-alist
>  '((?\( . ?\))
>    (?\' . ?\')
>    (?\" . ?\")
>    (?[  . ?])
>    (?{  . ?})
>    (?<  . ?>)
>    (?$  . ?$)))
> "(" and "{" does not work for me.
> the reason my parentheses worked before was i had the following in my
> .emacs as well:
> (defun my-ess-comma-hook ()
> (local-set-key "," (lambda () (interactive) (insert ", "))))
> (add-hook 'ess-mode-hook 'my-ess-comma-hook)
> (add-hook 'inferior-ess-mode-hook 'my-ess-comma-hook)
> (defun my-ess-parens-hook ()
>   (local-set-key "(" (lambda () (interactive)
>                    (insert "(  )")
>                    (forward-char -2))))
> (add-hook 'ess-mode-hook 'my-ess-parens-hook)
> (add-hook 'inferior-ess-mode-hook 'my-ess-parens-hook)
> i apologize for the confusion.
> vinh

Not a problem Vinh, thanks for the clarification.

I am still stumped by the change in the original behavior and am not  
clear on the best approach for fixing this at the emacs lisp level.  
Perhaps members of ESS Core will have some more refined thoughts here.

BTW, just as an aside, I tried this whole thing using Emacs within a  
terminal on OSX, which brings up the CLI (non-GUI) version of Emacs,  
which is GNU Emacs 22.1.1. I can replicate the problematic behavior  
there as well, so this is not limited to GUI versions, whether 22 or 23.

That being said and because I am leaving for vacation on Sunday for  
the week during which I will have limited e-mail access, I have been  
trying a work around for this and seem to have a possibility. I have  
not yet fully tested it and there may be other untoward effects of  
this particular approach.

Rather than using skeleton mode, I located the AutoPairs page at the  
Emacs Wiki:


and decide to give the textmate.el approach a try since it claims some  
additional functionality.  textmate.el is available from:


Once can download and un-tar the gz file there to someplace convenient  
on your system.

Once you have done that, add the following to your .emacs file, which  
will load textmate-mode at Emacs startup, rather than having to use 'M- 
x textmate-mode' every time:

;; Modify the path to textmate.el as appropriate!!!
(load "/Users/marcschwartz/Downloads/Emacs/textmate/textmate")

(mapc (lambda (mode)
	(let ((hook (intern (concat (symbol-name mode)
	  (add-hook hook (lambda () (textmate-mode +1)))))
       '(c cperl emacs-lisp inferior-lisp ess inferior-ess lisp noweb  
perl Rd text tex))

The final line above determines which Emacs modes this will work in  
automatically, so for other modes not indicated, add them as you  
require. I located the above code in the textmate issues area: http://code.google.com/p/emacs-textmate/issues/detail?id=5

Be sure to remove or comment the original skeleton mode related code  
in your .emacs.

Once you have that in place, this all should work, but again, I have  
not fully tested it for either functionality or conflicts with other  
ESS functions.


Marc Schwartz

More information about the ESS-help mailing list