The attached patch should fix the problems we have with index and url. The idea is that it forces the LaTeX from both to be processed verbatim, which is signalled in the UI by using typewriter font. I.e., if you want the LyX logo to appear in the index entry, you must explicitly use a backslash. I think this is enough of a treshold for unsuspecting users.
This somewhat defeats the original idea of moving them to Collapsable, but still we got rid of the pop-ups. Editing has become more natural. The patch could be easily modified to nevertheless, in spite of verbatim, escape the TeX special characters. Then lyx2lyx should be adapted. A little more friendly at the cost of more complexity (and less predictability?). Please advise. - Martin
Index: src/OutputParams.cpp =================================================================== --- src/OutputParams.cpp (revision 21001) +++ src/OutputParams.cpp (working copy) @@ -25,7 +25,7 @@ inComment(false), inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED), par_begin(0), par_end(0), - dryrun(false) + dryrun(false), verbatim(false) {} Index: src/OutputParams.h =================================================================== --- src/OutputParams.h (revision 21001) +++ src/OutputParams.h (working copy) @@ -146,6 +146,8 @@ * This mode will be used to preview the source code */ bool dryrun; + /// Should we output verbatim or escape LaTeX's special chars? + bool verbatim; }; Index: src/Paragraph.cpp =================================================================== --- src/Paragraph.cpp (revision 21001) +++ src/Paragraph.cpp (working copy) @@ -880,6 +880,11 @@ default: // And now for the special cases within each mode + if (runparams.verbatim) { + os.put(c); + break; + } + switch (c) { case '\\': os << "\\textbackslash{}"; Index: src/insets/InsetCollapsable.cpp =================================================================== --- src/insets/InsetCollapsable.cpp (revision 21001) +++ src/insets/InsetCollapsable.cpp (working copy) @@ -634,7 +634,10 @@ os << from_utf8(layout_.latexparam); } } - int i = InsetText::latex(buf, os, runparams); + OutputParams rp = runparams; + if (layout_.verbatim) + rp.verbatim = true; + int i = InsetText::latex(buf, os, rp); if (!layout_.latexname.empty()) { if (layout_.latextype == "command") { os << "}"; Index: lib/layouts/stdinsets.inc =================================================================== --- lib/layouts/stdinsets.inc (revision 20941) +++ lib/layouts/stdinsets.inc (working copy) @@ -118,12 +118,14 @@ Font Color Green Size Small + Family Typewriter EndFont LabelFont Color Green Size Small EndFont MultiPar false + Verbatim true End InsetLayout Box Index: lib/layouts/url.module =================================================================== --- lib/layouts/url.module (revision 21075) +++ lib/layouts/url.module (working copy) @@ -8,11 +8,15 @@ LatexName url Decoration minimalistic LabelString URL + Verbatim true Font Family Typewriter + Color Blue EndFont LabelFont Family Typewriter + Color Blue + Size Small EndFont Preamble \usepackage{url}