Based on a quick check of C-hig
(emacs) Specifying File Variables, I'm reasonably sure that you can't.
I think your options are:
- Move the comment outside of the local variables block.
- Change the variable (e.g. give it a prefix like
DISABLED:) such that the value is simply assigned to a variable which nothing uses.
If you don't want to have to approve a bunch of
DISABLED:foo variables for
safe-local-variable-values, you could adapt the approach to take advantage of the fact that successive entries clobber earlier ones if the same variable name is used. Something like:
# Local Variables:
# #: python-shell-interpreter: "python3"
# #: python-shell-virtualenv-path: "~/.virtualenvs/datascience"
# leo-python-args-to-send: "-f fqanalysis.txt"
# #: <comment>
These still aren't comments, but it does mean you only have a single local variable named
\# in this instance) with the value
<comment>, and Emacs won't query you about the earlier ones; so you could re-use this approach in other files and only end up with a single
safe-local-variable-values entry for all such 'commented' values, so long as that
#: <comment> entry always comes last.
(YMMV; this is only lightly tested, and is obviously a hack workaround. Note also that you needn't use the actual comment character, as it's actually a variable name, so you can call it whatever you want, so long as it's not likely to conflict with any 'proper' variable name.)
You could ditch the need for a
#: <comment> entry but still avoid being asked questions if you added the following to your config:
(put '\# 'safe-local-variable (lambda (_) t))
Which says "ALL values for the variable
# are safe.