emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Antano Solar <solar345@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: First column of tables from sub headings and drawyers
Date: Fri, 29 Feb 2008 20:19:38 +0000	[thread overview]
Message-ID: <87zltjwm5h.fsf@bzg.ath.cx> (raw)
In-Reply-To: <b2600ec40802290821l6face8adkff236aa8c0dac04a@mail.gmail.com> (Antano Solar's message of "Fri, 29 Feb 2008 21:51:04 +0530")

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

"Antano Solar" <solar345@gmail.com> 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'?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org.el.patch --]
[-- Type: text/x-diff, Size: 1822 bytes --]

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)

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
Bastien

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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	other threads:[~2008-02-29 20:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-29  6:32 First column of tables from sub headings and drawyers Antano Solar
2008-02-29  9:39 ` Egli Christian (KIRO 433)
2008-02-29 11:22 ` Bastien
2008-02-29 16:21   ` Antano Solar
2008-02-29 20:19     ` Bastien [this message]
2008-02-29 20:32       ` export-html, close the .html file Xin Shi
2008-02-29 20:50         ` Bastien Guerry
2008-02-29 21:01           ` Xin Shi
2008-02-29 21:10             ` Bastien Guerry
2008-02-29 21:43               ` Xin Shi
2008-02-29 21:47                 ` Bastien Guerry
2008-02-29 20:33       ` First column of tables from sub headings and drawyers Antano Solar
2008-02-29 22:23         ` Bastien Guerry
2008-02-29 22:32           ` Manish
2008-03-01  5:41           ` Antano Solar
2008-03-01  5:52             ` Manish
2008-03-01  7:43               ` Antano Solar
2008-03-01  8:48                 ` Manish
2008-03-01  8:57                   ` Manish
2008-03-01  9:28                   ` Antano Solar
2008-03-01  7:46               ` Antano Solar
2008-03-01 10:06             ` Bastien Guerry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zltjwm5h.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=solar345@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).