From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ippei FURUHASHI Subject: Re: More than one column view in a file Date: Tue, 01 May 2012 14:55:54 +0900 Message-ID: <808vhcla1h.fsf@gmail.com> References: <80aa2a75ur.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:57798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SP64L-0004yU-94 for emacs-orgmode@gnu.org; Tue, 01 May 2012 01:56:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SP64J-0007VM-9M for emacs-orgmode@gnu.org; Tue, 01 May 2012 01:56:12 -0400 Received: from mail-pz0-f51.google.com ([209.85.210.51]:56134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SP64J-0007Uz-0R for emacs-orgmode@gnu.org; Tue, 01 May 2012 01:56:11 -0400 Received: by dadz8 with SMTP id z8so4340887dad.38 for ; Mon, 30 Apr 2012 22:56:08 -0700 (PDT) In-Reply-To: <80aa2a75ur.fsf@somewhere.org> (Sebastien Vauban's message of "Tue, 17 Apr 2012 17:09:16 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastien Vauban Cc: emacs-orgmode@gnu.org --=-=-= Hi Sebastien, "Sebastien Vauban" writes: > Hello, > > I'd like to have a couple of different (column) views in my Org file How about trying this patch which lets you have another format in column view? After applying this patch, try this at the Tasks tree in your example. M-: (org-columns "%66ITEM(Task) %6CLOCKSUM(Time) %6Effort(Estim.){:}") to compare with the result of M-: (org-columns) Best, IP (snip) > > #+TITLE: Effort vs Estimate > #+AUTHOR: Seb Vauban > > * Tasks > :PROPERTIES: > :ID: 49380c04-9b6e-4298-aff8-d936d9679d8e > :COLUMNS: %6TODO %66ITEM(Task) %6Effort(Estim.){:} > :END: > > ** TODO A (snip and end) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-colview.el-Add-functions-to-column-view-with-for.patch >From ee660fcb0c5a3a547681d8390284bb57399e05bf Mon Sep 17 00:00:00 2001 From: Ippei FURUHASHI 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 --=-=-=--