emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Greg Minshall <minshall@umich.edu>
To: Tim Cross <theophilusx@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Changed list indentation behavior: how to revert?
Date: Tue, 17 Nov 2020 07:03:31 +0300	[thread overview]
Message-ID: <816918.1605585811@apollo2.minshall.org> (raw)
In-Reply-To: Your message of "Mon, 16 Nov 2020 18:12:35 +1100." <874klpbwrg.fsf@gmail.com>

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 |


  reply	other threads:[~2020-11-17  4:04 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 17:30 Changed list indentation behavior: how to revert? 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 [this message]
2020-11-17  5:25                     ` Tim Cross
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://www.orgmode.org/

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

  git send-email \
    --in-reply-to=816918.1605585811@apollo2.minshall.org \
    --to=minshall@umich.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=theophilusx@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).