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 12:56:40 +0900 Message-ID: <80k40wzh8n.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]:33828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SP4Ry-0006di-Ua for emacs-orgmode@gnu.org; Tue, 01 May 2012 00:12:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SP4Rw-0002oW-UV for emacs-orgmode@gnu.org; Tue, 01 May 2012 00:12:30 -0400 Received: from plane.gmane.org ([80.91.229.3]:39142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SP4Rw-0002oD-HT for emacs-orgmode@gnu.org; Tue, 01 May 2012 00:12:28 -0400 Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SP4Ru-0001vb-AM for emacs-orgmode@gnu.org; Tue, 01 May 2012 06:12:26 +0200 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: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org --=-=-= Hi Sebastien, "Sebastien Vauban" 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 --=-=-= 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 --=-=-=--