insert defun for symbol; slime
A small extension of mine for slime. When you’re standing on a symbol, you can request emacs (with `C-c a f’ here) to place a new defun for the symbol right before the actual top level form at point.
(require 'slime)
(defun dot-emacs-my-add-def (what)
(let ((s (slime-symbol-name-at-point)))
(if s
(progn
(set-mark (point))
(beginning-of-defun)
(insert-string (concat "(" what " " s " ()\n\n"))
(backward-char 3)))))
(defun dot-emacs-my-add-defun ()
(interactive)
(dot-emacs-my-add-def "defun"))
(slime-define-key "af" 'dot-emacs-my-add-defun :prefixed t)
Moreover, when finished, by pressing `C-u C-Space’, one can return back to the point from where the command was called.