but this does not set the mode automatically. I seem to remember this
working at some point, perhaps with an older version of Emacs than my
current 26.1.
When trying to test the regex with
(string-match "wiki\\.foo" (buffer-file-name))
it seems that buffer-file-name is nil in the temporary buffer. Could
this be the problem? Is that what auto-mode-alist relies on?