4

Sometimes when a function or variable outputs a very long line, it ends with ...). When the cursor is on that line and I press return, the line gets longer (probably expanded). I guess this is some sort of folding.

How is this feature called? How can I disable it? How can I use it? How can I split this line into two lines?

How to reproduce:

  1. start emacs with: emacs -Q
  2. load proced to create that variable for my example: M-x proced
  3. switch to *scratch* buffer
  4. enter proced-grammar-alist and press C-j
  5. then you have that long line with this behaviour.

Edit: changed the title and tags to reflect the topic (after knowing the answer).

Drew
  • 75,699
  • 9
  • 109
  • 225
jue
  • 4,476
  • 8
  • 20
  • It calls the function `elisp-last-sexp-toggle-display` – fhdhsni May 30 '17 at 17:12
  • You can also do that with `Mouse-2` (the middle mouse bouton). The function has "Toggle between abbreviated and unabbreviated printed representations." as its docstring. – JeanPierre May 30 '17 at 19:30
  • 3
    Does this answer your question? [What is the meaning of the ellipsis at the end of some output?](https://emacs.stackexchange.com/questions/34413/what-is-the-meaning-of-the-ellipsis-at-the-end-of-some-output) –  Mar 15 '20 at 13:46

1 Answers1

4

The binding C-j runs the command eval-print-last-sexp. Use C-h k C-j to describe the key binding and see the documentation for the corresponding command. In that doc you'll see some relevant information:

Normally, this function truncates long output according to the value of the variables ‘eval-expression-print-length’ and ‘eval-expression-print-level’. With a prefix argument of zero, however, there is no such truncation.

This explains where the ... is coming from and provides some pointers on how you might customize this behavior or skip it with a prefix argument.

So: If you never want large eval results truncated, you could customize eval-expression-print-length and set it to nil or some large value. Or you can use a 0 prefix (i.e. C-0 C-j) to eval and get the full result. Either way the non-truncated result will not have the special binding for RET and can be edited normally.

Use the same approach (C-h k RET) on a truncated result to learn that RET in that context will call elisp-last-sexp-toggle-display. Note that this binding only exists on the original truncated result -- if you expand the result and copy it somewhere else it becomes "regular" text with no magic RET behavior.

glucas
  • 20,175
  • 1
  • 51
  • 83
  • setting 'eval-expression-print-length' does not seem to disable this, but setting 'eval-expression-print-level' helps to disable this feature. – jue Jun 03 '17 at 07:46