Browse Source

Plain lists: Improvements to cycling with TAB.

TAB now cycles visibility in plain lists if the cursor is in a plain
list.  This corresponds now to the new default value `t' of
`org-cycle-include-plain-lists'.  If you want to treat plain list
items as part of the outline hierarchy during cycling of outline
headings (this is what a `t' value used to mean), set this variable to
`integrate'.
Carsten Dominik 16 years ago
parent
commit
c1a4c5901a
5 changed files with 40 additions and 14 deletions
  1. 5 0
      doc/ChangeLog
  2. 6 5
      doc/org.texi
  3. 6 0
      lisp/ChangeLog
  4. 21 8
      lisp/org-list.el
  5. 2 1
      lisp/org.el

+ 5 - 0
doc/ChangeLog

@@ -1,3 +1,8 @@
+2009-07-01  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.texi (Plain lists): Document new behavior of
+	`org-cycle-include-plain-lists'.
+
 2009-06-30  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.texi: Hyphenation only in TeX.

+ 6 - 5
doc/org.texi

@@ -1368,11 +1368,12 @@ of an item (the line with the bullet or number).
 @kindex @key{TAB}
 @item @key{TAB}
 @vindex org-cycle-include-plain-lists
-Items can be folded just like headline levels if you set the variable
-@code{org-cycle-include-plain-lists}.  The level of an item is then
-given by the indentation of the bullet/number.  Items are always
-subordinate to real headlines, however; the hierarchies remain
-completely separated.
+Items can be folded just like headline levels.  Normally this works only if
+the cursor is on a plain list item.  For more details, see the variable
+@code{org-cycle-include-plain-lists}. to @code{integrate}, plain list items
+will be treated like low-level.  The level of an item is then given by the
+indentation of the bullet/number.  Items are always subordinate to real
+headlines, however; the hierarchies remain completely separated.
 
 If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
 fixes the indentation of the current line in a heuristic way.

+ 6 - 0
lisp/ChangeLog

@@ -1,5 +1,11 @@
 2009-07-01  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-cycle): Honor the `integrate' value of
+	org-cycle-include-plain-lists'.
+
+	* org-list.el (org-cycle-include-plain-lists): New allowed value
+	`internal'.  Improve the docstring.
+
 	* org.el (org-set-autofill-regexps): Improve the paragraph-start
 	regexp to work better with LaTeX commands.
 

+ 21 - 8
lisp/org-list.el

@@ -57,15 +57,28 @@
   :tag "Org Plain lists"
   :group 'org-structure)
 
-(defcustom org-cycle-include-plain-lists nil
-  "Non-nil means, include plain lists into visibility cycling.
-This means that during cycling, plain list items will *temporarily* be
-interpreted as outline headlines with a level given by 1000+i where i is the
-indentation of the bullet.  In all other operations, plain list items are
-not seen as headlines.	For example, you cannot assign a TODO keyword to
-such an item."
+(defcustom org-cycle-include-plain-lists t
+  "When t, make TAB cycle visibility on plain list items.
+
+Cycling plain lists works only when the cursor is on a plain list
+item.  When the cursor is on an outline heading, plain lists are
+treated as text.  This is the most stable way of handling this,
+which is why it is the default.
+
+When this is the symbol `integrate', then during cycling, plain
+list items will *temporarily* be interpreted as outline headlines
+with a level given by 1000+i where i is the indentation of the
+bullet.  This setting can lead to strange effects when switching
+visibility to `children', because the first \"child\" in a
+subtree decides what children should be listed.  If that first
+\"child\" is a plain list item with an implied large level
+number, all true children and grand children of the outline
+heading will be exposed in a children' view."
   :group 'org-plain-lists
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Never" nil)
+	  (const :tag "With cursor in plain list (recommended)" t)))
+	  (const :tag "As children of outline headings" integrate)
 
 (defcustom org-plain-list-ordered-item-terminator t
   "The character that makes a line with leading number an ordered list item.

+ 2 - 1
lisp/org.el

@@ -4730,7 +4730,8 @@ in special contexts.
 	   (outline-regexp
 	    (cond
 	     ((not (org-mode-p)) outline-regexp)
-	     (org-cycle-include-plain-lists
+	     ((or (eq org-cycle-include-plain-lists 'integrate)
+		  (and org-cycle-include-plain-lists (org-at-item-p)))
 	      (concat "\\(?:\\*"
 		      (if nstars (format "\\{1,%d\\}" nstars) "+")
 		      " \\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) \\)"))