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 |