SLIME, Lisp, Editing - the lost slime-close-parens-at-point

Once upon a time there was a rich SLIME version that had all bateries included in a few files. Now this old, old version is long gone. The Powers Of SLIME deleted the function

slime-close-parens-at-point

whose use and benefit is described in this blog post of Bill Clementson. For those requiring this exact feature here's the original code of that function:

(setq slime-close-parens-limit 16)

(defun slime-close-parens-at-point ()
"Close parenthesis at point to complete the top-level-form. Simply
inserts ')' characters at point until `beginning-of-defun' and
`end-of-defun' execute without errors, or `slime-close-parens-limit'
is exceeded."
(interactive)
(loop for i from 1 to slime-close-parens-limit
until (save-excursion
(slime-beginning-of-defun)
(ignore-errors (slime-end-of-defun) t))
do (insert ")")))

In addition to putting this in my .emacs file I have also the following line in it:

(define-key slime-mode-map (kbd ")") 'slime-close-parens-at-point)

With these pieces in place editing in SLIME is fun again ;-) And no, I did not achieve the same functionality with just using paredit and redshank.

Cheers,
Frank

Kommentare

michaelw hat gesagt…
Frank, did you try slime-close-all-parens-in-sexp from the slime-editing-commands.el contrib?
frgo hat gesagt…
Michael,

yes, I did. It does not do the same thing - at least for me. Or does it for you?

Cheers
Frank
michaelw hat gesagt…
Not the same, but perhaps good enough? :)

Beliebte Posts aus diesem Blog

ADT-200A - updating firmware - the bare metal way

CW Skimmer support for the ADT-200A