emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: emacs org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Exporting blocks without removing indentation
Date: Wed, 28 Oct 2009 09:29:03 -0400	[thread overview]
Message-ID: <87ljivlk9s.fsf@stats.ox.ac.uk> (raw)

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

             reply	other threads:[~2009-10-28 13:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-28 13:29 Dan Davison [this message]
2009-10-28 15:54 ` Exporting blocks without removing indentation Carsten Dominik
2009-10-28 18:14   ` Samuel Wales
2009-11-01  1:36   ` Dan Davison
2009-11-01  7:53     ` Carsten Dominik
2009-11-01 14:44       ` Dan Davison

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87ljivlk9s.fsf@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=emacs-orgmode@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/org-mode.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).