6

In AucTeX, when editing an itemized list:

\begin{itemize}
 \item My item % note to self
\end{itemize}

when I do C-c C-j after 'self' I get:

\begin{itemize}
 \item My item % note to self
 % \item
\end{itemize}

when I want:

\begin{itemize}
 \item My item % note to self
 \item
\end{itemize}

Is there a setting a can modify to make this work correctly?

Svante
  • 50,694
  • 11
  • 78
  • 122
stevejb
  • 2,414
  • 5
  • 26
  • 41

1 Answers1

4
(setq LaTeX-insert-into-comments nil)

seems to solve the problem, although it may have other effects that I'm not aware of. To use it, put it in your .emacs customization file; to test it, try M-: then paste the above code into the prompt.

The variable LaTeX-insert-into-comments is defined as

*Whether insertion commands stay in comments. 
This allows using the insertion commands even when
the lines are outcommented, like in dtx files.

EDIT:

Here is something better:

(defadvice LaTeX-insert-item (around my-LaTeX-insert-item activate)
     (let  ((LaTeX-insert-into-comments nil)) ad-do-it))

This will prevent unwanted effects from setting the LaTeX-insert-into-comments globally to nil by changing it only temporarily when you insert an item. Again, to use it, put it in your .emacs customization file.

polyglot
  • 9,945
  • 10
  • 49
  • 63