Org-mode mailing list
 help / color / mirror / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: Greg Minshall <minshall@umich.edu>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Changed list indentation behavior: how to revert?
Date: Tue, 17 Nov 2020 16:25:17 +1100
Message-ID: <CAC=50j_P10vDueCeJ+s8Ycja40Vy8SOE3XL7JsvO0vvLE3akhA@mail.gmail.com> (raw)
In-Reply-To: <816918.1605585811@apollo2.minshall.org>

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

Good work Greg.

My only comment is about the tests in src blocks. I'm not sure about these
as I always use the special editing mode for source blocks and I would
expect that when you do this, the editing buffer would adopt the semantics
of the native mode for the source language being edited. (I have
org-src-tab-acts-natively t in my init). Were your tests just inside a src
block in an org buffer or inside the special editing buffer?

From that table and what others have posted, I suspect many would be best
off with org-adapt-indentation set to nil or possible 'heading-data.
Personally, I've not found the change an issue, but I rarely go more than 3
or 4 levels deep in my headlines and am use to C-j to add a non-indented
line. However, I'm thinking about giving heading-data a spin as I like the
indentation for planning lines and have less of a preference for the entry
content.

Tim

On Tue, 17 Nov 2020 at 15:03, Greg Minshall <minshall@umich.edu> wrote:

