From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David.Kastrup@t-online.de (David Kastrup) Newsgroups: gmane.emacs.devel Subject: Re: narrow-to-here-document Date: 21 Jun 2003 10:01:31 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <20030620.225909.39171959.jet@gyve.org> <20030620141028.GA1331@math.berkeley.edu> <20030621.012632.74543482.jet@gyve.org> <87brwrvr3g.fsf@tleepslib.sk.tsukuba.ac.jp> Reply-To: dak@gnu.org NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1056182603 28335 80.91.224.249 (21 Jun 2003 08:03:23 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 21 Jun 2003 08:03:23 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Jun 21 10:03:20 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19TdLE-0007Ms-00 for ; Sat, 21 Jun 2003 10:03:20 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19TdND-0004DO-00 for ; Sat, 21 Jun 2003 10:05:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19TdKH-0004Ws-E5 for emacs-devel@quimby.gnus.org; Sat, 21 Jun 2003 04:02:21 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19TdJz-0004SX-IC for emacs-devel@gnu.org; Sat, 21 Jun 2003 04:02:03 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19TdJx-0004R5-VW for emacs-devel@gnu.org; Sat, 21 Jun 2003 04:02:02 -0400 Original-Received: from mailout07.sul.t-online.com ([194.25.134.83]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19TdJu-0004If-Ih for emacs-devel@gnu.org; Sat, 21 Jun 2003 04:01:58 -0400 Original-Received: from fwd05.aul.t-online.de by mailout07.sul.t-online.com with smtp id 19TdJl-00063x-09; Sat, 21 Jun 2003 10:01:49 +0200 Original-Received: from localhost.localdomain (SUrcjGZXge85fpsFnOY-xgG5CA6GtLFDbjKhzrq7XJ1oO+OpQOFZ8m@[62.226.12.178]) by fwd05.sul.t-online.com with esmtp id 19TdJg-26mxEG0; Sat, 21 Jun 2003 10:01:44 +0200 Original-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h5L81a8U007625; Sat, 21 Jun 2003 10:01:40 +0200 Original-Received: (from dak@localhost) by localhost.localdomain (8.12.8/8.12.8/Submit) id h5L81WtL007621; Sat, 21 Jun 2003 10:01:32 +0200 Original-To: "Stephen J. Turnbull" In-Reply-To: <87brwrvr3g.fsf@tleepslib.sk.tsukuba.ac.jp> Original-Lines: 75 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-Seen: false X-ID: SUrcjGZXge85fpsFnOY-xgG5CA6GtLFDbjKhzrq7XJ1oO+OpQOFZ8m@t-dialin.net Original-cc: ilya@Math.Berkeley.EDU Original-cc: cperl@ilyaz.org Original-cc: Masatake YAMATO X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:15180 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15180 "Stephen J. Turnbull" writes: > >>>>> "Masatake" == Masatake YAMATO 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: % 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; 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}} % % \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