emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] org.el: Preserve indentation of manually indented lines


From: Valentin Wüstholz
Subject: Re: [O] [PATCH] org.el: Preserve indentation of manually indented lines in example blocks.
Date: Tue, 9 Aug 2011 14:10:51 +0200

Hi Nicolas.


On Tue, Aug 9, 2011 at 11:18 AM, Nicolas Goaziou <address@hidden> wrote:
> Hello,
>
> Valentin Wüstholz <address@hidden> writes:
>
>> Sure. At least four use cases come to my mind for this: (a) literal
>> console output, (b) blocks of pseudo code (can't really use SRC blocks
>> since there is no actual language for this), (c) blocks of source code
>> in experimental or little known programming languages (ditto), and (d)
>> sketches of mathematical proofs or computations where you don't want
>> to mess with LaTeX typesetting (yet).
>
> I see (even though #d sounds strange).
>
>>>> What potential hassle were you thinking of?
>>>
>>> Being left with no more literal markup automatically indented. It's not
>>> that your idea is bad, but there could be users appreciating the current
>>> feature.
>>
>> I certainly thought about existing users, which is why by default
>> lines are is still indented like before. If you care about automatic
>> indentation, your example blocks are already indented like the
>> delimiters and the new behaviour keeps it just like that. If you
>> previously chose to indent you blocks differently, the new behaviour
>> will respect that decision by not messing with your indentation.
>
> Both situations are different from an user perspective.
>
> With the current behaviour, the only annoyance you encounter is that you
> cannot indent the whole buffer (or a region containing the block)
> automatically. But nothing prevents you from writing (and exporting)
> arbitrarily indented code. Sure, you won't get any indenting help in the
> process but it's the same as in your proposal. So all you have to do is
> basically refraining from using a global indentation tool.
>
> In your proposal, you still can write text with no indenting help. You
> can now indent the whole buffer, too. But there's one major problem.
> Suppose that you paste some badly indented text (from an external
> source) into an example block. You want to indent it properly... but
> it's now impossible. You have to fix indentation manually, line by line.


I would argue, that most of the time when you copy something from an
external source into an example block, you want to preserve the
indentation and formatting. At least that's my understanding of what
/literal/ examples should give you. Besides, you don't need to fix
each line separately: simply removing the indentation and
auto-indenting the block will get you the desired results.

I fully agree that that's a slight change in behaviour. However, there
are simple ways of fixing the issue you pointed out /once/ (when you
past the text), whereas at the moment the default indentation is
forced on you /every time/ you want to indent a line, region or
buffer.

Obviously, this is mainly my personal view as someone that relies on
auto-indentation quite heavily. I would love to hear how other people
feel about this. If too many people don't like the new behaviour, one
could still consider adding an optional switch (like -n in SRC
blocks).


> To sum it up, in the first case, you only loose the ability to indent
> the whole buffer in one go (which isn't as bad as it sounds, since you
> can achieve that differently).


How else would you be able to achieve that?


> In the second case, you get limited in your actions as you completely loose 
> the ability to indent examples.


I don't see why you would lose the ability to indent examples. When
you write inside the block, each line will be auto-indented just like
before. Only the lines that were manually indented further to the
right, will not be reset to the default indentation. In that sense,
you become more flexible in how your example blocks can be indented.


>>> Perhaps this could be applied to verse blocks instead.
>>
>> As far as I recall verse blocks are treated somewhat differently from
>> example blocks by the exporter (e.g. verse vs verbatim in LaTeX).
>
> Indeed, but I think verses are closer to free text than examples and, as
> such, may not be subject to automatic indentation.


I might be wrong, but I believe that at least in LaTeX indentation in
verse blocks is not taken into account. This seems reasonable since
they are not typeset in a monospaced font.

Best regards,

Valentin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]