emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Pontus Michael <m.pontus@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Source block fontification handling indentation
Date: Wed, 26 Mar 2014 01:59:53 +0400	[thread overview]
Message-ID: <CAPpfmHKduNiQZDq4PsEq_4qVw-9tixngrbRZt8HJtQaFnz3_cw@mail.gmail.com> (raw)
In-Reply-To: <87eh1wdkpe.fsf@bzg.ath.cx>


[-- Attachment #1.1: Type: text/plain, Size: 1830 bytes --]

Source block fontification is achieved by copying source block contents
into temporary buffer under appropriate major mode and mirroring face
text-properties into original buffer.

Problem is that this procedure doesn't account for user option
`org-edit-src-content-indentation'. This option adds decorative indentation
to contents of source block after editing with command `org-edit-src-code'.

Correct behavior would be to strip this indentation in order to access the
actual actual source block content. This behavior can be observed during
expansion and during execution of `org-edit-src-code'.

However, when function `org-src-font-lock-fontify-block' copies contents of
src block into temporary buffer it leaves the indentation present.
Beginning whitespace can be significant to some languages semantics and
major-mode fontification  routines.

I have attached a file which will let you see examples of both correct and
incorrect behavior.


On 21 March 2014 12:23, Bastien <bzg@gnu.org> wrote:

> Hi Michael,
>
> thanks for the patch.
>
> Pontus Michael <m.pontus@gmail.com> writes:
>
> > Primary reason for this change is to fix the problem which I describe
> > as
> > follows:
> >
> > This function is not 100% compatible with a org-edit-src facility,
> > which provides an option to have indentation added to the code inside
> > the block after using command `org-edit-src-code' to edit it. This
> > command also handles removal of indentation upon insertion of the
> > code
> > in temporary buffer where editing of the code will in relevant
> > major-mode.
>
> I'm not sure I understand what the real problem is.
>
> Can you describe it against the behavior of the current version?
> And maybe provide a minimal recipe to reproduce it?
>
> Did you catch any side-effect of your patch?
>
> Thanks,
>
> --
>  Bastien
>

[-- Attachment #1.2: Type: text/html, Size: 2495 bytes --]

[-- Attachment #2: fontification-example.org --]
[-- Type: application/vnd.lotus-organizer, Size: 3901 bytes --]

  reply	other threads:[~2014-03-25 21:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26 16:38 [PATCH] Source block fontification handling indentation Pontus Michael
2014-03-21  8:23 ` Bastien
2014-03-25 21:59   ` Pontus Michael [this message]
2014-03-26 10:07     ` Bastien
2014-03-25 22:11   ` Pontus Michael

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=CAPpfmHKduNiQZDq4PsEq_4qVw-9tixngrbRZt8HJtQaFnz3_cw@mail.gmail.com \
    --to=m.pontus@gmail.com \
    --cc=bzg@gnu.org \
    --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).