auctex-devel
[Top][All Lists]

## Re: [AUCTeX-devel] Ok, I am too stupid to make this work.

 From: David Kastrup Subject: Re: [AUCTeX-devel] Ok, I am too stupid to make this work. Date: Sat, 02 Jul 2005 17:13:06 +0200 User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Ralf Angeli <address@hidden> writes:

> * David Kastrup (2005-07-02) writes:
>
>> a) a macrocode environment has its begin/end lines _always_
>> outcommented by single comment characters, regardless of where one
>> calls C-c C-e.
>
> Theoretically there could be environments called macrocode' in
> "regular" LaTeX as well, right?

None of our business.  The only "macrocode" environment defined in the
whole texmf tree AFAIK is the one in doc.sty, and that requires to be
ended by

%    \end{macrocode}

It is in theory somewhat possible to _start_ it in a percentless line
with just \begin{macrocode} and an arbitrary indentation, but people
that want to do this sort of unmatched delimiters for whatever weird
reason don't need to expect special support from AUCTeX for it.
AUCTeX should cater for existing rather than imaginary usage cases.

And it _is_ an existing usage to just mark out some existing code
passage in the middle of straight uncommented code without percent
signs with an active region and use C-c C-e macrocode RET on it.

>> b) inside of the macrocode environment, no comment characters should
>> be inserted automatically at all, regardless of whether there was an
>> active region at the start or not.
>> c) it is a bad idea to call LaTeX-fill-environment instead of
>> LaTeX-fill-region if we already know where the environment starts and
>> ends, since LaTeX-fill-environment might be confused about start and
>> end.
>
> Sounds sensible.
>
>> d) after calling C-c C-e on an active region, point and mark should be
>> left close to where they were before.
>
> Do you remember the discussion we had about this before?  I gave up
> on this, see
> <URL:http://article.gmane.org/gmane.emacs.latex.preview.bugs/688>.

But just exchange-point-and-mark should not touch the mark stack,
right?

>> Unfortunately, this patch does not work at all and I am missing the
>> respective clue to fix it.
>
> What aspect of the patch doesn't work?

Pretty much everything.  Using C-c C-e macrocode outside of comments
makes a completely uncommented macrocode environment, indented by two
spaces in the middle, like

\documentclass[12pt,a4paper]{article}

\begin{document}
\begin{macrocode}
<-point is left here.
\end{macrocode}
\end{document}

Of course, this is nonsense.

\documentclass[12pt,a4paper]{article}

\begin{document}
%<- point is here
\end{document}

and do C-c C-e macrocode RET, I get

\documentclass[12pt,a4paper]{article}

\begin{document}
%    \begin{macrocode}

\end{macrocode}
\end{document}

If I start with an active region like

\documentclass[12pt,a4paper]{article}

\begin{document}
<mark>This is some code
I want as macrocode<point>
\end{document}

I get

\documentclass[12pt,a4paper]{article}

\begin{document}
\begin{macrocode}
This is some code I want as macrocode
\end{macrocode}
\end{document}

\documentclass[12pt,a4paper]{article}

\begin{document}
%<mark>
This is some code I want as macrocode<point>
\end{document}

I get

\documentclass[12pt,a4paper]{article}

\begin{document}
%    \begin{macrocode}

This is some code I want as macrocode
\end{macrocode}
\end{document}

All of this is complete nonsense.

Though not as nonsensical as the purely lunatic effect of using a
non-active region and starting with

\documentclass[12pt,a4paper]{article}

\begin{document}
<point>%
\end{document}

for which C-c C-e macrocode RET results in

\documentclass[12pt,a4paper]{article}

\begin{document}
\begin{macrocode}
%
\end{macrocode}%
\end{document}

It does not get any worse than that.

--
David Kastrup, Kriemhildstr. 15, 44793 Bochum

`

reply via email to