# Is it possible to "protect" strings from formatting?

I'm working on a latex document

\documentclass{exam}

% to use the tag
% \usepackage{catchfilebetweentags}

%<*afterclass>

\begin{document}

\begin{questions}
\question What is the first sentence of \emph{Moby Dick}?
\begin{solution}
\emph{Call me Ishmael.}
\end{solution}

\end{questions}

\end{document}

%</afterclass>


As the document grows, I find myself often issuing C-x h TAB to fix my formatting.

The problem is that this key sequence takes the two strings

%<*afterclass>
%</afterclass>


and places a space after the % character:

% <*afterclass>
% </afterclass>


This causes problems in another script. Is it possible to "protect" these two lines from this formatting?

The simple way is to set comment-padding to 0 in a buffer-local variable. However, that has the effect of removing spaces after the percent sign on every comment line. If that is problematic, you may have to patch (or better: advice) the function LaTeX-indent-line.