emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Slawomir Grochowski" <slawomir.grochowski@gmail.com>
To: emacs-orgmode@gnu.org
Cc: t_leitner@gmx.at
Subject: [FR] multiple column view definition
Date: Mon, 04 Mar 2024 16:50:34 +0100	[thread overview]
Message-ID: <87cysa0zed.fsf@gmail.com> (raw)

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

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 #2: output.gif --]
[-- Type: image/gif, Size: 1136951 bytes --]

[-- Attachment #3: Type: text/plain, Size: 1113 bytes --]

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	other threads:[~2024-03-04 15:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 15:50 Slawomir Grochowski [this message]
2024-03-05 12:41 ` [FR] multiple column view definition Ihor Radchenko
2024-03-05 16:40   ` Slawomir Grochowski
2024-03-06 10:53     ` Ihor Radchenko

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=87cysa0zed.fsf@gmail.com \
    --to=slawomir.grochowski@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=t_leitner@gmx.at \
    /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).