> hi, Tim, et al.
>
> i started feeling guilty yesterday, partly for being party to prolonging
> this discussion (though i do think it may be important?).  but also for
> realizing i had *not* explored the alternatives Tim, Gustavo, and others
> have suggested.
>
> the following is *clearly* the department of irreproducible results.
> but, i've tried to document the effects of 'electric-indent-mode' and
> 'org-adapt-indentation' on a number of scenarios.  i present the results
> with some explanation, but without much analysis.
>
> the irreproducibility is just (afaict) a function of my not being able
> to type the same thing over and over again, and/or transcribe the
> results correctly.  the results here are, for the most part, the result
> of several runs, trying to eliminate disparities, and add new forms of
> results (such as, "two <RET>, then third returns to column one").  but,
> if anyone wants to try on their own, or automate further (the
> possibilities are endless! :), please, lütfen!
>
> there's an e-lisp function, and the shell double for loop towards the
> end of this e-mail.
>
> first, here's the *transposed* table, as i think it is more readable.
> (the word "transpose" should show up in the info pages!).  at the end of
> the e-mail, though, i'll put the non-transposed -- maybe one sees
> some things there easier.
>
> |           | t,t     | t,headline-data |   t,nil | nil,t     |
> nil,headline-data |   nil,nil |
>
> |-----------+---------+-----------------+---------+-----------+-------------------+-----------|
> | head      | n       |         n,nbl,1 |       1 | 1         |
>      1 |         1 |
> | head<C-j> | 1       |               1 |       1 | n         |
>  n,nbl,1 |         1 |
> | src{      | n       |             n+2 |     n+2 | 1         |
>      1 |         1 |
> | src{<C-j> | 1       |               1 |       1 | n+2 [t-2] |
>  n+2 [t-2] | n+2 [t-2] |
> | src;      | n-4     |             n-2 |     n-2 | 1         |
>      1 |         1 |
> | src;<C-j> | 1       |               1 |       1 | n-2 [t+2] |
>  n-2 [t+2] | n-2 [t+2] |
> | list<RET> | n+2*2,1 |               1 | n+2*2,1 | 1         |
>      1 |         1 |
> | list<C-j> | 1       |               1 |       1 | n+2*2,1   |
>      1 |   n+2*2,1 |
> | line      | n       |               1 |       n | 1         |
>      1 |         1 |
> | line<C-j> | 1       |               1 |       1 | n         |
>      1 |         n |
>
> the columns are (electric-indent,org-adapt-indentation) pairs.
>
> here are the cases (rows) and results (contents of cells).  the
> "<C-j>"-suffixed cases use C-j rather than <RET>.
>
> - head :: <RET> from a headline
>   - n :: stays indented for "infinite" blank <RET>
>   - n,nbl,1 :: n, then after first non-blank line, <RET> goes
>     to 1
>   - 1 :: goes
> - src{ :: <RET> from, e.g., 'if (x) {'
>   - n-2 :: undents by 2
>   - n+2 :: indents
>   - n+2 [t-2] :: goes to n+2 (but, <TAB> of non-blank line goes to
>     n+4)
>   - n-2 [t+2] :: goes to n-2 (but, that 2 past the previous <TAB>
>     indentation level)
> - src; :: <RET> from a regular program statement
> - list<RET> :: <RET> from item in list
>   - n+2 :: indents once
>   - n+2*2,1 :: indents once, stays on next <RET>, then 1 on next <RET>
>     (three <RET> total)
>   - 1 :: column 1
> - line :: <RET> from an indented line
>   - n :: never goes to 1
>   - 1 :: goes to 1
>
>
> brute force lisp code
> #+begin_src elisp
> (defun feorge (el oai fname)
>   (progn
>     (add-hook 'org-mode-hook (electric-indent-mode (if el 1 0)))
>     (find-file fname)
>     (setq org-adapt-indentation oai)
>     (let
>         ((header "| |head | head<C-j> | src{ | src{<C-j> | src; |
> src;<C-j> | list<RET> | list<C-j> | line | line<C-j>|")
>          (hline "|-+-+-+-+-+-+-+-+-+-+-|")
>          (results (format "| %s,%s | ||||||||||" electric-indent-mode
> org-adapt-indentation)))
>       (goto-char (point-max))
>       (insert (format "el %s; oai %s" el oai))
>       (goto-char (point-max))
>       (newline)
>       (insert (version))
>       (goto-char (point-max))
>       (newline)
>       (insert (org-version))
>       (goto-char (point-max))
>       (newline)
>       (insert header)
>       (goto-char (point-max))
>       (newline)
>       (insert hline)
>       (goto-char (point-max))
>       (newline)
>       (insert results)
>       (goto-char (point-max))
>       (newline)
>       (goto-char (point-max))
>       (newline))))
> #+end_src
>
> and, the shell loop-de-loop
> #+begin_src sh
>   for el in t nil; do
>       for oai in t \'headline-data nil; do
>           rm -f *x.org*;
>           emacs -l ~/tmp/feorge.el --eval "(feorge ${el} ${oai} \"x.org\")";
>
>       done;
>   done
> #+end_src
>
> untransposed table:
>
> |                   |    head | head<C-j> | src{ | src{<C-j> | src; |
> src;<C-j> | list<RET> | list<C-j> | line | line<C-j> |
>
> |-------------------+---------+-----------+------+-----------+------+-----------+-----------+-----------+------+-----------|
> | t,t               |       n |         1 | n    | 1         | n-4  | 1
>      |   n+2*2,1 |         1 |    n |         1 |
> | t,headline-data   | n,nbl,1 |         1 | n+2  | 1         | n-2  | 1
>      |         1 |         1 |    1 |         1 |
> | t,nil             |       1 |         1 | n+2  | 1         | n-2  | 1
>      |   n+2*2,1 |         1 |    n |         1 |
> | nil,t             |       1 |         n | 1    | n+2 [t-2] | 1    | n-2
> [t+2] |         1 |   n+2*2,1 |    1 |         n |
> | nil,headline-data |       1 |   n,nbl,1 | 1    | n+2 [t-2] | 1    | n-2
> [t+2] |         1 |         1 |    1 |         1 |
> | nil,nil           |       1 |         1 | 1    | n+2 [t-2] | 1    | n-2
> [t+2] |         1 |   n+2*2,1 |    1 |         n |
>


-- 
regards,

Tim

--
Tim Cross

[-- Attachment #2: Type: text/html, Size: 8959 bytes --]

  reply	other threads:[~2020-11-17  5:26 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 17:30 Karl Voit
2020-11-13 21:10 ` Gustavo Barros
2020-11-13 21:38   ` Jean Louis
2020-11-14  3:02     ` Greg Minshall
2020-11-13 21:47   ` Jean Louis
2020-11-13 22:13     ` Gustavo Barros
2020-11-13 22:21       ` Jean Louis
2020-11-14 17:28         ` Diego Zamboni
2020-11-14 19:10           ` Jean Louis
2020-11-15 12:44             ` Kévin Le Gouguec
2020-11-15 13:26               ` Jean Louis
2020-11-15 21:59                 ` Kévin Le Gouguec
2020-11-15 22:15                   ` Jean Louis
2020-11-16  7:15                   ` Dr. Arne Babenhauserheide
2020-11-16  6:26               ` Greg Minshall
2020-11-14 10:45   ` Diego Zamboni
2020-11-13 21:31 ` Jean Louis
2020-11-14 22:43 ` David Rogers
2020-11-15  5:38   ` Jean Louis
2020-11-15  7:47     ` David Rogers
2020-11-15  8:54       ` Jean Louis
2020-11-15 10:37       ` Greg Minshall
2020-11-15 11:42         ` Tim Cross
2020-11-15 11:48         ` Gustavo Barros
2020-11-15 11:58           ` Detlef Steuer
2020-11-15 12:09           ` Jean Louis
2020-11-15 14:50             ` Gustavo Barros
2020-11-15 15:11               ` Jean Louis
2020-11-15 10:44       ` Dr. Arne Babenhauserheide
2020-11-15 11:22         ` Detlef Steuer
2020-11-15 14:03           ` Kévin Le Gouguec
2020-11-16  5:24             ` Kyle Meyer
2020-11-16  6:41               ` Tim Cross
2020-11-16  7:15                 ` Tim Cross
2020-11-16 11:21                   ` Gustavo Barros
2020-11-16 23:24                     ` T.F. Torrey
2020-11-17  1:21                       ` Tom Gillespie
2020-11-17  7:01                         ` Dr. Arne Babenhauserheide
2020-11-17  7:48                       ` Michal Politowski
2020-11-19  4:17                     ` Marcel Ventosa
2020-11-16  8:06                 ` Kévin Le Gouguec
2020-11-16 12:10                 ` Bill Burdick
2020-11-16  6:54               ` Greg Minshall
2020-11-16  7:12                 ` Tim Cross
2020-11-17  4:03                   ` Greg Minshall
2020-11-17  5:25                     ` Tim Cross [this message]
2020-11-17 13:15                       ` Greg Minshall
2020-11-16  7:01               ` Dr. Arne Babenhauserheide
2020-11-16  7:22                 ` Tim Cross
2020-11-16 16:04                   ` Dr. Arne Babenhauserheide
2020-11-16 16:26                     ` Tom Gillespie
2020-11-16 18:12                       ` gyro funch
2020-11-16 18:48                         ` Tom Gillespie
2020-11-16 19:41                           ` Bill Burdick
2020-11-16 19:56                             ` Tom Gillespie
2020-11-16 21:50                             ` Tim Cross
2020-11-16 23:01                               ` Tom Gillespie
2020-11-16 21:44                           ` Tim Cross
2020-11-16 18:20                       ` gyro funch
2020-11-16 20:56                       ` Tim Cross
2020-11-16 21:35                         ` Bill Burdick
2020-11-16 22:44                         ` Tom Gillespie
2020-11-16 23:55                         ` Dr. Arne Babenhauserheide
2020-11-17  9:05                           ` Stefan Nobis
2020-11-17  9:15                             ` Loris Bennett
2020-11-17  9:32                             ` Diego Zamboni
2020-11-17 14:29                             ` Dr. Arne Babenhauserheide
2020-11-17 16:25                               ` Robert Pluim
2020-11-16 23:39                       ` Dr. Arne Babenhauserheide
2020-11-16 21:35                     ` Tim Cross
2020-11-17  0:11                       ` Dr. Arne Babenhauserheide
2020-11-17  8:45                         ` Detlef Steuer
2020-11-17  9:41                           ` Jean Louis
2020-11-17 15:33                     ` Maxim Nikulin
2020-11-16 13:00                 ` Uwe Brauer
2020-11-16 16:10                   ` Dr. Arne Babenhauserheide

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://orgmode.org

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

  git send-email \
    --in-reply-to='CAC=50j_P10vDueCeJ+s8Ycja40Vy8SOE3XL7JsvO0vvLE3akhA@mail.gmail.com' \
    --to=theophilusx@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=minshall@umich.edu \
    /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

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git