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).

3
  • It calls the function elisp-last-sexp-toggle-display
    – fhdhsni
    Commented May 30, 2017 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
    Commented May 30, 2017 at 19:30
  • 3
    Does this answer your question? What is the meaning of the ellipsis at the end of some output?
    – user19761
    Commented Mar 15, 2020 at 13:46

1 Answer 1

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.

1
  • setting 'eval-expression-print-length' does not seem to disable this, but setting 'eval-expression-print-level' helps to disable this feature.
    – jue
    Commented Jun 3, 2017 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.