Function: ielm-return

ielm-return is an interactive and byte-compiled function defined in ielm.el.gz.

Signature

(ielm-return &optional FOR-EFFECT)

Documentation

Newline and indent, or evaluate the sexp before the prompt.

Complete sexps are evaluated; for incomplete sexps inserts a newline and indents. If however ielm-dynamic-return is nil, this always simply inserts a newline.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/ielm.el.gz
;;; Other bindings

(defun ielm-return (&optional for-effect)
  "Newline and indent, or evaluate the sexp before the prompt.
Complete sexps are evaluated; for incomplete sexps inserts a newline
and indents.  If however `ielm-dynamic-return' is nil, this always
simply inserts a newline."
  (interactive)
  (if ielm-dynamic-return
      (let ((state
             (save-excursion
               (end-of-line)
               (parse-partial-sexp (ielm-pm)
                                   (point)))))
        (if (and (< (car state) 1) (not (nth 3 state)))
            (ielm-send-input for-effect)
          (when (and ielm-dynamic-multiline-inputs
                     (save-excursion
                       (beginning-of-line)
                       (looking-at-p comint-prompt-regexp)))
            (save-excursion
              (goto-char (ielm-pm))
              (newline 1)))
          (newline-and-indent)))
    (newline)))