From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Re: Limited #+INCLUDE ? Date: Mon, 26 Apr 2010 15:40:35 -0400 Message-ID: <87eii26lzg.fsf@stats.ox.ac.uk> References: <874oj2v2a6.fsf@tandberg.com> <87k4ruy5pd.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O6UAf-0000yh-0Y for emacs-orgmode@gnu.org; Mon, 26 Apr 2010 15:40:45 -0400 Received: from [140.186.70.92] (port=33570 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6UAd-0000xA-B6 for emacs-orgmode@gnu.org; Mon, 26 Apr 2010 15:40:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O6UAb-00087h-Gb for emacs-orgmode@gnu.org; Mon, 26 Apr 2010 15:40:43 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:39087) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6UAb-00087F-9X for emacs-orgmode@gnu.org; Mon, 26 Apr 2010 15:40:41 -0400 In-Reply-To: <87k4ruy5pd.fsf@mundaneum.com> (=?utf-8?Q?=22S=C3=A9bastien?= Vauban"'s message of "Mon, 26 Apr 2010 10:32:30 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?S=C3=A9bastien?= Vauban Cc: emacs-orgmode@gnu.org, Giles Chamberlin S=C3=A9bastien Vauban writes: > Hi Giles, > > Giles Chamberlin wrote: >> I've been using org-mode for some course work: "write an essay about >> your software including the interesting bits, add all source code in an >> appendix". >> >> #+INCLUDE solves the inclusion of source code files very nicely - I'm=20 >> guaranteed that my document includes the latest versions, type set as I >> wish. >> >> Unfortunately at the moment I'm cutting and pasting the snippets of >> "interesting" code into the body of the essay. What I'd like to do is >> be able to label interesting regions of code in the source file and then >> import the labelled blocks into my essay. Is there a way of doing this? > > Have a look at Org-Babel. > > Though, it means your source code would be *inside* your Org document, an= d you > would have to "tangle" it (generate it) from there. > > Seb I'm considering investigating the following and would appreciate comments on this idea. The aim is to make it easier to use Org-mode to work pure code files which are *external to Org-mode* (i.e. this proposal lies outside of the current org-babel tangling framework). - Extend Org file links to allow links to a range of lines in a file. The syntax could be [[file:/path/to/file::from::to][linkname]] - These links will bring up a buffer visiting the target file, narrowed to the target region. - The link back in the Org-mode file can be adjusted from the target file, by widening and then narrowing again. (During this procedure the target region would be highlighted.) - Export to HTML and LaTeX will have the ability to include the target regions, fontified according to the appropriate major-mode, similar to how begin_src blocks behave on export. - 'from' and 'to' could be line numbers, or regexps for text search. For programmers, this would allow a sort of org-mode mediated literate programming in projects where it is not feasible/desirable to actually include the source code in the org-mode file. Any comments or suggestions? Dan