emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* buffer local org-src-preserve-indentation not respected
@ 2016-12-02 21:59 David Dynerman
  2016-12-03 22:58 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: David Dynerman @ 2016-12-02 21:59 UTC (permalink / raw)
  To: emacs-orgmode

Dear list,

I'd like to report a bug. It seems that setting
org-src-preserve-indentation to true doesn't work if it's set buffer
local.

To reproduce, save the following as an org file:

#+BEGIN_SRC python :tangle preserve-indent.py
class Foo:
    bar = 5
#+END_SRC

Here is some interstitial text!

#+BEGIN_SRC python :tangle preserve-indent.py
    def __init__(self):
        self.bar = 7
#+END_SRC

Then:

1) (setq org-src-preserve-indentation nil) and tangle the file. Open
preserve-indent.py and note that def __init__ has no leading whitespace,
which means python will not recognize it as a member of Foo

2) (setq org-src-preserve-indentation t) and tangle the file. Open
preserve-indent.py and note that now def __init__ is properly
indented. This is the expected behavior.

3) (setq org-src-perserve-indentation nil), then M-x
make-variable-buffer-local and set org-src-preserve-indentation to
t. Tangle the file and open preserve-indent.py. Note that def __init__
is back to being not-indented. The expected behavior is that the
indentation would be respected, as in #2.

David

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

* Re: buffer local org-src-preserve-indentation not respected
  2016-12-02 21:59 buffer local org-src-preserve-indentation not respected David Dynerman
@ 2016-12-03 22:58 ` Nicolas Goaziou
  2016-12-07 23:58   ` David Dynerman
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2016-12-03 22:58 UTC (permalink / raw)
  To: David Dynerman; +Cc: emacs-orgmode

Hello,

David Dynerman <emperordali@block-party.net> writes:

> I'd like to report a bug. It seems that setting
> org-src-preserve-indentation to true doesn't work if it's set buffer
> local.
>
> To reproduce, save the following as an org file:
>
> #+BEGIN_SRC python :tangle preserve-indent.py
> class Foo:
>     bar = 5
> #+END_SRC
>
>
> Here is some interstitial text!
>
> #+BEGIN_SRC python :tangle preserve-indent.py
>     def __init__(self):
>         self.bar = 7
> #+END_SRC
>
> Then:
>
> 1) (setq org-src-preserve-indentation nil) and tangle the file. Open
> preserve-indent.py and note that def __init__ has no leading whitespace,
> which means python will not recognize it as a member of Foo
>
> 2) (setq org-src-preserve-indentation t) and tangle the file. Open
> preserve-indent.py and note that now def __init__ is properly
> indented. This is the expected behavior.
>
> 3) (setq org-src-perserve-indentation nil), then M-x
> make-variable-buffer-local and set org-src-preserve-indentation to
> t. Tangle the file and open preserve-indent.py. Note that def __init__
> is back to being not-indented. The expected behavior is that the
> indentation would be respected, as in #2.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou

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

* Re: buffer local org-src-preserve-indentation not respected
  2016-12-03 22:58 ` Nicolas Goaziou
@ 2016-12-07 23:58   ` David Dynerman
  2016-12-09 23:22     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: David Dynerman @ 2016-12-07 23:58 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Dear Nicolas,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Fixed. Thank you.

Thank you very much.

I just tried, and I still encounter this buf on the current git code. Reproduction is the same as before:

#+BEGIN_SRC python :tangle preserve-indent.py
class Foo:
    bar = 5
#+END_SRC

Here is some interstitial text!

#+BEGIN_SRC python :tangle preserve-indent.py
    def __init__(self):
	self.bar = 7
#+END_SRC

If I globally set org-src-preserve-indentation to t, then tangle, the output file has the correct specified indentation with the second block. If I make org-src-preserve-indentation buffer local and set it to t, then the second block is tanlged without any leading indentation.

Perhaps the tangling code doesn't see the buffer local setting of org-src-preserve-indentation from the buffer being tangled?

Thank you very much for all your hard work,
David

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

* Re: buffer local org-src-preserve-indentation not respected
  2016-12-07 23:58   ` David Dynerman
@ 2016-12-09 23:22     ` Nicolas Goaziou
  2016-12-11 18:37       ` David Dynerman
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2016-12-09 23:22 UTC (permalink / raw)
  To: David Dynerman; +Cc: emacs-orgmode

Hello,

David Dynerman <emperordali@block-party.net> writes:

> I just tried, and I still encounter this buf on the current git code. Reproduction is the same as before:
>
> #+BEGIN_SRC python :tangle preserve-indent.py
> class Foo:
>     bar = 5
> #+END_SRC
>
>
> Here is some interstitial text!
>
> #+BEGIN_SRC python :tangle preserve-indent.py
>     def __init__(self):
> 	self.bar = 7
> #+END_SRC
>
> If I globally set org-src-preserve-indentation to t, then tangle, the
> output file has the correct specified indentation with the second
> block. If I make org-src-preserve-indentation buffer local and set it
> to t, then the second block is tanlged without any leading
> indentation.

Fixed (hopefully) this time. Thank you for the feedback.

Regards,

-- 
Nicolas Goaziou

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

* Re: buffer local org-src-preserve-indentation not respected
  2016-12-09 23:22     ` Nicolas Goaziou
@ 2016-12-11 18:37       ` David Dynerman
  0 siblings, 0 replies; 5+ messages in thread
From: David Dynerman @ 2016-12-11 18:37 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Dear Nicolas,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Fixed (hopefully) this time. Thank you for the feedback.

It's working wonderfully now - thank you very much.

David

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

end of thread, other threads:[~2016-12-11 18:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02 21:59 buffer local org-src-preserve-indentation not respected David Dynerman
2016-12-03 22:58 ` Nicolas Goaziou
2016-12-07 23:58   ` David Dynerman
2016-12-09 23:22     ` Nicolas Goaziou
2016-12-11 18:37       ` David Dynerman

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