defunkt / coffee-mode

Emacs Major Mode for CoffeeScript
http://ozmm.org/posts/coffee_mode.html
574 stars 147 forks source link

Truncating long output in REPL #355

Closed dmh43 closed 8 years ago

dmh43 commented 8 years ago

Sometimes I evaluate commands in the REPL which return a very large object. This causes me to have to sit and wait for it all to be printed to the console (this is sometimes a LOT of text). What do you think about having some option to truncate the output?

I was thinking this could be implemented by evaluating something like require('util').inspect = truncatedLog when a REPL is first created (where truncatedLog only prints out the first 100 lines or so).

syohex commented 8 years ago

What do you think about having some option to truncate the output?

I disagree to implement such feature in coffee-mode. REPL in Emacs does not block everything, you can do other task while very large object is outputted, you need not to wait. You want to need such configuration, please set it in your environment.

I was thinking this could be implemented by evaluating something like require('util').inspect = truncatedLog when a REPL is first created (where truncatedLog only prints out the first 100 lines or so).

BTW, such function makes no sense, if there is only one line but it is very too long.

dmh43 commented 7 years ago

For anyone else who has a similar issue: I ended up adding a method to comint-preoutput-filter-functions to truncate long output on coffee-repl buffers :)