[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: narrow-to-here-document
From: |
David Kastrup |
Subject: |
Re: narrow-to-here-document |
Date: |
21 Jun 2003 10:01:31 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
"Stephen J. Turnbull" <address@hidden> writes:
> >>>>> "Masatake" == Masatake YAMATO <address@hidden> writes:
>
> >> But are there any other modes with here-docs?
>
> Masatake> As far as I know ruby lang has "here document".
> Masatake> ruby-mode doesn't handle here document region now.
>
> Any language (Python or Emacs-Lisp, for examples) with multi-line
> strings effectively has here-docs. My version of Emacs doesn't
> support either narrow-to-string or mark-string AFAICT, so maybe this
> would be a good time to add those, too.
TeX is one particular contestant. There are forms of "Literate
Programming" with a heavy mixture of code and comments, but every
reference manual contains C code passages, shell scripts and similar
stuff. An excerpt:
<snip>
%
That way, several specialized sort routines may be defined with
different names in the same module. C++ templates the ugly way.
\begin{lstlisting}{listsort.c}
listptr *listsort(listptr *head, /* pointer to head of list */
size_t n, /* number of elements to sort */
size_t linkoffs, /* offset of link in structure */
int (*compar)(const void *, const void *)
/* comparison routine */
)
{
\end{lstlisting}
%
The body will have to start with a few declarations.
\begin{lstlisting}{listsort.c}
size_t underpow,n1,n2,bitrev;
int lev, kmax;
</snip>
You get the drift. And inside of those passages, indentation and
editing should reign that is governed by C mode. In essence, what
would be best is if editing effectively could happen in a virtual
buffer constituted of all the code passages in C, with C indentation
over the continued passages, and keybindings.
Literate programming can even mean TeX immersed into TeX: so-called
dtx documents look like this:
%\begin{macro}{\PreviewSnarfEnvironment}
% This is a nuisance since we have to advise \emph{both} the
% environment and its end.
% \begin{macrocode}
\newcommand{\PreviewSnarfEnvironment}[2][]{%
address@hidden
\csname address@hidden@endparse}%
address@hidden
\csname end#2\endcsname{\endgroup}}
%</!active>
% \end{macrocode}
%\end{macro}
address@hidden
address@hidden
% Ok, this looks complicated, but we have to start a group in order
% to be able to hook address@hidden into the game only when
Again, indentation and other context (environment open and closing,
something akin to verbose brace matching) should effectually happen in
virtual buffers that contain only a selected subset of the file in
question.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
- narrow-to-here-document, Masatake YAMATO, 2003/06/20
- Re: narrow-to-here-document, Kevin Rodgers, 2003/06/23
- Re: narrow-to-here-document, Masatake YAMATO, 2003/06/25
- Re: narrow-to-here-document, David Kastrup, 2003/06/25
- Re: narrow-to-here-document, Masatake YAMATO, 2003/06/25
- Re: narrow-to-here-document, Kim F. Storm, 2003/06/25
- Re: narrow-to-here-document, Richard Stallman, 2003/06/26
- Re: narrow-to-here-document, Stefan Daschek, 2003/06/25