]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/lisp-mode.el
(easy-mmode-define-navigation): Avoid
[gnu-emacs] / lisp / emacs-lisp / lisp-mode.el
index 692f00b78175a86805f6abacac62f3b85d025414..ca4e7f10a68443f87f273fad1906cc1ed2ef62b3 100644 (file)
@@ -425,12 +425,8 @@ alternative printed representations that can be displayed."
 (defun last-sexp-toggle-display (&optional arg)
   "Toggle between abbreviated and unabbreviated printed representations."
   (interactive "P")
-  ;; Normally this command won't be called at end of line.
-  ;; But when the end of the line is also the end of the buffer,
-  ;; it does get called.  For consistency, pretend it was not called.
-  (if (eobp)
-      (let ((prefix-arg arg))
-       (command-execute (lookup-key global-map (this-single-command-keys))))
+  (save-restriction
+    (widen)
     (let ((value (get-text-property (point) 'printed-value)))
       (when value
        (let ((beg (or (previous-single-property-change (min (point-max) (1+ (point)))
@@ -470,51 +466,52 @@ With argument, print output into current buffer."
                       (opoint (point))
                       ignore-quotes
                       expr)
-                  (with-syntax-table emacs-lisp-mode-syntax-table
-                    ;; If this sexp appears to be enclosed in `...'
-                    ;; then ignore the surrounding quotes.
-                    (setq ignore-quotes
-                          (or (eq (following-char) ?\')
-                              (eq (preceding-char) ?\')))
-                    (forward-sexp -1)
-                    ;; If we were after `?\e' (or similar case),
-                    ;; use the whole thing, not just the `e'.
-                    (when (eq (preceding-char) ?\\)
-                      (forward-char -1)
-                      (when (eq (preceding-char) ??)
-                        (forward-char -1)))
-
-                    ;; Skip over `#N='s.
-                    (when (eq (preceding-char) ?=)
-                      (let (labeled-p)
-                        (save-excursion
-                          (skip-chars-backward "0-9#=")
-                          (setq labeled-p (looking-at "\\(#[0-9]+=\\)+")))
-                        (when labeled-p
-                          (forward-sexp -1))))
-
-                    (save-restriction
-                      ;; vladimir@cs.ualberta.ca 30-Jul-1997: skip ` in
-                      ;; `variable' so that the value is returned, not the
-                      ;; name
-                      (if (and ignore-quotes
-                               (eq (following-char) ?`))
-                          (forward-char))
-                      (narrow-to-region (point-min) opoint)
-                      (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))))))
+                  (save-excursion
+                    (with-syntax-table emacs-lisp-mode-syntax-table
+                      ;; If this sexp appears to be enclosed in `...'
+                      ;; then ignore the surrounding quotes.
+                      (setq ignore-quotes
+                            (or (eq (following-char) ?\')
+                                (eq (preceding-char) ?\')))
+                      (forward-sexp -1)
+                      ;; If we were after `?\e' (or similar case),
+                      ;; use the whole thing, not just the `e'.
+                      (when (eq (preceding-char) ?\\)
+                        (forward-char -1)
+                        (when (eq (preceding-char) ??)
+                          (forward-char -1)))
+
+                      ;; Skip over `#N='s.
+                      (when (eq (preceding-char) ?=)
+                        (let (labeled-p)
+                          (save-excursion
+                            (skip-chars-backward "0-9#=")
+                            (setq labeled-p (looking-at "\\(#[0-9]+=\\)+")))
+                          (when labeled-p
+                            (forward-sexp -1))))
+
+                      (save-restriction
+                        ;; vladimir@cs.ualberta.ca 30-Jul-1997: skip ` in
+                        ;; `variable' so that the value is returned, not the
+                        ;; name
+                        (if (and ignore-quotes
+                                 (eq (following-char) ?`))
+                            (forward-char))
+                        (narrow-to-region (point-min) opoint)
+                        (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)))))))
       (let ((unabbreviated (let ((print-length nil) (print-level nil))
                             (prin1-to-string value)))
            (print-length eval-expression-print-length)