I am working on the Emacs Lisp package, and one feature I would like to add is the ability to define functions on the fly - they will follow the same naming convention, but this would help me not to declare each one manually .
To give an example, I have a basic function called exec that takes an argument, which is the name of the executable to run:
(def exec (cmd) (async-shell-command cmd "buffer"))
At the same time, in this particular case, I know the list of executable files that I want to use, or rather, I know how to get their list, since it can change over time. So, what would I like to do, given the following list of executables:
("a" "b" "c")
- iterate over them and for each of them create a function named exec- [executable] - exec-a, exec-b, exec-c.
Unfortunately, defun does not evaluate the NAME argument, so I cannot dynamically create the function name.
PS. The exec command is good enough in itself - it uses completing-read with a list of supplied executables, but I thought that would be a good addition.
source share