emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FR] multiple column view definition


From: Slawomir Grochowski
Subject: [FR] multiple column view definition
Date: Mon, 04 Mar 2024 16:50:34 +0100

Dear All,

Recently I started using multiple column view definition in org-columns. 

In e.g. I have calendar 'date tree' and I can switch between 3 views:
 
 1. dosage of medications
 2. exercise in e.g how many push ups daily
 3. some other statistics like weight or number of pomodoros daily  

#+begin_src org
   `* 2024        
   :PROPERTIES:
   :COLUMNS:  %40ITEM(item) %OMEGA-3-1000(omega 3){+} 
%MULTIVITAMIN(multivitamin){+}
   :COLUMNS:  %40ITEM(item) %PUSHUP(pushup){+} %CRUNCH(crunch){+} 
%BIRDIE(birdie){+} %LYING-LEG-RAISE(lying leg raise){+} %PLANK(plank){+}
   :COLUMNS:  %40ITEM(item) %FOOD-MORNING(s-food-t){:mean} 
%FOOD-NIGHT(e-food-t){:mean} %DOWN(down){:mean} %POMODORO(pomodoro){+} 
%WEIGHT(weight){mean;%.1f}
   :END: 
   `** week 10
   `*** [2024-03-10 Sun]
   `*** [2024-03-09 Sat]
   `*** [2024-03-08 Fri]
   `*** [2024-03-07 Thu]
   `*** [2024-03-06 Wed]
   `*** [2024-03-05 Tue]
   `*** [2024-03-04 Mon]
#+end_src

For better understanding and visualization I'm attaching a video in gif.

Attachment: output.gif
Description: GIF image

Is it OK to attach 1 MB file? 

To make it work I did a simple hack:

#+begin_src elisp
(defun org-columns-switch-columns ()
  (interactive)
  (save-excursion
    (org-columns-goto-top-level)
    (re-search-forward ":COLUMNS:")
    (org-metadown)
    (org-metadown)
    (org-columns)))
#+end_src

It works If I'm only changing the 'view', but it doesn't work properly
when I want to change column definition in e.g. remove or add a column.

Because the code for the view is 'reading' the last :COLUMNS: definition with
function (org-entry-get nil "COLUMNS" t).

But is 'changing' the first :COLUMNS: definition with function 
(org-entry-put nil "COLUMNS" fmt).

However, this is a bit of an inconsistency. This 'hack' could work
without any problems.  If the read and write behavior of property :COLUMNS: were
predictable, same.

Do you have any idea how to solve this problem?

Over 10 years ago Thomas Leitner asked about this feature
https://lists.gnu.org/archive/html/emacs-orgmode/2009-12/msg00797.html

@Thomas 
How did you deal with this feature?
Are you still using it?

Regards, 
-- 
Slawomir Grochowski

reply via email to

[Prev in Thread] Current Thread [Next in Thread]