emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Slawomir Grochowski <slawomir.grochowski@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org, t_leitner@gmx.at
Subject: Re: [FR] multiple column view definition
Date: Tue, 05 Mar 2024 17:40:30 +0100	[thread overview]
Message-ID: <8734t4lji9.fsf@gmail.com> (raw)
In-Reply-To: <87r0go4zr2.fsf@localhost>

Ihor Radchenko <yantar92@posteo.net> writes:

> It looks like you are asking for a way to choose between multiple column
> specs when building column view. And that you have a very specific idea
> how to implement it. However, the details of the idea are elusive to me.
> May you elaborate?

Sure.

We have two COLUMNS definition:

* 2024
:PROPERTIES:
:COLUMNS:  %ITEM(B) %TEST(B column)
:COLUMNS:  %ITEM(A) %TEST(A column)
:END:

#+BEGIN: columnview :hlines 1
|    A | A column |
|------+----------|
| 2024 |          |
#+END:

When and run `org-columns' on that heading it will display column view
using :COLUMNS: definition from bottom. ':COLUMNS:  %ITEM(A) %TEST(A column)'. 
The definition on top ':COLUMNS:  %ITEM(B) %TEST(B column)' is ignored. 

The function to get the :COLUMN: definition to display is (org-entry-get nil "COLUMNS" t).

Based on that behavior I made a simple function:

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

So it's just to move :COLUMNS: definition from top to bottom. And run
`org-columns'. It works fine. 

The problem is when I want to modify the :COLUMNS: definition.
In e.g.  

* 2024
:PROPERTIES:
:COLUMNS:  %ITEM(B) %TEST(B column)
:COLUMNS:  %ITEM(A) %TEST(A column)
:END:

It will display ':COLUMNS:  %ITEM(A) %TEST(A column)'

#+BEGIN: columnview :hlines 1
|    A | A column |
|------+----------|
| 2024 |  (put cursor here and run org-columns-delete) |
#+END:

It will modify the ':COLUMNS:  %ITEM(B) %TEST(B column)'. 
So :COLUMNS: definition from top not from bottom. 

The function to modify :COLUMNS: definition is (org-entry-put nil "COLUMNS" fmt).
So this is the problem.

So in my opinion (org-entry-put nil "COLUMNS" fmt) should modify the
:COLUMNS: definition from bottom (the last one) not from top (the first one).  

Or maybe someone has a better idea how to implement the functionality
'multiple column view definition'? 

-- 
Slawomir Grochowski


  reply	other threads:[~2024-03-05 16:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 15:50 [FR] multiple column view definition Slawomir Grochowski
2024-03-05 12:41 ` Ihor Radchenko
2024-03-05 16:40   ` Slawomir Grochowski [this message]
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=8734t4lji9.fsf@gmail.com \
    --to=slawomir.grochowski@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=t_leitner@gmx.at \
    --cc=yantar92@posteo.net \
    /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).