[slime-devel] auto insertion of closing pair for ( and " - possible new feature

Surendra Singhi efuzzyone at netscape.net
Thu Mar 10 02:35:56 UTC 2005


Hello,
  I have written code for inserting closing pairs for ( and ". Something 
similar can be added to slime if it is not already there in the cvs version.

One drawback of this code is that unlike in eclipse if the user also 
types a closing pair, the auto-inserted closing pair is not removed.
And i am not able to figure out how to stop skeleton-insert from pushing 
everything at the end of current point of insertion by one line.

(defun self-insert-pair()
   "Insert characters (,\" and their closing pair, and then put the 
cursor in the middle position."
   (interactive)
   (setq skeleton-pair t)
   (let ((char last-command-char))
     (case char
       (?\( (skeleton-insert '(nil "(" > _  ")")))
       (?\" (skeleton-pair-insert-maybe nil)))))

(local-set-key [\(] 'self-insert-pair)
(local-set-key [\"] 'self-insert-pair)


-- 
Surendra Singhi
www.public.asu.edu/~sksinghi/

"O thou my friend! The prosperity of Crime is like unto the lightning, 
whose traitorous brilliancies embellish the atmosphere but for an 
instant, in order to hurl into death's very depths the luckless one they 
have dazzled." -- Marquis de Sade




More information about the slime-devel mailing list