emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Behavior of org-adapt-indentation [9.4.6 (9.4.6-10-gee652a-elpa @ /home/fsantos/.emacs.d/elpa/org-20210705/)]
@ 2021-07-07  6:35 Frédéric Santos
  2021-08-31 15:59 ` Timothy
  0 siblings, 1 reply; 2+ messages in thread
From: Frédéric Santos @ 2021-07-07  6:35 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

This might not be *really* a bug, but since a recent update of Org, I
noticed an unwanted indentation of code blocks when the variable
org-adapt-indentation is set to 'headline-data. It can be reproduced
with this very minimal org config:

(use-package org
  :config
  (require 'org-tempo)
  (setq org-adapt-indentation 'headline-data))

In an org buffer, create a headline, and then:

1. Type some text which does *not* follow an empty line an press TAB:
    nothing happens (which is the expected behavior).
2. Type some text which does follow an empty line an hit TAB: this text
    gets indented according to the current headline level (the help page
    looks unclear to me: it might also be the expected behavior,
    although I don't really understand the rationale for it).

Point 2. has a side effect: when you still use the old template
expansion mechanism for code blocks (the one provided by org-tempo.el,
e.g. type <s and then hit TAB to expand a template), those code blocks
now get indented according to the headline level (because you press TAB,
I guess). I think it's not the expected behavior, since those code
blocks that follow an empty line will have a different indentation than
the text before and after them.

Here is an animated gif to better illustrate what I mean:
https://www.zupimages.net/up/21/26/8b3n.gif

Is there a workaround to avoid this indentation of code blocks?

All the best,
Frédéric

==
Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4)
 of 2021-03-26
Package: Org mode version 9.4.6 (9.4.6-10-gee652a-elpa @ /home/fsantos/.emacs.d/elpa/org-20210705/)


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

* Re: Bug: Behavior of org-adapt-indentation [9.4.6 (9.4.6-10-gee652a-elpa @ /home/fsantos/.emacs.d/elpa/org-20210705/)]
  2021-07-07  6:35 Bug: Behavior of org-adapt-indentation [9.4.6 (9.4.6-10-gee652a-elpa @ /home/fsantos/.emacs.d/elpa/org-20210705/)] Frédéric Santos
@ 2021-08-31 15:59 ` Timothy
  0 siblings, 0 replies; 2+ messages in thread
From: Timothy @ 2021-08-31 15:59 UTC (permalink / raw)
  To: Frédéric Santos; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2022 bytes --]

Hi Frédéric,

I tried to reproduce with emacs -Q but I had no luck (see the image attached).
Could you give emacs -Q a go and let us know how it goes?

Frédéric Santos <frederic.santos@u-bordeaux.fr> writes:

> Hi!
>
> This might not be *really* a bug, but since a recent update of Org, I
> noticed an unwanted indentation of code blocks when the variable
> org-adapt-indentation is set to ’headline-data. It can be reproduced
> with this very minimal org config:
>
> (use-package org
>   :config
>   (require ’org-tempo)
>   (setq org-adapt-indentation ’headline-data))
>
> In an org buffer, create a headline, and then:
>
> 1. Type some text which does *not* follow an empty line an press TAB:
>     nothing happens (which is the expected behavior).
> 2. Type some text which does follow an empty line an hit TAB: this text
>     gets indented according to the current headline level (the help page
>     looks unclear to me: it might also be the expected behavior,
>     although I don’t really understand the rationale for it).
>
> Point 2. has a side effect: when you still use the old template
> expansion mechanism for code blocks (the one provided by org-tempo.el,
> e.g. type <s and then hit TAB to expand a template), those code blocks
> now get indented according to the headline level (because you press TAB,
> I guess). I think it’s not the expected behavior, since those code
> blocks that follow an empty line will have a different indentation than
> the text before and after them.
>
> Here is an animated gif to better illustrate what I mean:
> <https://www.zupimages.net/up/21/26/8b3n.gif>
>
> Is there a workaround to avoid this indentation of code blocks?
>
> All the best,
> Frédéric
>
> ==
> Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4)
>  of 2021-03-26
> Package: Org mode version 9.4.6 (9.4.6-10-gee652a-elpa @ /home/fsantos/.emacs.d/elpa/org-20210705/)

All the best,
Timothy

[-- Attachment #2: org-indent-Q.png --]
[-- Type: image/png, Size: 17233 bytes --]

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

end of thread, other threads:[~2021-08-31 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07  6:35 Bug: Behavior of org-adapt-indentation [9.4.6 (9.4.6-10-gee652a-elpa @ /home/fsantos/.emacs.d/elpa/org-20210705/)] Frédéric Santos
2021-08-31 15:59 ` Timothy

Code repositories for project(s) associated with this 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 NNTP newsgroup(s).