emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Babel code indentation problem
@ 2016-03-03  8:01 Jarmo Hurri
  2016-03-03 10:14 ` Eric S Fraga
  0 siblings, 1 reply; 3+ messages in thread
From: Jarmo Hurri @ 2016-03-03  8:01 UTC (permalink / raw)
  To: emacs-orgmode


Greetings.

I would appreciate help in fixing a Babel indentation problem.  I
recently added support for Processing programming language in Babel. It
is working very nicely except for an indentation problem I ran into.

The Org snippet below shows two basically indentical code blocks, one in
C and the other in Processing. When I edit the code blocks with "C-c '"
and return to the Org file, the C code indents correctly, while the
Processing code doesn't. To be more specific, one line doesn't, and the
line is indicated in the file.

# ------------------------------------------------------------------
* Example with C
  #+BEGIN_SRC c
    #include <stdlib.h>

    int main (int argc, char* argv[])
    {
        int a = 0, b = 0;

        while (a == 0)
        {
            if (a == 0)
            {
                if (b == 0)
                    a++; /* this line indents correctly */
            }
        }
        exit (0);
    }
  #+END_SRC
* Example with Processing
  #+BEGIN_SRC processing
    size (400, 400);

    int a = 0, b = 0;

    while (a == 0)
    {
      if (a == 0)
      {
        if (b == 0)
  	a++; // while this one doesn't
      }
    }
  #+END_SRC
# ------------------------------------------------------------------

Now when I edit the Processing code with "C-c '", go to the problematic
line and press tab, the line is indented correctly:

----------------------------------------------------------------------
size (400, 400);

int a = 0, b = 0;

while (a == 0)
{
  if (a == 0)
  {
    if (b == 0)
      a++; // while this one doesn't
  }
}
----------------------------------------------------------------------

So the problem is not in indentation in Processing mode itself, but the
error appears upon return from editing. This suggests that the issue 
is in the communication between the editing mode and Org mode. As you
can see, I have different indentation settings for C and Processing, so
that might be one thing that makes the difference appear.

The incorrect indentation carries over to, for example, exported files.

Any ideas on how I would start fixing this?

Jarmo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-03 10:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-03  8:01 Babel code indentation problem Jarmo Hurri
2016-03-03 10:14 ` Eric S Fraga
2016-03-03 10:50   ` Jarmo Hurri

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).