emacs: fix cocoa build

Closes #18539.