Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pipe less to Emacs

Tags:

emacs

When viewing piped output to Less, sometimes I'd like to be able to view it in Emacs in order to get syntax highlighting and use emacs commands for searching, marking, copying, etc.

I see that Less has a v command that can be used to open the currently viewed file in $EDITOR. Unfortunately this doesn't work when viewing piped input.

Also, I don't know how to get Emacs to display stdin as a read-only document.

So, is it possible to set up Less with something like v but that pumps the current buffer into Emacs as a read-only file?

Thanks.

like image 986
Steve Avatar asked Mar 23 '10 15:03

Steve


1 Answers

If you scroll down in http://www.emacswiki.org/emacs/GnuClient, you'll come to a section titled "Piping data to an Emacs buffer" which may be relevant. Or you can hack up a solution involving emacsclient and temporary files. (link dead).

I found another variant while looking for a duplicate of the dead link: Piping to an emacs buffer with emacsclient which points at code stored on github.

like image 61
dmckee --- ex-moderator kitten Avatar answered Oct 21 '22 09:10

dmckee --- ex-moderator kitten