Just out of curiosity if the Emacs Gods here know if this is possible:
1) send a file to Emacs (I rather mean using a pipe than actually 'finding' it)
2) let it perform a couple of operations (e.g. M-x mark-whole-buffer M-x remove-whitespace-rectangle)
3a) save the file in-place and exit (C-x C-s C-x C-c)
3b) directly show to output on the screen (EDIT: I mean outside of Emacs)
I know that this is much easier with sed, but I really just want to verify if
- it's possible
- how the syntax would look like
- Emacs can be a stream editor
- Emacs can work non-interactively
Thanks!
'(godlike-solved t) stream editing in Emacs
Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
-
- Baconator
- Posts: 10253
- Joined: Thu Sep 16, 2010 11:03 am
- Location: Pfälzerwald
- Contact:
'(godlike-solved t) stream editing in Emacs
..gnutella..
Re: stream editing in Emacs
I guess it could be possible.
The options "--file" and "--funcall" should be what you are looking for: https://www.gnu.org/software/emacs/manu ... -Arguments
Also, "--kill" will exit Emacs without confirmation.
I'm not sure you can call more than one function, though.
Edit: maybe this? http://emacswiki.org/emacs/EmacsScripts
The options "--file" and "--funcall" should be what you are looking for: https://www.gnu.org/software/emacs/manu ... -Arguments
Also, "--kill" will exit Emacs without confirmation.
I'm not sure you can call more than one function, though.
Edit: maybe this? http://emacswiki.org/emacs/EmacsScripts
-
- Baconator
- Posts: 10253
- Joined: Thu Sep 16, 2010 11:03 am
- Location: Pfälzerwald
- Contact:
Re: stream editing in Emacs
^ Thanks Manu,
works great!
Code: Select all
emacs -nw --file logbook --funcall 'mark-whole-buffer' --funcall 'delete-whitespace-rectangle' --funcall 'save-buffer' --kill
..gnutella..
Re: '(godlike-solved t) stream editing in Emacs
^ Wow! That is cool.