From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Wales Subject: indentation cycling Date: Wed, 7 Oct 2009 11:07:57 -0700 Message-ID: <20524da70910071107s55fff3ecj4d92f2bc9511b970@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mvaw2-0004lp-P3 for emacs-orgmode@gnu.org; Wed, 07 Oct 2009 14:08:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mvavy-0004kj-Sv for emacs-orgmode@gnu.org; Wed, 07 Oct 2009 14:08:22 -0400 Received: from [199.232.76.173] (port=34363 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mvavy-0004kg-Q6 for emacs-orgmode@gnu.org; Wed, 07 Oct 2009 14:08:18 -0400 Received: from mail-iw0-f174.google.com ([209.85.223.174]:38717) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mvavy-0002qi-BU for emacs-orgmode@gnu.org; Wed, 07 Oct 2009 14:08:18 -0400 Received: by iwn4 with SMTP id 4so2756650iwn.14 for ; Wed, 07 Oct 2009 11:08:17 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Here are two ideas for cycling indentation in body text. I often find myself doing TAB in the expectation that it will execute them. I wonder if others also do that. These operations affect only the current line.[1] 1. I always indent the plain list top level to column 2 like this. - top level `continuation line' - child - top level (sibling) I also like to indent text sometimes. like this. Here is how it would work. If the line /does not/ look like a `continuation line' (i.e. it does not follow an item or (recursively) a `continuation line'), then these are the cycle states. (The "here" line is being indented differently.) - here here here here This cycling command can be a separate command (e.g. on C-M-TAB) or it can be combined with org-cycle (which does visibility cycling). If it is a separate command, there are no conflicts. If it is combined, the conflicts can be fixed. If does not turn out to be too complicated, I'd prefer org-cycle to do it, because that is the natural place for the user to try. Or perhaps we can experiment with it on a separate command first, then integrate it with org-cycle later.[2] I tried to implement it but it was difficult for me. 2. If the current line /does/ look like a `continuation line', cycling looks like this. (The "[]" (location of point) is being indented differently but the only thing being indented is a blank line.) - top level - hello [] (`continuation line') Then this. - top level - hello - [] (`child') Then this. - top level - hello - [] (`sibling') Then optionally[3] this. - top level - hello - [] (`aunt/uncle') Again, this can be a separate command (e.g. on C-M-TAB) or it can be combined with org-cycle (which does visibility cycling). If it is a separate command, there are no conflicts. If it is combined, the conflicts can be fixed.[4] Counterargument to idea 2: with the exception of `continuation line', idea 2 is redundant with M-r/l and S-M-r/l. The justification is that list entry is faster, and that, since we want to deal with `continuation line' (I think this is important), we might as well also do other indentation things similarly to how we do with idea 1. It feels more consistent with idea 1 to have this extra way of demoting and (optionally) promoting. Will be interested in comments. Thanks! [fn:40] Alternative: only allow this on blank lines (other than "-" and whitespace). [1] They could affect the active region also, if desired. [2] For the org-cycle case: \par Cycling from the bullet stage to the next stage conflicts with visibility cycling. To fix that, check to see if the previous command was at stage 1. If not, the user is not trying to modify the hierarchy at all, so cycle visibility. \par In other words, if you are on an existing hierarchy, TAB will never change to zero indentation or extended-quote-like indentation. Thus, if you combine with org-cycle, idea 1 is only for new indentation. It is for fast creation. \par I have org-adapt-indentation set to nil. If there is a conflict with this variable set to t, the variable can override. Perhaps somebody can confirm that there are no other conflicts. [3] It could also be promoted more than once. We can choose to cycle all the way back to the top level, here. Normally, I'd reject such a solution for being too many cycle states, but in this case it's at least visually obvious what's going on, and how many states are necessary until you wrap around. Still, we can optionally cycle back after the sibling, merely cycling '(CONTINUATION CHILD SIBLING). [4] For the org-cycle case: \par Note that stages 3, 4, and back to 1 would conflict with visibility cycling. That can be resolved as with idea 1, by checking to see whether the previous command was the previous stage.[fn:40]