emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-adapt-indentation not honored prior to Org 9.4?
@ 2021-03-22 19:37 Mike Kupfer
  2021-03-24 14:08 ` TRS-80
  2021-03-30  3:38 ` Kyle Meyer
  0 siblings, 2 replies; 7+ messages in thread
From: Mike Kupfer @ 2021-03-22 19:37 UTC (permalink / raw)
  To: emacs-orgmode

Over the weekend I upgraded my Emacs from 27.1 (Org 9.3) to 27.2-rc2
(Org 9.4).  I noticed that Org mode behaves differently, even with
"emacs -Q".

In 27.1, if I visit foo.org and type "* header RET", point is put in the
first column.  In 27.2, point is put in column 3.

AFAIK, I'm not using electric-indent-mode; at least it's not shown in
the minor mode list in the modeline.

org-adapt-indentation is t in both Emacs 27.1 and Emacs 27.2.  Was there
a bug fix that went into Org 9.4 such that org-adapt-indentation is now
honored?  Could the change in behavior be documented in the ORG-NEWS
file in Emacs?

I already asked about this on emacs-devel; Eli Z. sent me over here.

thanks,
mike


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

* Re: org-adapt-indentation not honored prior to Org 9.4?
  2021-03-22 19:37 org-adapt-indentation not honored prior to Org 9.4? Mike Kupfer
@ 2021-03-24 14:08 ` TRS-80
  2021-03-24 14:45   ` Maxim Nikulin
  2021-03-30  3:38 ` Kyle Meyer
  1 sibling, 1 reply; 7+ messages in thread
From: TRS-80 @ 2021-03-24 14:08 UTC (permalink / raw)
  To: emacs-orgmode

On 2021-03-22 15:37, Mike Kupfer wrote:
> Over the weekend I upgraded my Emacs from 27.1 (Org 9.3) to 27.2-rc2
> (Org 9.4).  I noticed that Org mode behaves differently, even with
> "emacs -Q".
> 
> In 27.1, if I visit foo.org and type "* header RET", point is put in
> the first column.  In 27.2, point is put in column 3.
> 
> AFAIK, I'm not using electric-indent-mode; at least it's not shown
> in the minor mode list in the modeline.
> 
> org-adapt-indentation is t in both Emacs 27.1 and Emacs 27.2.  Was
> there a bug fix that went into Org 9.4 such that
> org-adapt-indentation is now honored?  Could the change in behavior
> be documented in the ORG-NEWS file in Emacs?
> 
> I already asked about this on emacs-devel; Eli Z. sent me over here.
> 
> thanks,
> mike

You are not alone, mate.  We discussed this not too long ago in the
following thread:

Turning off all indentation in 9.4.4
https://lists.gnu.org/archive/html/emacs-orgmode/2021-02/msg00045.html

In particular, the answer you seek may be in this post:

https://lists.gnu.org/archive/html/emacs-orgmode/2021-02/msg00285.html

The TL; DR of which is to turn off ~electric-indent-local-mode~ in
org-mode:

#+begin_src emacs-lisp
   (add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1)))
#+end_src

Of course, you could test live first in an Org buffer by pressing M-:
and eval:

#+begin_src emacs-lisp
   (electric-indent-local-mode -1)
#+end_src

If that does what you expect, then set up the above mode hook in your
init file.

If your expectations are slightly different to mine, hopefully there
is something in that thread that might be helpful for you.

Cheers,
TRS-80


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

* Re: org-adapt-indentation not honored prior to Org 9.4?
  2021-03-24 14:08 ` TRS-80
@ 2021-03-24 14:45   ` Maxim Nikulin
  0 siblings, 0 replies; 7+ messages in thread
From: Maxim Nikulin @ 2021-03-24 14:45 UTC (permalink / raw)
  To: emacs-orgmode

On 24/03/2021 21:08, TRS-80 wrote:
> On 2021-03-22 15:37, Mike Kupfer wrote:
>> In 27.1, if I visit foo.org and type "* header RET", point is put in
>> the first column.  In 27.2, point is put in column 3.
> 
> You are not alone, mate.  We discussed this not too long ago in the
> following thread:

There were at least one similar thread before and a discussion prior to 
the change.

The following setting was never mentioned however:
org-indent-mode-turns-off-org-adapt-indentation



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

* Re: org-adapt-indentation not honored prior to Org 9.4?
  2021-03-22 19:37 org-adapt-indentation not honored prior to Org 9.4? Mike Kupfer
  2021-03-24 14:08 ` TRS-80
