Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 50503:7c83c5770cb6
(last-sexp-toggle-display): At end of buffer, just call `newline'.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 09 Apr 2003 01:32:45 +0000 |
parents | b4b69a752c69 |
children | 1e9e1fa3548b |
comparison
equal
deleted
inserted
replaced
50502:c94093d2e642 | 50503:7c83c5770cb6 |
---|---|
417 help-echo "RET, mouse-2: toggle abbreviated display" | 417 help-echo "RET, mouse-2: toggle abbreviated display" |
418 rear-nonsticky (mouse-face keymap help-echo | 418 rear-nonsticky (mouse-face keymap help-echo |
419 printed-value))))) | 419 printed-value))))) |
420 | 420 |
421 | 421 |
422 (defun last-sexp-toggle-display () | 422 (defun last-sexp-toggle-display (&optional arg) |
423 "Toggle between abbreviated and unabbreviated printed representations." | 423 "Toggle between abbreviated and unabbreviated printed representations." |
424 (interactive) | 424 (interactive "P") |
425 (let ((value (get-text-property (point) 'printed-value))) | 425 ;; Normally this command won't be called at end of line. |
426 (when value | 426 ;; But when the end of the line is also the end of the buffer, |
427 (let ((beg (or (previous-single-property-change (min (point-max) (1+ (point))) | 427 ;; it does get called. For consistency, pretend it was not called. |
428 'printed-value) | 428 (if (eobp) |
429 (point))) | 429 (newline arg) |
430 (end (or (next-single-char-property-change (point) 'printed-value) (point))) | 430 (let ((value (get-text-property (point) 'printed-value))) |
431 (standard-output (current-buffer)) | 431 (when value |
432 (point (point))) | 432 (let ((beg (or (previous-single-property-change (min (point-max) (1+ (point))) |
433 (delete-region beg end) | 433 'printed-value) |
434 (insert (nth 1 value)) | 434 (point))) |
435 (last-sexp-setup-props beg (point) | 435 (end (or (next-single-char-property-change (point) 'printed-value) (point))) |
436 (nth 0 value) | 436 (standard-output (current-buffer)) |
437 (nth 2 value) | 437 (point (point))) |
438 (nth 1 value)) | 438 (delete-region beg end) |
439 (goto-char (min (point-max) point)))))) | 439 (insert (nth 1 value)) |
440 (last-sexp-setup-props beg (point) | |
441 (nth 0 value) | |
442 (nth 2 value) | |
443 (nth 1 value)) | |
444 (goto-char (min (point-max) point))))))) | |
440 | 445 |
441 (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) | 446 (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) |
442 "Evaluate sexp before point; print value in minibuffer. | 447 "Evaluate sexp before point; print value in minibuffer. |
443 With argument, print output into current buffer." | 448 With argument, print output into current buffer." |
444 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) | 449 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) |
624 (setq value (eval-defun-2)) | 629 (setq value (eval-defun-2)) |
625 (setq new-value debug-on-error)) | 630 (setq new-value debug-on-error)) |
626 (unless (eq old-value new-value) | 631 (unless (eq old-value new-value) |
627 (setq debug-on-error new-value)) | 632 (setq debug-on-error new-value)) |
628 value))))) | 633 value))))) |
629 | 634 |
630 | 635 |
631 (defun lisp-comment-indent () | 636 (defun lisp-comment-indent () |
632 (if (looking-at "\\s<\\s<\\s<") | 637 (if (looking-at "\\s<\\s<\\s<") |
633 (current-column) | 638 (current-column) |
634 (if (looking-at "\\s<\\s<") | 639 (if (looking-at "\\s<\\s<") |