Following this 2005 thread from the XeTeX list, I’ve defined a \spaceddash command and assigned it to the Unicode em-dash character U+2014 “—”:
\documentclass{minimal}
\usepackage[utf8]{inputenc}
\DeclareRobustCommand{\spaceddash}%
{\unskip\nobreak\thinspace\textemdash\thinspace\ignorespaces}
\DeclareUnicodeCharacter{2014}{\spaceddash}
\begin{document}
meow — meow
meow—meow
— meow
meow —.
\end{document}
The document this produces looks something like this:
meow — meow
meow — meow
— meow
meow — .
Notice the thin-space between the em-dash on the last line and the period afterward—I’d like to get rid of it.
Following the example of xspace & xpunctuate, I’m trying to define a sort of \xthinspace command, one that will insert the \thinspace except if the dash is followed by certain punctuation marks (e.g., period, comma, close-parenthesis, close-quote).
How do I go about this?

\spaceddashis missing the argument specifier, also the\unskip\nobreak&\ignorespaces; but with those changes, this does exactly what I was looking for. Thank you. – J. C. Salomon Jun 13 '12 at 04:05\kern1emis more appropriate than\hspacefor testing, because it won’t leave space at line’s beginning (\thinspaceis just\kern.1666em) (though it plays funny games with vertical kerning at the start of a paragraph). After defining\dashspaceto\kern1em(for testing) or\thinspace, my definition was\NewDocumentCommand{\spaceddash}{ }{\unskip\nobreak\ifhmode\dashspace\fi\textemdash\xthinspace\ignorespaces}– J. C. Salomon Jun 13 '12 at 04:11\xthinspace\ignorespacesis an error, as\xthinspacehas\ignorespacesafter it and so the test it performs is useless. – egreg Jun 13 '12 at 06:26