unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David.Kastrup@t-online.de (David Kastrup)
Cc: emacs-devel@gnu.org
Subject: Re: narrow-to-here-document
Date: 21 Jun 2003 10:01:31 +0200	[thread overview]
Message-ID: <x5znkbn9k4.fsf@lola.goethe.zz> (raw)
In-Reply-To: <87brwrvr3g.fsf@tleepslib.sk.tsukuba.ac.jp>

"Stephen J. Turnbull" <stephen@xemacs.org> writes:

> >>>>> "Masatake" == Masatake YAMATO <jet@gyve.org> 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][]{%
  \expandafter\pr@advise
   \csname #2\endcsname{\pr@snarfafter#1\pr@endparse}%
 \expandafter\pr@advise
   \csname end#2\endcsname{\endgroup}}
%</!active>
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\pr@snarfafter}
%\begin{macro}{\pr@startsnarf}
%  Ok, this looks complicated, but we have to start a group in order
%  to be able to hook \cmd{\pr@endbox} 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

  reply	other threads:[~2003-06-21  8:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-20 13:59 narrow-to-here-document Masatake YAMATO
2003-06-20 14:10 ` narrow-to-here-document Ilya Zakharevich
2003-06-20 16:26   ` narrow-to-here-document Masatake YAMATO
2003-06-21  7:15     ` narrow-to-here-document Stephen J. Turnbull
2003-06-21  8:01       ` David Kastrup [this message]
2003-06-21 14:19         ` narrow-to-here-document Ilya Zakharevich
2003-06-21 14:48           ` narrow-to-here-document David Kastrup
2003-06-22  8:33             ` narrow-to-here-document Ilya Zakharevich
2003-06-23 17:10     ` narrow-to-here-document Kevin Rodgers
2003-06-25  6:10       ` narrow-to-here-document Masatake YAMATO
2003-06-25  8:04         ` narrow-to-here-document David Kastrup
2003-06-25  8:21           ` narrow-to-here-document Masatake YAMATO
2003-06-26  0:34             ` narrow-to-here-document Kim F. Storm
2003-06-26  5:30             ` narrow-to-here-document Richard Stallman
2003-06-25 23:18           ` narrow-to-here-document Stefan Daschek
2003-06-26  5:59             ` mmm-mode.el(Re: narrow-to-here-document) Masatake YAMATO
2003-06-26  6:12             ` narrow-to-here-document David Kastrup
2003-06-26 13:00               ` narrow-to-here-document Alan Shutko
2003-06-30  0:34                 ` narrow-to-here-document Miles Bader
2003-06-30  6:13                 ` narrow-to-here-document Kai Großjohann
2003-06-30 17:19                   ` narrow-to-here-document David Kastrup
2003-06-30 20:11                     ` narrow-to-here-document Kai Großjohann
2003-07-04  0:07                       ` narrow-to-here-document Stefan Monnier
2003-07-04  6:46                         ` narrow-to-here-document Kai Großjohann
2003-07-01 15:17                   ` narrow-to-here-document Richard Stallman
2003-07-04  0:32                     ` narrow-to-here-document Stefan Monnier
2003-07-07 23:45                       ` [MMM] narrow-to-here-document Michael A. Shulman
2003-07-08  7:19                         ` Kai Großjohann
2003-07-10 16:44                           ` Richard Stallman
2003-07-08 14:12                         ` mmm-mode needs (was: narrow-to-here-document) Stefan Monnier
2003-07-08 20:02                         ` [MMM] Re: narrow-to-here-document Richard Stallman
2003-06-25 16:58         ` narrow-to-here-document Kevin Rodgers
     [not found] ` <20030625.143750.116352160.jet@gyve.org>
2003-06-26  5:29   ` narrow-to-here-document Richard Stallman
2003-06-26  7:19     ` narrow-to-here-document Miles Bader
2003-06-26 17:45       ` narrow-to-here-document Tak Ota
2003-06-26 23:10         ` narrow-to-here-document David Kastrup
2003-06-27  2:07         ` narrow-to-here-document Miles Bader
2003-06-27  2:49       ` narrow-to-here-document Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x5znkbn9k4.fsf@lola.goethe.zz \
    --to=david.kastrup@t-online.de \
    --cc=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).