emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: Greg Minshall <minshall@umich.edu>,
	Emacs Org mode mailing list <emacs-orgmode@gnu.org>,
	Eric S Fraga <e.fraga@ucl.ac.uk>
Subject: Re: did behaviour of RET change again?
Date: Mon, 21 Dec 2020 12:34:54 +0100	[thread overview]
Message-ID: <87y2hr5r4x.fsf@gmail.com> (raw)
In-Reply-To: <874kkgie3e.fsf@gnu.org> (Bastien's message of "Sun, 20 Dec 2020 18:25:57 +0100")

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

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org.el-org-adapt-indentation-Mark-headline-data.patch --]
[-- Type: text/x-patch, Size: 771 bytes --]

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


[-- Attachment #3: Type: text/plain, Size: 466 bytes --]



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 🤷

  parent reply	other threads:[~2020-12-21 11:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 13:06 Eric S Fraga
2020-12-18 14:42 ` Pankaj Jangid
2020-12-18 14:59   ` Eric S Fraga
2020-12-19  4:21     ` Pankaj Jangid
2020-12-18 18:33 ` Berry, Charles via General discussions about Org-mode.
2020-12-20 17:25 ` Bastien
2020-12-20 18:56   ` Gustavo Barros
2020-12-21  8:46   ` Eric S Fraga
2020-12-21 10:25   ` Eric S Fraga
2020-12-21 11:34   ` Kévin Le Gouguec [this message]
2020-12-22 15:36   ` Kyle Meyer
2020-12-22 23:15     ` Samuel Wales
2020-12-22 23:25       ` Samuel Wales
2020-12-23 23:09         ` Tom Gillespie
2020-12-24  3:34           ` Greg Minshall
2020-12-24  6:35             ` Tom Gillespie
2020-12-25  6:29               ` Devin Prater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2hr5r4x.fsf@gmail.com \
    --to=kevin.legouguec@gmail.com \
    --cc=bzg@gnu.org \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=minshall@umich.edu \
    --subject='Re: did behaviour of RET change again?' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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 read-only IMAP folder(s) and NNTP newsgroup(s).