Invoking a complex piped find within Emacs eshell-command
I'm trying to do something seemingly simple: create an Emacs function to create a TAGS file for me. There are simple instructions for doing this here
(defun create-tags (dir-name)
"Create tags file."
(interactive "DDirectory: ")
(format "find %s -type f -name \"*.[ch]\" | etags -" dir-name)))
The problem is I need "cpp" files instead of "c". That means my find command has to change to this:
find %s -type f -iname "*.cpp" -or -iname "*.h"
That works great on the command line. The problem I'm having is that eshell doesn't seem to like that at all. When I execute this function, I keep getting:
File not found - "*.h": Invalid argument.
The answer to this question suggests that proper use of
shell-quote-argument might fix these kinds of issues, but I haven't been able to hack out a solution that works. For instance, this produces the same error:
(format "find %s -type f -iname %s -or -iname %s | etags -"
windows emacs find interactive-shell