From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: First column of tables from sub headings and drawyers Date: Fri, 29 Feb 2008 20:19:38 +0000 Message-ID: <87zltjwm5h.fsf@bzg.ath.cx> References: <871w6w2eis.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JVBhq-0001XV-MX for emacs-orgmode@gnu.org; Fri, 29 Feb 2008 15:19:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JVBho-0001UE-Tq for emacs-orgmode@gnu.org; Fri, 29 Feb 2008 15:19:45 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JVBho-0001Ty-Ac for emacs-orgmode@gnu.org; Fri, 29 Feb 2008 15:19:44 -0500 Received: from ug-out-1314.google.com ([66.249.92.173]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JVBhn-0004iE-MM for emacs-orgmode@gnu.org; Fri, 29 Feb 2008 15:19:43 -0500 Received: by ug-out-1314.google.com with SMTP id a2so487554ugf.48 for ; Fri, 29 Feb 2008 12:19:42 -0800 (PST) In-Reply-To: (Antano Solar's message of "Fri, 29 Feb 2008 21:51:04 +0530") 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: Antano Solar Cc: emacs-orgmode@gnu.org --=-=-= "Antano Solar" 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'? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=org.el.patch 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--