Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 22246:afacb0a7e251
(eval-defun): Pass proper beg to eval-region.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 25 May 1998 22:40:45 +0000 |
parents | 366a1d025c6c |
children | fd555029931d |
comparison
equal
deleted
inserted
replaced
22245:94da16d936b6 | 22246:afacb0a7e251 |
---|---|
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 (interactive "P") | 343 (interactive "P") |
344 (let ((standard-output (if eval-defun-arg-internal (current-buffer) t)) | 344 (let ((standard-output (if eval-defun-arg-internal (current-buffer) t)) |
345 end form) | 345 beg end form) |
346 ;; Read the form from the buffer, and record where it ends. | 346 ;; Read the form from the buffer, and record where it ends. |
347 (save-excursion | 347 (save-excursion |
348 (end-of-defun) | 348 (end-of-defun) |
349 (beginning-of-defun) | 349 (beginning-of-defun) |
350 (setq beg (point)) | |
350 (setq form (read (current-buffer))) | 351 (setq form (read (current-buffer))) |
351 (setq end (point))) | 352 (setq end (point))) |
352 ;; Alter the form if necessary. | 353 ;; Alter the form if necessary. |
353 (cond ((and (eq (car form) 'defvar) | 354 (cond ((and (eq (car form) 'defvar) |
354 (cdr-safe (cdr-safe form))) | 355 (cdr-safe (cdr-safe form))) |
365 #'(lambda (ignore) | 366 #'(lambda (ignore) |
366 ;; Skipping to the end of the specified region | 367 ;; Skipping to the end of the specified region |
367 ;; will make eval-region return. | 368 ;; will make eval-region return. |
368 (goto-char end) | 369 (goto-char end) |
369 form))) | 370 form))) |
370 (eval-region (point) end standard-output))))) | 371 (eval-region beg end standard-output))))) |
371 | 372 |
372 (defun lisp-comment-indent () | 373 (defun lisp-comment-indent () |
373 (if (looking-at "\\s<\\s<\\s<") | 374 (if (looking-at "\\s<\\s<\\s<") |
374 (current-column) | 375 (current-column) |
375 (if (looking-at "\\s<\\s<") | 376 (if (looking-at "\\s<\\s<") |