@ 2021-03-30  3:38 ` Kyle Meyer
  2021-03-30  4:21   ` Tim Cross
  1 sibling, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2021-03-30  3:38 UTC (permalink / raw)
  To: Mike Kupfer; +Cc: emacs-orgmode

Mike Kupfer writes:

> Over the weekend I upgraded my Emacs from 27.1 (Org 9.3) to 27.2-rc2
> (Org 9.4).  I noticed that Org mode behaves differently, even with
> "emacs -Q".
>
> In 27.1, if I visit foo.org and type "* header RET", point is put in the
> first column.  In 27.2, point is put in column 3.
>
> AFAIK, I'm not using electric-indent-mode; at least it's not shown in
> the minor mode list in the modeline.

electric-indent-mode has been enabled by default since Emacs 24.  If you
run `C-h v electric-indent-mode` under emacs -Q, you should see that its
value is t.

> org-adapt-indentation is t in both Emacs 27.1 and Emacs 27.2.  Was there
> a bug fix that went into Org 9.4 such that org-adapt-indentation is now
> honored?

Not that I'm aware of.  However, Org was changed to respect the
electric-indent-mode value: d3e6b5800 (Make RET and C-j obey
`electric-indent-mode', 2020-05-05)

https://orgmode.org/list/877dxpazbo.fsf_-_@gmail.com/T/#u

> Could the change in behavior be documented in the ORG-NEWS
> file in Emacs?

Here's what ORG-NEWS says under the 9.4 release:

--8<---------------cut here---------------start------------->8---
*** =RET= and =C-j= now obey ~electric-indent-mode~

Since Emacs 24.4, ~electric-indent-mode~ is enabled by default.  In
most major modes, this causes =RET= to reindent the current line and
indent the new line, and =C-j= to insert a newline without indenting.

Org mode now obeys this minor mode: when ~electric-indent-mode~ is
enabled, and point is neither in a table nor on a timestamp or a link:

- =RET= (bound to ~org-return~) reindents the current line and indents
  the new line;
- =C-j= (bound to the new command ~org-return-and-maybe-indent~)
  merely inserts a newline.

To get the previous behaviour back, disable ~electric-indent-mode~
explicitly:

#+begin_src emacs-lisp
(add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1)))
#+end_src

Alternatively, if you wish to keep =RET= as the "smart-return" key,
but dislike Org's default indentation of sections, you may prefer to
customize ~org-adapt-indentation~ to either =nil= or ='headline-data=.
--8<---------------cut here---------------end--------------->8---


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

* Re: org-adapt-indentation not honored prior to Org 9.4?
  2021-03-30  3:38 ` Kyle Meyer
@ 2021-03-30  4:21   ` Tim Cross
  2021-03-31  4:14     ` Kyle Meyer
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Cross @ 2021-03-30  4:21 UTC (permalink / raw)
  To: emacs-orgmode


Kyle Meyer <kyle@kyleam.com> writes:

> Mike Kupfer writes:
>
>> Over the weekend I upgraded my Emacs from 27.1 (Org 9.3) to 27.2-rc2
>> (Org 9.4).  I noticed that Org mode behaves differently, even with
>> "emacs -Q".
>>
>> In 27.1, if I visit foo.org and type "* header RET", point is put in the
>> first column.  In 27.2, point is put in column 3.
>>
>> AFAIK, I'm not using electric-indent-mode; at least it's not shown in
>> the minor mode list in the modeline.
>
> electric-indent-mode has been enabled by default since Emacs 24.  If you
> run `C-h v electric-indent-mode` under emacs -Q, you should see that its
> value is t.
>
>> org-adapt-indentation is t in both Emacs 27.1 and Emacs 27.2.  Was there
>> a bug fix that went into Org 9.4 such that org-adapt-indentation is now
>> honored?
>
> Not that I'm aware of.  However, Org was changed to respect the
> electric-indent-mode value: d3e6b5800 (Make RET and C-j obey
> `electric-indent-mode', 2020-05-05)
>
> https://orgmode.org/list/877dxpazbo.fsf_-_@gmail.com/T/#u
>
>> Could the change in behavior be documented in the ORG-NEWS
>> file in Emacs?
>
> Here's what ORG-NEWS says under the 9.4 release:
>
> *** =RET= and =C-j= now obey ~electric-indent-mode~
>
> Since Emacs 24.4, ~electric-indent-mode~ is enabled by default.  In
> most major modes, this causes =RET= to reindent the current line and
> indent the new line, and =C-j= to insert a newline without indenting.
>
> Org mode now obeys this minor mode: when ~electric-indent-mode~ is
> enabled, and point is neither in a table nor on a timestamp or a link:
>
> - =RET= (bound to ~org-return~) reindents the current line and indents
>   the new line;
> - =C-j= (bound to the new command ~org-return-and-maybe-indent~)
>   merely inserts a newline.
>
> To get the previous behaviour back, disable ~electric-indent-mode~
> explicitly:
>
> #+begin_src emacs-lisp
> (add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1)))
> #+end_src
>
> Alternatively, if you wish to keep =RET= as the "smart-return" key,
> but dislike Org's default indentation of sections, you may prefer to
> customize ~org-adapt-indentation~ to either =nil= or ='headline-data=.

Hi Kyle,

one thing I think might help (maybe too late) would be to put the
entries for both electric-indent-mode and org-adapt-indentation so that
they are together in the release notes as they do interact with each
other and often people stop looking once they see one and not the other
(they are currently a fair 'distance' apart in the file). 

I suspect we will see a few of these as the changes an interaction
between those two things are not terribly intuitive.

-- 
Tim Cross


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

* Re: org-adapt-indentation not honored prior to Org 9.4?
  2021-03-30  4:21   ` Tim Cross
@ 2021-03-31  4:14     ` Kyle Meyer
  2021-03-31  8:53       ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2021-03-31  4:14 UTC (permalink / raw)
  To: Tim Cross; +Cc: Bastien, emacs-orgmode

Tim Cross writes:

> one thing I think might help (maybe too late) would be to put the
> entries for both electric-indent-mode and org-adapt-indentation so that
> they are together in the release notes as they do interact with each
> other and often people stop looking once they see one and not the other
> (they are currently a fair 'distance' apart in the file). 

Thanks for the suggestion.  I'm not sure that it will help, but it's
easy to do, at least in the Git repo [*], so I've done so in d017cdb0a.

[*] That of course won't be in effect for the file included with Emacs
    27.2.  It also won't be at <https://orgmode.org/Changes.html>.
    Cc'ing Bastien in case he thinks updating 9.4's Changes.html is
    worth it.


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

* Re: org-adapt-indentation not honored prior to Org 9.4?
  2021-03-31  4:14     ` Kyle Meyer
@ 2021-03-31  8:53       ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2021-03-31  8:53 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Tim Cross, emacs-orgmode

Hi,

Kyle Meyer <kyle@kyleam.com> writes:

> Tim Cross writes:
>
>> one thing I think might help (maybe too late) would be to put the
>> entries for both electric-indent-mode and org-adapt-indentation so that
>> they are together in the release notes as they do interact with each
>> other and often people stop looking once they see one and not the other
>> (they are currently a fair 'distance' apart in the file). 
>
> Thanks for the suggestion.  I'm not sure that it will help, but it's
> easy to do, at least in the Git repo [*], so I've done so in
> d017cdb0a.

Thanks for doing this.

> [*] That of course won't be in effect for the file included with Emacs
>     27.2.  It also won't be at <https://orgmode.org/Changes.html>.
>     Cc'ing Bastien in case he thinks updating 9.4's Changes.html is
>     worth it.

The overall discussion convinced me that `nil' is probably a better
default for `org-adapt-indentation' (instead of `t') so I suggest we
wait for the 9.5 changelog to promote these clarifications.  

(I generally don't like the idea of revising the changelog after the
release even if we had and may well accept exceptions.)

-- 
 Bastien


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

end of thread, other threads:[~2021-03-31  8:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-22 19:37 org-adapt-indentation not honored prior to Org 9.4? Mike Kupfer
2021-03-24 14:08 ` TRS-80
2021-03-24 14:45   ` Maxim Nikulin
2021-03-30  3:38 ` Kyle Meyer
2021-03-30  4:21   ` Tim Cross
2021-03-31  4:14     ` Kyle Meyer
2021-03-31  8:53       ` Bastien

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