aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2003-06-03 11:10:31 +0000
committerRichard M. Stallman2003-06-03 11:10:31 +0000
commitc4e2d7912b43daa4956ce0f83003e7d8791356aa (patch)
tree96c15ba7286f933151d6922eea69e639fb91c2b1
parentd9b9e93c76c4001bb401be992d8a80b06f7d2fc4 (diff)
downloademacs-c4e2d7912b43daa4956ce0f83003e7d8791356aa.tar.gz
emacs-c4e2d7912b43daa4956ce0f83003e7d8791356aa.zip
(eval-last-sexp-1): Add save-excursion.
-rw-r--r--lisp/emacs-lisp/lisp-mode.el91
1 files changed, 46 insertions, 45 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index b922f4e8072..679a9141689 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -469,51 +469,52 @@ With argument, print output into current buffer."
469 (opoint (point)) 469 (opoint (point))
470 ignore-quotes 470 ignore-quotes
471 expr) 471 expr)
472 (with-syntax-table emacs-lisp-mode-syntax-table 472 (save-excursion
473 ;; If this sexp appears to be enclosed in `...' 473 (with-syntax-table emacs-lisp-mode-syntax-table
474 ;; then ignore the surrounding quotes. 474 ;; If this sexp appears to be enclosed in `...'
475 (setq ignore-quotes 475 ;; then ignore the surrounding quotes.
476 (or (eq (following-char) ?\') 476 (setq ignore-quotes
477 (eq (preceding-char) ?\'))) 477 (or (eq (following-char) ?\')
478 (forward-sexp -1) 478 (eq (preceding-char) ?\')))
479 ;; If we were after `?\e' (or similar case), 479 (forward-sexp -1)
480 ;; use the whole thing, not just the `e'. 480 ;; If we were after `?\e' (or similar case),
481 (when (eq (preceding-char) ?\\) 481 ;; use the whole thing, not just the `e'.
482 (forward-char -1) 482 (when (eq (preceding-char) ?\\)
483 (when (eq (preceding-char) ??) 483 (forward-char -1)
484 (forward-char -1))) 484 (when (eq (preceding-char) ??)
485 485 (forward-char -1)))
486 ;; Skip over `#N='s. 486
487 (when (eq (preceding-char) ?=) 487 ;; Skip over `#N='s.
488 (let (labeled-p) 488 (when (eq (preceding-char) ?=)
489 (save-excursion 489 (let (labeled-p)
490 (skip-chars-backward "0-9#=") 490 (save-excursion
491 (setq labeled-p (looking-at "\\(#[0-9]+=\\)+"))) 491 (skip-chars-backward "0-9#=")
492 (when labeled-p 492 (setq labeled-p (looking-at "\\(#[0-9]+=\\)+")))
493 (forward-sexp -1)))) 493 (when labeled-p
494 494 (forward-sexp -1))))
495 (save-restriction 495
496 ;; vladimir@cs.ualberta.ca 30-Jul-1997: skip ` in 496 (save-restriction
497 ;; `variable' so that the value is returned, not the 497 ;; vladimir@cs.ualberta.ca 30-Jul-1997: skip ` in
498 ;; name 498 ;; `variable' so that the value is returned, not the
499 (if (and ignore-quotes 499 ;; name
500 (eq (following-char) ?`)) 500 (if (and ignore-quotes
501 (forward-char)) 501 (eq (following-char) ?`))
502 (narrow-to-region (point-min) opoint) 502 (forward-char))
503 (setq expr (read (current-buffer))) 503 (narrow-to-region (point-min) opoint)
504 ;; If it's an (interactive ...) form, it's more 504 (setq expr (read (current-buffer)))
505 ;; useful to show how an interactive call would 505 ;; If it's an (interactive ...) form, it's more
506 ;; use it. 506 ;; useful to show how an interactive call would
507 (and (consp expr) 507 ;; use it.
508 (eq (car expr) 'interactive) 508 (and (consp expr)
509 (setq expr 509 (eq (car expr) 'interactive)
510 (list 'call-interactively 510 (setq expr
511 (list 'quote 511 (list 'call-interactively
512 (list 'lambda 512 (list 'quote
513 '(&rest args) 513 (list 'lambda
514 expr 514 '(&rest args)
515 'args))))) 515 expr
516 expr)))))) 516 'args)))))
517 expr)))))))
517 (let ((unabbreviated (let ((print-length nil) (print-level nil)) 518 (let ((unabbreviated (let ((print-length nil) (print-level nil))
518 (prin1-to-string value))) 519 (prin1-to-string value)))
519 (print-length eval-expression-print-length) 520 (print-length eval-expression-print-length)