"Antano Solar" <[EMAIL PROTECTED]> writes:

> There is one more things I would like to know.
> When I do C-c C-x r it is generating the column view from the second level and
> all levels deeper than that.
> How do I restrict the rows generated only to the sub heading with the
> properties defined.

I'm not 100% sure to understand what you mean.  

If you mean that you want to assign a limit to the number of levels
displayed in the captured column view, it is currently not possible.  

But I think it's a good idea.

Here is a patch against latest CVS that does it.

Carsten, what do you think?  If you think it's useful, do you think the
limit parameter be interactively set when `C-c C-x r'?

diff --git a/org.el b/org.el
index 8b57f7b..7463fbe 100644
--- a/org.el
+++ b/org.el
@@ -17430,15 +17430,20 @@ printf       a printf format for computed values"
 
 ;;; Dynamic block for Column view
 
-(defun org-columns-capture-view ()
-  "Get the column view of the current buffer and return it as a list.
-The list will contains the title row and all other rows.  Each row is
-a list of fields."
+(defun org-columns-capture-view (&optional limit)
+  "Get the column view of the current buffer or subtree.
+An optional argument LIMIT sets the level depth limit.
+This function returns a list containing the title row and all
+other rows.  Each row is a list of fields."
   (save-excursion
     (let* ((title (mapcar 'cadr org-columns-current-fmt-compiled))
 	   (n (length title)) row tbl)
       (goto-char (point-min))
-      (while (re-search-forward "^\\*+ " nil t)
+      (while (and (re-search-forward "^\\(\\*+\\) " nil t)
+		  (or (null limit)
+		      (>= limit (if org-odd-levels-only
+				   (/ (1+ (length (match-string 1))) 2)
+				 (length (match-string 1))))))
 	(when (get-char-property (match-beginning 0) 'org-columns-key)
 	  (setq row nil)
 	  (loop for i from 0 to (1- n) do
@@ -17466,6 +17471,7 @@ PARAMS is a property list of parameters:
   (let ((pos (move-marker (make-marker) (point)))
 	(hlines (plist-get params :hlines))
 	(vlines (plist-get params :vlines))
+	(limit (plist-get params :limit))
 	tbl id idpos nfields tmp)
     (save-excursion
       (save-restriction
@@ -17477,7 +17483,7 @@ PARAMS is a property list of parameters:
 		 (goto-char idpos))
 		(t (error "Cannot find entry with :ID: %s" id))))
 	(org-columns)
-	(setq tbl (org-columns-capture-view))
+	(setq tbl (org-columns-capture-view limit))
 	(setq nfields (length (car tbl)))
 	(org-columns-quit)))
     (goto-char pos)
-- 
Bastien
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to