aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog16
-rw-r--r--lisp/ielm.el342
2 files changed, 215 insertions, 143 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a01d1d58765..bfbe5b49eb8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,19 @@
12013-10-18 Daniel Colascione <dancol@dancol.org>
2
3 When evaluating forms in ielm, direct standard output to ielm
4 buffer. Add new ielm-return-for-effect command. Remove trailing
5 whitespace throughout.
6
7 * ielm.el (ielm-map): Bind M-RET to ielm-return-for-effect.
8 (ielm-return-for-effect): New command.
9 (ielm-send-input): Accept optional `for-effect' parameter.
10 (ielm-eval-input): Accept optional `for-effect' parameter. Bind
11 `standard-output' to stream we create using
12 `ielm-standard-output-impl'. Suppress printing result when
13 `for-effect'.
14 (ielm-standard-output-impl): New function.
15 (inferior-emacs-lisp-mode): Explain new features in documentation.
16
12013-10-17 Michael Albinus <michael.albinus@gmx.de> 172013-10-17 Michael Albinus <michael.albinus@gmx.de>
2 18
3 Code cleanup. 19 Code cleanup.
diff --git a/lisp/ielm.el b/lisp/ielm.el
index 4280a49af6e..fb1f9774237 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -1,3 +1,4 @@
1;;; -*- lexical-binding: t -*-
1;;; ielm.el --- interaction mode for Emacs Lisp 2;;; ielm.el --- interaction mode for Emacs Lisp
2 3
3;; Copyright (C) 1994, 2001-2013 Free Software Foundation, Inc. 4;; Copyright (C) 1994, 2001-2013 Free Software Foundation, Inc.
@@ -62,10 +63,10 @@ the remaining prompts will be accidentally messed up. You may
62wish to put something like the following in your init file: 63wish to put something like the following in your init file:
63 64
64\(add-hook 'ielm-mode-hook 65\(add-hook 'ielm-mode-hook
65 (lambda () 66 (lambda ()
66 (define-key ielm-map \"\\C-w\" 'comint-kill-region) 67 (define-key ielm-map \"\\C-w\" 'comint-kill-region)
67 (define-key ielm-map [C-S-backspace] 68 (define-key ielm-map [C-S-backspace]
68 'comint-kill-whole-line))) 69 'comint-kill-whole-line)))
69 70
70If you set `comint-prompt-read-only' to t, you might wish to use 71If you set `comint-prompt-read-only' to t, you might wish to use
71`comint-mode-hook' and `comint-mode-map' instead of 72`comint-mode-hook' and `comint-mode-map' instead of
@@ -169,6 +170,7 @@ This variable is buffer-local.")
169 (let ((map (make-sparse-keymap))) 170 (let ((map (make-sparse-keymap)))
170 (define-key map "\t" 'completion-at-point) 171 (define-key map "\t" 'completion-at-point)
171 (define-key map "\C-m" 'ielm-return) 172 (define-key map "\C-m" 'ielm-return)
173 (define-key map "\e\C-m" 'ielm-return-for-effect)
172 (define-key map "\C-j" 'ielm-send-input) 174 (define-key map "\C-j" 'ielm-send-input)
173 (define-key map "\e\C-x" 'eval-defun) ; for consistency with 175 (define-key map "\e\C-x" 'eval-defun) ; for consistency with
174 (define-key map "\e\t" 'completion-at-point) ; lisp-interaction-mode 176 (define-key map "\e\t" 'completion-at-point) ; lisp-interaction-mode
@@ -203,7 +205,7 @@ This variable is buffer-local.")
203 "Possibly indent the current line as Lisp code." 205 "Possibly indent the current line as Lisp code."
204 (interactive) 206 (interactive)
205 (when (or (eq (preceding-char) ?\n) 207 (when (or (eq (preceding-char) ?\n)
206 (eq (char-syntax (preceding-char)) ?\s)) 208 (eq (char-syntax (preceding-char)) ?\s))
207 (ielm-indent-line) 209 (ielm-indent-line)
208 t)) 210 t))
209 211
@@ -212,9 +214,9 @@ This variable is buffer-local.")
212 ;; A wrapper for completion-at-point that returns non-nil if 214 ;; A wrapper for completion-at-point that returns non-nil if
213 ;; completion has occurred 215 ;; completion has occurred
214 (let* ((btick (buffer-modified-tick)) 216 (let* ((btick (buffer-modified-tick))
215 (cbuffer (get-buffer "*Completions*")) 217 (cbuffer (get-buffer "*Completions*"))
216 (ctick (and cbuffer (buffer-modified-tick cbuffer))) 218 (ctick (and cbuffer (buffer-modified-tick cbuffer)))
217 (completion-at-point-functions '(lisp-completion-at-point))) 219 (completion-at-point-functions '(lisp-completion-at-point)))
218 (completion-at-point) 220 (completion-at-point)
219 ;; completion has occurred if: 221 ;; completion has occurred if:
220 (or 222 (or
@@ -222,7 +224,7 @@ This variable is buffer-local.")
222 (not (= btick (buffer-modified-tick))) 224 (not (= btick (buffer-modified-tick)))
223 ;; a completions buffer has been modified or created 225 ;; a completions buffer has been modified or created
224 (if cbuffer 226 (if cbuffer
225 (not (= ctick (buffer-modified-tick cbuffer))) 227 (not (= ctick (buffer-modified-tick cbuffer)))
226 (get-buffer "*Completions*"))))) 228 (get-buffer "*Completions*")))))
227 229
228(defun ielm-complete-filename nil 230(defun ielm-complete-filename nil
@@ -258,13 +260,13 @@ evaluated. You can achieve the same effect with a call to
258 (interactive "bSet working buffer to: ") 260 (interactive "bSet working buffer to: ")
259 (let ((buffer (get-buffer buf))) 261 (let ((buffer (get-buffer buf)))
260 (if (and buffer (buffer-live-p buffer)) 262 (if (and buffer (buffer-live-p buffer))
261 (setq ielm-working-buffer buffer) 263 (setq ielm-working-buffer buffer)
262 (error "No such buffer: %S" buf))) 264 (error "No such buffer: %S" buf)))
263 (ielm-print-working-buffer)) 265 (ielm-print-working-buffer))
264 266
265;;; Other bindings 267;;; Other bindings
266 268
267(defun ielm-return nil 269(defun ielm-return (&optional for-effect)
268 "Newline and indent, or evaluate the sexp before the prompt. 270 "Newline and indent, or evaluate the sexp before the prompt.
269Complete sexps are evaluated; for incomplete sexps inserts a newline 271Complete sexps are evaluated; for incomplete sexps inserts a newline
270and indents. If however `ielm-dynamic-return' is nil, this always 272and indents. If however `ielm-dynamic-return' is nil, this always
@@ -272,22 +274,27 @@ simply inserts a newline."
272 (interactive) 274 (interactive)
273 (if ielm-dynamic-return 275 (if ielm-dynamic-return
274 (let ((state 276 (let ((state
275 (save-excursion 277 (save-excursion
276 (end-of-line) 278 (end-of-line)
277 (parse-partial-sexp (ielm-pm) 279 (parse-partial-sexp (ielm-pm)
278 (point))))) 280 (point)))))
279 (if (and (< (car state) 1) (not (nth 3 state))) 281 (if (and (< (car state) 1) (not (nth 3 state)))
280 (ielm-send-input) 282 (ielm-send-input for-effect)
281 (when (and ielm-dynamic-multiline-inputs 283 (when (and ielm-dynamic-multiline-inputs
282 (save-excursion 284 (save-excursion
283 (beginning-of-line) 285 (beginning-of-line)
284 (looking-at-p comint-prompt-regexp))) 286 (looking-at-p comint-prompt-regexp)))
285 (save-excursion 287 (save-excursion
286 (goto-char (ielm-pm)) 288 (goto-char (ielm-pm))
287 (newline 1))) 289 (newline 1)))
288 (newline-and-indent))) 290 (newline-and-indent)))
289 (newline))) 291 (newline)))
290 292
293(defun ielm-return-for-effect ()
294 "Like `ielm-return', but do not print the result."
295 (interactive)
296 (ielm-return t))
297
291(defvar ielm-input) 298(defvar ielm-input)
292 299
293(defun ielm-input-sender (_proc input) 300(defun ielm-input-sender (_proc input)
@@ -295,12 +302,12 @@ simply inserts a newline."
295 ;; `ielm-send-input's call. 302 ;; `ielm-send-input's call.
296 (setq ielm-input input)) 303 (setq ielm-input input))
297 304
298(defun ielm-send-input nil 305(defun ielm-send-input (&optional for-effect)
299 "Evaluate the Emacs Lisp expression after the prompt." 306 "Evaluate the Emacs Lisp expression after the prompt."
300 (interactive) 307 (interactive)
301 (let (ielm-input) ; set by ielm-input-sender 308 (let (ielm-input) ; set by ielm-input-sender
302 (comint-send-input) ; update history, markers etc. 309 (comint-send-input) ; update history, markers etc.
303 (ielm-eval-input ielm-input))) 310 (ielm-eval-input ielm-input for-effect)))
304 311
305;;; Utility functions 312;;; Utility functions
306 313
@@ -311,16 +318,41 @@ simply inserts a newline."
311 318
312;;; Evaluation 319;;; Evaluation
313 320
314(defvar ielm-string) 321(defun ielm-standard-output-impl (process)
315(defvar ielm-form) 322 "Return a function to use for `standard-output' while in ielm eval.
316(defvar ielm-pos) 323The returned function takes one character as input. Passing nil
317(defvar ielm-result) 324to this function instead of a character flushes the output
318(defvar ielm-error-type) 325buffer. Passing t appends a terminating newline if the buffer is
319(defvar ielm-output) 326nonempty, then flushes the buffer."
320(defvar ielm-wbuf) 327 ;; Use an intermediate output buffer because doing redisplay for
321(defvar ielm-pmark) 328 ;; each character we output is too expensive. Set up a flush timer
322 329 ;; so that users don't have to wait for whole lines to appear before
323(defun ielm-eval-input (input-string) 330 ;; seeing output.
331 (let* ((output-buffer nil)
332 (flush-timer nil)
333 (flush-buffer
334 (lambda ()
335 (comint-output-filter
336 process
337 (apply #'string (nreverse output-buffer)))
338 (redisplay)
339 (setf output-buffer nil)
340 (when flush-timer
341 (cancel-timer flush-timer)
342 (setf flush-timer nil)))))
343 (lambda (char)
344 (let (flush-now)
345 (cond ((and (eq char t) output-buffer)
346 (push ?\n output-buffer)
347 (setf flush-now t))
348 ((characterp char)
349 (push char output-buffer)))
350 (if flush-now
351 (funcall flush-buffer)
352 (unless flush-timer
353 (setf flush-timer (run-with-timer 0.1 nil flush-buffer))))))))
354
355(defun ielm-eval-input (input-string &optional for-effect)
324 "Evaluate the Lisp expression INPUT-STRING, and pretty-print the result." 356 "Evaluate the Lisp expression INPUT-STRING, and pretty-print the result."
325 ;; This is the function that actually `sends' the input to the 357 ;; This is the function that actually `sends' the input to the
326 ;; `inferior Lisp process'. All comint-send-input does is works out 358 ;; `inferior Lisp process'. All comint-send-input does is works out
@@ -331,108 +363,119 @@ simply inserts a newline."
331 ;; this as in output filter that converted sexps in the output 363 ;; this as in output filter that converted sexps in the output
332 ;; stream to their evaluated value. But that would have involved 364 ;; stream to their evaluated value. But that would have involved
333 ;; more process coordination than I was happy to deal with. 365 ;; more process coordination than I was happy to deal with.
334 ;; 366 (let ((string input-string) ; input expression, as a string
335 ;; NOTE: all temporary variables in this function will be in scope 367 form ; form to evaluate
336 ;; during the eval, and so need to have non-clashing names. 368 pos ; End posn of parse in string
337 (let ((ielm-string input-string) ; input expression, as a string 369 result ; Result, or error message
338 ielm-form ; form to evaluate 370 error-type ; string, nil if no error
339 ielm-pos ; End posn of parse in string 371 (output "") ; result to display
340 ielm-result ; Result, or error message 372 (wbuf ielm-working-buffer) ; current buffer after evaluation
341 ielm-error-type ; string, nil if no error 373 (pmark (ielm-pm)))
342 (ielm-output "") ; result to display 374 (unless (ielm-is-whitespace-or-comment string)
343 (ielm-wbuf ielm-working-buffer) ; current buffer after evaluation
344 (ielm-pmark (ielm-pm)))
345 (unless (ielm-is-whitespace-or-comment ielm-string)
346 (condition-case err 375 (condition-case err
347 (let ((rout (read-from-string ielm-string))) 376 (let ((rout (read-from-string string)))
348 (setq ielm-form (car rout) 377 (setq form (car rout)
349 ielm-pos (cdr rout))) 378 pos (cdr rout)))
350 (error (setq ielm-result (error-message-string err)) 379 (error (setq result (error-message-string err))
351 (setq ielm-error-type "Read error"))) 380 (setq error-type "Read error")))
352 (unless ielm-error-type 381 (unless error-type
353 ;; Make sure working buffer has not been killed 382 ;; Make sure working buffer has not been killed
354 (if (not (buffer-name ielm-working-buffer)) 383 (if (not (buffer-name ielm-working-buffer))
355 (setq ielm-result "Working buffer has been killed" 384 (setq result "Working buffer has been killed"
356 ielm-error-type "IELM Error" 385 error-type "IELM Error"
357 ielm-wbuf (current-buffer)) 386 wbuf (current-buffer))
358 (if (ielm-is-whitespace-or-comment (substring ielm-string ielm-pos)) 387 (if (ielm-is-whitespace-or-comment (substring string pos))
359 ;; To correctly handle the ielm-local variables *, 388 ;; To correctly handle the ielm-local variables *,
360 ;; ** and ***, we need a temporary buffer to be 389 ;; ** and ***, we need a temporary buffer to be
361 ;; current at entry to the inner of the next two let 390 ;; current at entry to the inner of the next two let
362 ;; forms. We need another temporary buffer to exit 391 ;; forms. We need another temporary buffer to exit
363 ;; that same let. To avoid problems, neither of 392 ;; that same let. To avoid problems, neither of
364 ;; these buffers should be alive during the 393 ;; these buffers should be alive during the
365 ;; evaluation of ielm-form. 394 ;; evaluation of form.
366 (let ((*1 *) 395 (let* ((*1 *)
367 (*2 **) 396 (*2 **)
368 (*3 ***) 397 (*3 ***)
369 ielm-temp-buffer) 398 (active-process (ielm-process))
370 (set-match-data ielm-match-data) 399 (old-standard-output standard-output)
371 (save-excursion 400 new-standard-output
372 (with-temp-buffer 401 ielm-temp-buffer)
373 (condition-case err 402 (set-match-data ielm-match-data)
374 (unwind-protect 403 (save-excursion
375 ;; The next let form creates default 404 (with-temp-buffer
376 ;; bindings for *, ** and ***. But 405 (condition-case err
377 ;; these default bindings are 406 (unwind-protect
378 ;; identical to the ielm-local 407 ;; The next let form creates default
379 ;; bindings. Hence, during the 408 ;; bindings for *, ** and ***. But
380 ;; evaluation of ielm-form, the 409 ;; these default bindings are
381 ;; ielm-local values are going to be 410 ;; identical to the ielm-local
382 ;; used in all buffers except for 411 ;; bindings. Hence, during the
383 ;; other ielm buffers, which override 412 ;; evaluation of form, the
384 ;; them. Normally, the variables *1, 413 ;; ielm-local values are going to be
385 ;; *2 and *3 also have default 414 ;; used in all buffers except for
386 ;; bindings, which are not overridden. 415 ;; other ielm buffers, which override
387 (let ((* *1) 416 ;; them. Normally, the variables *1,
388 (** *2) 417 ;; *2 and *3 also have default
389 (*** *3)) 418 ;; bindings, which are not overridden.
390 (kill-buffer (current-buffer)) 419 (let ((* *1)
391 (set-buffer ielm-wbuf) 420 (** *2)
392 (setq ielm-result 421 (*** *3))
393 (eval ielm-form lexical-binding)) 422 (when (eq standard-output t)
394 (setq ielm-wbuf (current-buffer)) 423 (setf new-standard-output
395 (setq 424 (ielm-standard-output-impl
396 ielm-temp-buffer 425 active-process))
397 (generate-new-buffer " *ielm-temp*")) 426 (setf standard-output new-standard-output))
398 (set-buffer ielm-temp-buffer)) 427 (kill-buffer (current-buffer))
399 (when ielm-temp-buffer 428 (set-buffer wbuf)
400 (kill-buffer ielm-temp-buffer))) 429 (setq result
401 (error (setq ielm-result (error-message-string err)) 430 (eval form lexical-binding))
402 (setq ielm-error-type "Eval error")) 431 (setq wbuf (current-buffer))
403 (quit (setq ielm-result "Quit during evaluation") 432 (setq
404 (setq ielm-error-type "Eval error"))))) 433 ielm-temp-buffer
405 (setq ielm-match-data (match-data))) 434 (generate-new-buffer " *ielm-temp*"))
406 (setq ielm-error-type "IELM error") 435 (set-buffer ielm-temp-buffer))
407 (setq ielm-result "More than one sexp in input")))) 436 (when ielm-temp-buffer
437 (kill-buffer ielm-temp-buffer))
438 (when (eq new-standard-output standard-output)
439 (ignore-errors
440 (funcall standard-output t))
441 (setf standard-output old-standard-output)))
442 (error (setq result (error-message-string err))
443 (setq error-type "Eval error"))
444 (quit (setq result "Quit during evaluation")
445 (setq error-type "Eval error")))))
446 (setq ielm-match-data (match-data)))
447 (setq error-type "IELM error")
448 (setq result "More than one sexp in input"))))
408 449
409 ;; If the eval changed the current buffer, mention it here 450 ;; If the eval changed the current buffer, mention it here
410 (unless (eq ielm-wbuf ielm-working-buffer) 451 (unless (eq wbuf ielm-working-buffer)
411 (message "current buffer is now: %s" ielm-wbuf) 452 (message "current buffer is now: %s" wbuf)
412 (setq ielm-working-buffer ielm-wbuf)) 453 (setq ielm-working-buffer wbuf))
413 454
414 (goto-char ielm-pmark) 455 (goto-char pmark)
415 (unless ielm-error-type 456 (unless error-type
416 (condition-case nil 457 (condition-case nil
417 ;; Self-referential objects cause loops in the printer, so 458 ;; Self-referential objects cause loops in the printer, so
418 ;; trap quits here. May as well do errors, too 459 ;; trap quits here. May as well do errors, too
419 (setq ielm-output (concat ielm-output (pp-to-string ielm-result))) 460 (unless for-effect
420 (error (setq ielm-error-type "IELM Error") 461 (setq output (concat output (pp-to-string result))))
421 (setq ielm-result "Error during pretty-printing (bug in pp)")) 462 (error (setq error-type "IELM Error")
422 (quit (setq ielm-error-type "IELM Error") 463 (setq result "Error during pretty-printing (bug in pp)"))
423 (setq ielm-result "Quit during pretty-printing")))) 464 (quit (setq error-type "IELM Error")
424 (if ielm-error-type 465 (setq result "Quit during pretty-printing"))))
425 (progn 466 (if error-type
426 (when ielm-noisy (ding)) 467 (progn
427 (setq ielm-output (concat ielm-output "*** " ielm-error-type " *** ")) 468 (when ielm-noisy (ding))
428 (setq ielm-output (concat ielm-output ielm-result))) 469 (setq output (concat output "*** " error-type " *** "))
429 ;; There was no error, so shift the *** values 470 (setq output (concat output result)))
430 (setq *** **) 471 ;; There was no error, so shift the *** values
431 (setq ** *) 472 (setq *** **)
432 (setq * ielm-result)) 473 (setq ** *)
433 (setq ielm-output (concat ielm-output "\n"))) 474 (setq * result))
434 (setq ielm-output (concat ielm-output ielm-prompt-internal)) 475 (when (or (not for-effect) (not (equal output "")))
435 (comint-output-filter (ielm-process) ielm-output))) 476 (setq output (concat output "\n"))))
477 (setq output (concat output ielm-prompt-internal))
478 (comint-output-filter (ielm-process) output)))
436 479
437;;; Process and marker utilities 480;;; Process and marker utilities
438 481
@@ -462,6 +505,11 @@ Uses the interface provided by `comint-mode' (which see).
462 Inputs longer than one line are moved to the line following the 505 Inputs longer than one line are moved to the line following the
463 prompt (but see variable `ielm-dynamic-multiline-inputs'). 506 prompt (but see variable `ielm-dynamic-multiline-inputs').
464 507
508* \\[ielm-return-for-effect] works like `ielm-return', except
509 that it doesn't print the result of evaluating the input. This
510 functionality is useful when forms would generate voluminous
511 output.
512
465* \\[completion-at-point] completes Lisp symbols (or filenames, within strings), 513* \\[completion-at-point] completes Lisp symbols (or filenames, within strings),
466 or indents the line if there is nothing to complete. 514 or indents the line if there is nothing to complete.
467 515
@@ -478,6 +526,13 @@ evaluations respectively. If the working buffer is another IELM
478buffer, then the values in the working buffer are used. The variables 526buffer, then the values in the working buffer are used. The variables
479`*1', `*2' and `*3', yield the process buffer values. 527`*1', `*2' and `*3', yield the process buffer values.
480 528
529If, at the start of evaluation, `standard-output' is `t' (the
530default), `standard-output' is set to a special function that
531causes output to be directed to the ielm buffer.
532`standard-output' is restored after evaluation unless explicitly
533set to a different value during evaluation. You can use (princ
534VALUE) or (pp VALUE) to write to the ielm buffer.
535
481Expressions evaluated by IELM are not subject to `debug-on-quit' or 536Expressions evaluated by IELM are not subject to `debug-on-quit' or
482`debug-on-error'. 537`debug-on-error'.
483 538
@@ -501,7 +556,7 @@ Customized bindings may be defined in `ielm-map', which currently contains:
501 (setq comint-process-echoes nil) 556 (setq comint-process-echoes nil)
502 (set (make-local-variable 'completion-at-point-functions) 557 (set (make-local-variable 'completion-at-point-functions)
503 '(ielm-tab comint-replace-by-expanded-history 558 '(ielm-tab comint-replace-by-expanded-history
504 ielm-complete-filename ielm-complete-symbol)) 559 ielm-complete-filename ielm-complete-symbol))
505 (set (make-local-variable 'ielm-prompt-internal) ielm-prompt) 560 (set (make-local-variable 'ielm-prompt-internal) ielm-prompt)
506 (set (make-local-variable 'comint-prompt-read-only) ielm-prompt-read-only) 561 (set (make-local-variable 'comint-prompt-read-only) ielm-prompt-read-only)
507 (setq comint-get-old-input 'ielm-get-old-input) 562 (setq comint-get-old-input 'ielm-get-old-input)
@@ -530,7 +585,7 @@ Customized bindings may be defined in `ielm-map', which currently contains:
530 ;; Was cat, but on non-Unix platforms that might not exist, so 585 ;; Was cat, but on non-Unix platforms that might not exist, so
531 ;; use hexl instead, which is part of the Emacs distribution. 586 ;; use hexl instead, which is part of the Emacs distribution.
532 (condition-case nil 587 (condition-case nil
533 (start-process "ielm" (current-buffer) "hexl") 588 (start-process "ielm" (current-buffer) "hexl")
534 (file-error (start-process "ielm" (current-buffer) "cat"))) 589 (file-error (start-process "ielm" (current-buffer) "cat")))
535 (set-process-query-on-exit-flag (ielm-process) nil) 590 (set-process-query-on-exit-flag (ielm-process) nil)
536 (goto-char (point-max)) 591 (goto-char (point-max))
@@ -565,13 +620,14 @@ Customized bindings may be defined in `ielm-map', which currently contains:
565;;;###autoload 620;;;###autoload
566(defun ielm nil 621(defun ielm nil
567 "Interactively evaluate Emacs Lisp expressions. 622 "Interactively evaluate Emacs Lisp expressions.
568Switches to the buffer `*ielm*', or creates it if it does not exist." 623Switches to the buffer `*ielm*', or creates it if it does not exist.
624See `inferior-emacs-lisp-mode' for details."
569 (interactive) 625 (interactive)
570 (let (old-point) 626 (let (old-point)
571 (unless (comint-check-proc "*ielm*") 627 (unless (comint-check-proc "*ielm*")
572 (with-current-buffer (get-buffer-create "*ielm*") 628 (with-current-buffer (get-buffer-create "*ielm*")
573 (unless (zerop (buffer-size)) (setq old-point (point))) 629 (unless (zerop (buffer-size)) (setq old-point (point)))
574 (inferior-emacs-lisp-mode))) 630 (inferior-emacs-lisp-mode)))
575 (switch-to-buffer "*ielm*") 631 (switch-to-buffer "*ielm*")
576 (when old-point (push-mark old-point)))) 632 (when old-point (push-mark old-point))))
577 633