summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp-mode.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1997-02-23 07:52:35 +0000
committerKarl Heuer <kwzh@gnu.org>1997-02-23 07:52:35 +0000
commit361721f24006c113205ab4052b9e0ce8a7713943 (patch)
treeacb50e1845308b793acef6e9225bd0f1332f9e8c /lisp/emacs-lisp/lisp-mode.el
parenta21b845bc9976f4cb2e25a4d5db6339e3099b0ec (diff)
downloademacs-361721f24006c113205ab4052b9e0ce8a7713943.tar.gz
emacs-361721f24006c113205ab4052b9e0ce8a7713943.tar.bz2
emacs-361721f24006c113205ab4052b9e0ce8a7713943.zip
(eval-last-sexp): Allow let-bindings to terminate
before doing the eval. Handle (interactive ...) form specially.
Diffstat (limited to 'lisp/emacs-lisp/lisp-mode.el')
-rw-r--r--lisp/emacs-lisp/lisp-mode.el24
1 files changed, 19 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 26eab753c38..89bac6d80f9 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -293,16 +293,30 @@ if that value is non-nil."
"Evaluate sexp before point; print value in minibuffer.
With argument, print output into current buffer."
(interactive "P")
- (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))
- (opoint (point)))
- (prin1 (let ((stab (syntax-table)))
- (eval (unwind-protect
+ (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t)))
+ (prin1 (eval (let ((stab (syntax-table))
+ (opoint (point))
+ expr)
+ (unwind-protect
(save-excursion
(set-syntax-table emacs-lisp-mode-syntax-table)
(forward-sexp -1)
(save-restriction
(narrow-to-region (point-min) opoint)
- (read (current-buffer))))
+ (setq expr (read (current-buffer)))
+ ;; If it's an (interactive ...) form, it's more
+ ;; useful to show how an interactive call would
+ ;; use it.
+ (and (consp expr)
+ (eq (car expr) 'interactive)
+ (setq expr
+ (list 'call-interactively
+ (list 'quote
+ (list 'lambda
+ '(&rest args)
+ expr
+ 'args)))))
+ expr))
(set-syntax-table stab)))))))
(defun eval-defun (eval-defun-arg-internal)