Hi Sebastien,

"Sebastien Vauban"
<wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org> writes:

> I'd like to have a couple of different (column) views in my Org file

How about trying this patch which let you have another format in column
view?

After applying this patch, try this.
  M-: (org-columns "%66ITEM(Task) %6Effort(Estim.){:}")

Best,
IP
>From ee660fcb0c5a3a547681d8390284bb57399e05bf Mon Sep 17 00:00:00 2001
From: Ippei FURUHASHI <top.tuna+orgm...@gmail.com>
Date: Tue, 1 May 2012 12:11:06 +0900
Subject: [PATCH] org-colview.el: Add functions to column view with formats
 selectively

* lisp/org-colview.el (org-columns): Give new argument
`columns-fmt-string'.
* lisp/org-colview.el (org-columns-get-format-end-top-level): Split
this function into 2 functions, `org-columns-get-format' and
`org-columns-goto-top-level'.

For example, even if the item (or the parent) has the property,
  :COLUMNS:  %66ITEM(Task) %6Effort(Estim.){:} %6CLOCKSUM(Time)
Org can offer column view with another format by typing
  M-: (org-columns "%66ITEM(Task) %6Effort(Estim.){:}")
---
 lisp/org-colview.el |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 5409701..c7b5d45 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -665,27 +665,41 @@ (defun org-columns-open-link (&optional arg)
     (org-open-link-from-string value arg)))
 
 (defun org-columns-get-format-and-top-level ()
-  (let (fmt)
+  (let (fmt (org-columns-get-format))
+    (org-columns-goto-top-level)
+    fmt))
+
+(defun org-columns-get-format (&optional fmt-string)
+  (interactive)
+  (let (fmt-as-property)
     (when (condition-case nil (org-back-to-heading) (error nil))
-      (setq fmt (org-entry-get nil "COLUMNS" t)))
-    (setq fmt (or fmt org-columns-default-format))
+      (setq fmt-as-property (org-entry-get nil "COLUMNS" t)))
+    (setq fmt (or fmt-string fmt-as-property org-columns-default-format))
     (org-set-local 'org-columns-current-fmt fmt)
     (org-columns-compile-format fmt)
+    fmt))
+
+(defun org-columns-goto-top-level ()
+  (let ()
+    (when (condition-case nil (org-back-to-heading) (error nil))
+      (org-entry-get nil "COLUMNS" t)
     (if (marker-position org-entry-property-inherited-from)
 	(move-marker org-columns-top-level-marker
 		     org-entry-property-inherited-from)
-      (move-marker org-columns-top-level-marker (point)))
-    fmt))
+      (move-marker org-columns-top-level-marker (point))))))
 
-(defun org-columns ()
-  "Turn on column view on an org-mode file."
+(defun org-columns (&optional columns-fmt-string)
+  "Turn on column view on an org-mode file.  When `COLUMNS-FMT-STRING'
+is specified e.g. \"%66ITEM(Task) %6Effort(Estim.){:}\"), it is
+treated as format for columns, COLUMNS property."
   (interactive)
   (org-verify-version 'columns)
   (org-columns-remove-overlays)
   (move-marker org-columns-begin-marker (point))
   (let ((org-columns-time (time-to-number-of-days (current-time)))
 	beg end fmt cache maxwidths)
-    (setq fmt (org-columns-get-format-and-top-level))
+    (org-columns-goto-top-level)
+    (setq fmt (org-columns-get-format columns-fmt-string))
     (save-excursion
       (goto-char org-columns-top-level-marker)
       (setq beg (point))
-- 
1.7.9.msysgit.0

Reply via email to