Function: lisp-do-defun

lisp-do-defun is a byte-compiled function defined in inf-lisp.el.gz.

Signature

(lisp-do-defun DO-STRING DO-REGION)

Documentation

Send the current defun to the inferior Lisp process.

The actually processing is done by DO-STRING and DO-REGION
 which determine whether the code is compiled before evaluation.
DEFVAR forms reset the variables to the init values.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/inf-lisp.el.gz
(defun lisp-do-defun (do-string do-region)
  "Send the current defun to the inferior Lisp process.
The actually processing is done by DO-STRING and DO-REGION
 which determine whether the code is compiled before evaluation.
DEFVAR forms reset the variables to the init values."
  (save-excursion
    ;; Find the end of the defun this way to avoid having the region
    ;; possibly end with a comment (it there's a comment after the
    ;; final parenthesis).
    (beginning-of-defun)
    (forward-sexp)
    (let ((end (point)) (case-fold-search t))
      (beginning-of-defun)
      (if (looking-at "(defvar")
          (funcall do-string
                   ;; replace `defvar' with `defparameter'
                   (concat "(defparameter "
                           (buffer-substring-no-properties (+ (point) 7) end)
                           "\n"))
        (funcall do-region (point) end)))))