I'm trying to modify a script I got from an old question of mine.

I have many .org files under many subdirectories of ~/foo. I want to quickly run htmlize on each .org file. I have some elisp code

$ cat ~/htmlize-script.el
(add-to-list 'load-path "~/.emacs.d/elpa/htmlize-20130207.1202/")
(require 'htmlize)

and my script is

$ cat ~/script.sh
find ~/foo -name "*.org" -exec emacs --eval "
  (load-file \"~/htmlize-script.el\")
  (htmlize-many-files \"{}\")
" --kill \;

However, running this code gives the error

Wrong type argument: listp

What is the issue here?

Issuing C-h f htmlize-many-files returns

htmlize-many-files is an interactive autoloaded Lisp function in `htmlize.el'.

(htmlize-many-files FILES &optional TARGET-DIRECTORY)

Convert FILES to HTML and save the corresponding HTML versions.

FILES should be a list of file names to convert.  This function calls
`htmlize-file' on each file; see that function for details.  When
invoked interactively, you are prompted for a list of files to convert,
terminated with RET.

If TARGET-DIRECTORY is specified, the HTML files will be saved to that
directory.  Normally, each HTML file is saved to the directory of the
corresponding source file.

Is the problem that the find command does not pass the right list to emacs?


FILES should be a list of file names to convert

So presumably you actually need (htmlize-many-files (list \"{}\")) in that shell script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.