From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Exporting blocks without removing indentation Date: Wed, 28 Oct 2009 09:29:03 -0400 Message-ID: <87ljivlk9s.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N38aQ-0002Vu-4h for emacs-orgmode@gnu.org; Wed, 28 Oct 2009 09:29:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N38aL-0002VO-DE for emacs-orgmode@gnu.org; Wed, 28 Oct 2009 09:29:13 -0400 Received: from [199.232.76.173] (port=41923 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N38aL-0002VL-9U for emacs-orgmode@gnu.org; Wed, 28 Oct 2009 09:29:09 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:36561) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N38aK-0006sl-Qr for emacs-orgmode@gnu.org; Wed, 28 Oct 2009 09:29:09 -0400 Received: from blackcap.stats.ox.ac.uk (blackcap.stats [163.1.210.5]) by markov.stats.ox.ac.uk (8.13.6/8.13.6) with ESMTP id n9SDT6FU024415 for ; Wed, 28 Oct 2009 13:29:06 GMT 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: emacs org-mode mailing list Fairly late in the export process, org-exp removes the common indentation from lines inside blocks (line 2288 of org-exp.el): (setq rtn (org-remove-indentation code)) However, what do we do if 1. A user has a block that she wishes to export with the indentation intact? 2. An org-exp-blocks plugin has a block that it wishes to export with the indentation intact? I propose that we make (1) and (2) possible. An example where (1) arises is if, when documenting a moderately complex program, different parts of a class or function are contained in separate blocks. Q1. Is that aim approved of? (2) is a bit trickier than (1). To solve (1), we could introduce a fix in org-exp.el like - (setq rtn (org-remove-indentation code)) + (setq rtn (if org-src-preserve-indentation code + (org-remove-indentation code))) However in solving (2) the plugin cannot assume that the variable org-src-preserve-indentation is in effect (in fact it very likely isn't). So we need to come up with a way in which the block resulting from an org-exp-blocks plugin can have its indentation survive through to the export product, even if org-src-preserve-indentation is globally nil. Two possibilities are 1. We adopt a convention whereby if all lines start with some character (say ,) then that character is removed (but the remaining indentation is left intact.) 2. We transplant the indentation-removing work from org-exp.el into org-exp-blocks.el, and arrange that it is only performed if the block is *not* handled by an org-exp-blocks plugin. Q2. Has this made sense? What solution do you suggest? Q3. Should we use org-src-preserve-indentation in this way to affect export? (It currently has effect when switching between the org buffer and the code edit buffer.) Dan