5 ms·
Why does this need to be a standalone tool? I can already do this in Emacs by pasting emacs-lisp code snippets and executing then while editing the file, insert
by conistonwater 8y ago
Why does this need to be a standalone tool? I can already do this in Emacs by pasting emacs-lisp code snippets and executing then while editing the file, inserting the output into it. Do other editors not have this feature?
- nedbat 8y agoDoing it manually in an editor is fine, but it's useful to automate the process also. Just because something can be done in an editor doesn't mean you don't want to be able to do it at the command line too.
- anschwa 8y agoNot to mention using "C-u M-|" (shell-command-on-region).
- nedbat 8y agoHave you actually looked at what cog does? I don't see how you would manually use Emacs commands to do the same more than once.
- anschwa 8y agoI'm not exactly sure I understand the use-case, but as far as the example used in the article, shell-command-on-region accomplishes the same kind of thing. Why not leave the "generation code" as a comment in your file the same way cog does?
- PurpleRamen 8y agoTemplate-generators like cog are meant to run periodically, for example every time you 'compile' your project. Often they contain dynamic elements which can change between each run. Using your emacs-command would defeat that purpose, because you would need to search the region at every run and re-execute it manually again and again and again. And you would need to documentate the command anyway, because nobody can remember all those regions. So why not automate this task then?
- InitialLastName 8y agoWhat I like about it (I use it) is that it lets me drive code in low-level, somewhat math-incapable languages at compile time. I have a project right now that does real-time signal processing in an FPGA. The actual project itself is organized in Verilog, which is cumbersome to do math raw math in. I use cog in my build to do a bunch of preprocessing math in python. For example, since I use cog to calculate a bunch of constants (for coefficients and the like), I can change the sample rate in one control file and the compilation process will re-do all the math for me.
- gridlockd 8y ago> Why does this need to be a standalone tool? I can already do this in Emacs... It needs to be standalone so that you can make it part of your build process instead of messing around in some text editor that not everybody wants to use.