-
Notifications
You must be signed in to change notification settings - Fork 10
Output the contents of the buffer, when connected to a pipe #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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. |
It's a really neat idea. |
@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 outputs Line 1
Line 2 Thanks |
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 😄, I was fetching page extracting links from it, fetching each of those links and then in turn scrapping them for some more links and finally downloading them, quick and dirty web scrapping, I did end up writing a shell function to do this but it has a lot
Sure I will definitely try to implement this, thanks again for looking into this 😄 |
@iqbalansari I'd just like to point you to vipe. I believe it's a better fit for this use case. It literally allows you to do exactly what you'd suggested: echo "Line 1\nLine 2" | vipe | xargs -I text echo text |
I'll close this as I haven't found a use for this or any interest in these many years. |
Just a thought perhaps
eless
can output the current buffer, when its output is pipe, this way it can part of a larger pipeline.The use case I am thinking of is using eless, as an interactive replacement for likes of
sed
orawk
allowing user to transform the text before it goes to next thing in the pipeline.The text was updated successfully, but these errors were encountered: