I recently learned that if I page my files with less, I can press v and open the buffer in Emacs. This works as long as I have the environment variable $EDITOR set up correctly, which in my case I have it as:export EDITOR='env TERM=xterm-256color emacs -nw'The above gives me the ability to load emacs within the terminal that runs less.However, the trick above does not work when piping commands to less. When doing this, less complains with the following message: Cannot edit standard input (press RETURN)My question is, why does this happen? But most importantly, is there any workaround to it?
Piping into less and editing: cannot edit standard input error. Workarounds?
emacs;less
As it was already said, you cannot edit an input stream.The workaround is quite obvious: save the stream to a file from within less and open the saved file. To do that while viewing, press s and give a name of a file. Then either exit less and open the file by hand, or, still from within less, type :e and give the name of the file you just saved.