Paste number 27885: tato: copy-defun-to-repl (quick hack; seems to work)

Paste number 27885: tato: copy-defun-to-repl (quick hack; seems to work)
Pasted by: antifuchs
When:2 years, 8 months ago
Share:Tweet this! | http://paste.lisp.org/+LIL
Channel:#lisp
Paste contents:
Raw Source | XML | Display As
(defun asf-slime-copy-defun-to-repl ()
  ;; ripped off from slime.el
  (interactive)
  (let ((defun (slime-defun-at-point)))
    (unless (eql major-mode 'slime-repl-mode)
      (slime-switch-to-output-buffer))
    (flet ((do-insertion ()
             (when (not (string-match "\\s-"
                                      (buffer-substring (1- (point)) (point))))
               (insert " "))
             (insert defun)
             (when (and (not (eolp)) (not (looking-at "\\s-")))
               (insert " "))))
      (if (>= (point) slime-repl-prompt-start-mark)
          (do-insertion)
          (save-excursion
            (goto-char (point-max))
            (do-insertion))))))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.