emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: did behaviour of RET change again?


From: Kévin Le Gouguec
Subject: Re: did behaviour of RET change again?
Date: Mon, 21 Dec 2020 12:34:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Bastien <bzg@gnu.org> writes:

> I see something wrong right now: RET after a headline should only try
> to indent below the beginning of the headline with org-adapt-indentation 
> is t, but not nil or headline-data.
>
> For now, when org-adapt-indentation is headline-data, RET still indents.
>
> I will see how to fix this.
>
> Also, I'm thinking of using headline-data as the new default for the
> org-adapt-indentation option.  WDYT?

I personally agree that headline-data makes more sense as a default
given the feedback we received a few weeks ago; as you noticed though
there might be a few loose ends to tie up before making the switch:

- As you said, RET after a headline indents, but the common case for
  hitting RET after a headline is probably to write text, since IME
  headline drawers are always inserted with dedicated commands; thus RET
  should not indent after a header.

- RET after a headline drawer's :END: also indents.

- RET in a list item does not indent; it's not obvious that it should,
  but FWIW (1) RET indents when org-adapt-indentation is t (2) that
  would be my preference.

Also, Greg Minshall (CC'ed) helpfully laid out how org-adapt-indentation
and electric-indent-mode play together in one neat table:

https://orgmode.org/list/2020-11-13T18-23-43@devnull.Karl-Voit.at/t/#mec37faab85f3de59e25a7c1640e5f50be5494192

I didn't take the time to properly review his findings, but there might
be more inconsistencies lurking in there.

Finally, not a big problem if headline-data becomes the default, but:
the :safe predicate is still booleanp.  Patch attached:

>From fd8dab0c42d7104566437b51526b25979f1056fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@gmail.com>
Date: Mon, 21 Dec 2020 12:09:56 +0100
Subject: [PATCH] * lisp/org.el (org-adapt-indentation): Mark 'headline-data as
 safe

---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 1f7e434ce..f75745aba 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1610,7 +1610,7 @@ time in Emacs."
          (const :tag "Adapt indentation for headline data lines"
                 'headline-data)
          (const :tag "Do not adapt indentation at all" nil))
-  :safe #'booleanp)
+  :safe (lambda (x) (memq x '(t nil headline-data))))
 
 (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)
 
-- 
2.29.2


Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Just to say that RET seems to be working again.  No idea what happened
> or changed, mind you...  Sorry for the noise.

Glad things fell back in place somehow.  The only explanation I can
conjure for weird/transient/irreproducible behaviour is directory-local
settings, e.g. org-mode.git's .dir-locals.el sets org-adapt-indentation
to nil… but there might have been something else at work in your case 🤷

reply via email to

[Prev in Thread] Current Thread [Next in Thread]