Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Output the contents of the buffer, when connected to a pipe #4
Just a thought perhaps
The use case I am thinking of is using eless, as an interactive replacement for likes of
That thought did cross my mind, but as you see in the code, I quit the script if one tries to do that. I have never needed to edit something interactively inbetween a pipe.
Also this would be a feature-creep from the emacs view-mode and less-like functionality. I am on the fence about whether we should add this functionality.
@kaushalmodi As much as I would to have this feature, I certainly appreciate your concerns regarding feature-creep.
Though if you think of it Emacs is ultimately a tool to manipulate text, so it makes sense to allow users to use it transform contents in a pipeline. I personally have been in situations in past where the input was too complex for my awk/sed foo and I had to copy the text to a file, edit the file using Emacs (to make it easier for other tools to parse) and then use the transformed file as input for rest of the pipeline, I would have found
One last thing though could you update
echo "Line 1\nLine 2" | less | xargs -I text echo text
Line 1 Line 2
I would have just used emacs to do the whole thing, and even end up writing an elisp snippet for the just-in-case event that I might need to repeat that :)
But yes, that use case does make sense. Let me find some time next week to look into this. It's probably as simple as doing
While I look into this, feel free to provide a PR. If the solution is as simple as it think it is, then there's no harm implementing it.
I am not at a computer at the moment. What does that do? Does it open up less in-between, or does less pass things forward and not show up at all? (Update: My google-fu is failing me. I don't find any useful application of this except for probably adding just line numbers. For that too, people suggested using
If it is the latter then emacs would need to be launched in batch mode. That would be even bigger deviation from the goal of this project.
Nothing useful at all actually, I was just trying to show
I just thought it would be better if
It was complicated
Sure I will definitely try to implement this, thanks again for looking into this