emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ippei FURUHASHI <top.tuna+orgmode@gmail.com>
To: Sebastien Vauban
	<public-wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@plane.gmane.org>
Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org
Subject: Re: More than one column view in a file
Date: Tue, 01 May 2012 12:56:40 +0900	[thread overview]
Message-ID: <80k40wzh8n.fsf@gmail.com> (raw)
In-Reply-To: <80aa2a75ur.fsf@somewhere.org> (Sebastien Vauban's message of "Tue, 17 Apr 2012 17:09:16 +0200")

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

Hi Sebastien,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-colview.el-Add-functions-to-column-view-with-for.patch --]
[-- Type: text/x-patch, Size: 2985 bytes --]

From ee660fcb0c5a3a547681d8390284bb57399e05bf Mon Sep 17 00:00:00 2001
From: Ippei FURUHASHI <top.tuna+orgmode@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


  parent reply	other threads:[~2012-05-01  4:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-17 15:09 More than one column view in a file Sebastien Vauban
2012-04-20 11:24 ` Bastien
2012-04-20 20:27   ` Sebastien Vauban
2012-04-20 22:10     ` Johnny
2012-04-20 23:34       ` Bastien
2012-05-01  3:56 ` Ippei FURUHASHI [this message]
2012-05-01  5:55 ` Ippei FURUHASHI
2012-05-01 21:07 ` Ippei FURUHASHI

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=80k40wzh8n.fsf@gmail.com \
    --to=top.tuna+orgmode@gmail.com \
    --cc=public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org \
    --cc=public-wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@plane.gmane.org \
    /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).