* 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
* Re: Babel code indentation problem
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
0 siblings, 1 reply; 3+ messages in thread
From: Eric S Fraga @ 2016-03-03 10:14 UTC (permalink / raw
To: Jarmo Hurri; +Cc: emacs-orgmode
On Thursday, 3 Mar 2016 at 10:01, Jarmo Hurri wrote:
[...]
> 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.
I think it is because you are using TABs to indent instead of spaces and
therefore the indentation doesn't look right in the org mode view. You
can tell emacs to not use tabs to indent and I think this will sort your
problem out.
--
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.91.1, Org release_8.3.3-456-g164555
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Babel code indentation problem
2016-03-03 10:14 ` Eric S Fraga
@ 2016-03-03 10:50 ` Jarmo Hurri
0 siblings, 0 replies; 3+ messages in thread
From: Jarmo Hurri @ 2016-03-03 10:50 UTC (permalink / raw
To: emacs-orgmode
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> On Thursday, 3 Mar 2016 at 10:01, Jarmo Hurri wrote:
>
> [...]
>
>> 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.
>
> I think it is because you are using TABs to indent instead of spaces
> and therefore the indentation doesn't look right in the org mode view.
> You can tell emacs to not use tabs to indent and I think this will
> sort your problem out.
Yes! Problem solved with
(setq-default indent-tabs-mode nil)
Thank you very much!
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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.