comparison lisp/emacs-lisp/lisp-mode.el @ 23388:8aa1f99efb66

(eval-defun): Return the evaluation result.
author Karl Heuer <kwzh@gnu.org>
date Tue, 06 Oct 1998 23:33:04 +0000
parents 06d8312c50a4
children b706421adbd5
comparison
equal deleted inserted replaced
23387:842d6539989b 23388:8aa1f99efb66
337 (set-syntax-table stab))))))) 337 (set-syntax-table stab)))))))
338 338
339 (defun eval-defun (eval-defun-arg-internal) 339 (defun eval-defun (eval-defun-arg-internal)
340 "Evaluate defun that point is in or before. 340 "Evaluate defun that point is in or before.
341 Print value in minibuffer. 341 Print value in minibuffer.
342 With argument, insert value in current buffer after the defun." 342 With argument, insert value in current buffer after the defun.
343 Return the result of evaluation."
343 (interactive "P") 344 (interactive "P")
344 (let ((standard-output (if eval-defun-arg-internal (current-buffer) t)) 345 (let ((standard-output (if eval-defun-arg-internal (current-buffer) t))
345 beg end form) 346 beg end form)
346 ;; Read the form from the buffer, and record where it ends. 347 ;; Read the form from the buffer, and record where it ends.
347 (save-excursion 348 (save-excursion
365 (eval-region beg end standard-output 366 (eval-region beg end standard-output
366 #'(lambda (ignore) 367 #'(lambda (ignore)
367 ;; Skipping to the end of the specified region 368 ;; Skipping to the end of the specified region
368 ;; will make eval-region return. 369 ;; will make eval-region return.
369 (goto-char end) 370 (goto-char end)
370 form))))) 371 form))
372 ;; The result of evaluation has been put onto VALUES.
373 ;; So return it.
374 (car values))))
371 375
372 (defun lisp-comment-indent () 376 (defun lisp-comment-indent ()
373 (if (looking-at "\\s<\\s<\\s<") 377 (if (looking-at "\\s<\\s<\\s<")
374 (current-column) 378 (current-column)
375 (if (looking-at "\\s<\\s<") 379 (if (looking-at "\\s<\\s<")