diff options
author | Richard M. Stallman <rms@gnu.org> | 2003-04-09 01:32:45 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2003-04-09 01:32:45 +0000 |
commit | 98996d899ebeb1d4a26702a950a2e8877a214959 (patch) | |
tree | f2cae986b4ca5f9df64436f99a6dc4b07b450f41 /lisp/emacs-lisp/lisp-mode.el | |
parent | 71f46c95f65b5bbc9d66a3be0815f3d9669e3273 (diff) | |
download | emacs-98996d899ebeb1d4a26702a950a2e8877a214959.tar.gz emacs-98996d899ebeb1d4a26702a950a2e8877a214959.tar.bz2 emacs-98996d899ebeb1d4a26702a950a2e8877a214959.zip |
(last-sexp-toggle-display): At end of buffer, just call `newline'.
Diffstat (limited to 'lisp/emacs-lisp/lisp-mode.el')
-rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index e0030ea766a..6c084c409df 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -419,24 +419,29 @@ alternative printed representations that can be displayed." printed-value))))) -(defun last-sexp-toggle-display () +(defun last-sexp-toggle-display (&optional arg) "Toggle between abbreviated and unabbreviated printed representations." - (interactive) - (let ((value (get-text-property (point) 'printed-value))) - (when value - (let ((beg (or (previous-single-property-change (min (point-max) (1+ (point))) - 'printed-value) - (point))) - (end (or (next-single-char-property-change (point) 'printed-value) (point))) - (standard-output (current-buffer)) - (point (point))) - (delete-region beg end) - (insert (nth 1 value)) - (last-sexp-setup-props beg (point) - (nth 0 value) - (nth 2 value) - (nth 1 value)) - (goto-char (min (point-max) point)))))) + (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) + (newline arg) + (let ((value (get-text-property (point) 'printed-value))) + (when value + (let ((beg (or (previous-single-property-change (min (point-max) (1+ (point))) + 'printed-value) + (point))) + (end (or (next-single-char-property-change (point) 'printed-value) (point))) + (standard-output (current-buffer)) + (point (point))) + (delete-region beg end) + (insert (nth 1 value)) + (last-sexp-setup-props beg (point) + (nth 0 value) + (nth 2 value) + (nth 1 value)) + (goto-char (min (point-max) point))))))) (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in minibuffer. @@ -626,7 +631,7 @@ which see." (unless (eq old-value new-value) (setq debug-on-error new-value)) value))))) - + (defun lisp-comment-indent () (if (looking-at "\\s<\\s<\\s<") |