8

In a python file I have

# Local Variables:
# python-shell-interpreter: "python3"
# python-shell-virtualenv-path: "~/.virtualenvs/datascience"
# leo-python-args-to-send: "-f fqanalysis.txt"
# End:

For a couple of days I want to use the python file without the specified virtualenv, so I would like to comment out the line setting python-shell-virtualenv-path, so that next time I open the python file in emacs python-shell-virtualenv-path keeps its global value.

I tried

# ;;python-shell-virtualenv-path: "~/.virtualenvs/datascience"

and

## python-shell-virtualenv-path: "~/.virtualenvs/datascience"

but on opening the python file I always get the error

File mode specification error: (error "Malformed local variable line: ...)

How do I comment out the local variable line correctly?

  • When I select the line containing # python-shell-virtualenv-path: "~/.virtualenvs/datascience" and apply the command comment-region, the result is # # python-shell-virtualenv-path: "~/.virtualenvs/datascience". I don't know if it is the correct way to comment out local variables. – Name Sep 2 '15 at 9:51
6

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.