[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dynamic block tables: adding prefix of "id:" to %ID
From: |
Karl Voit |
Subject: |
Re: Dynamic block tables: adding prefix of "id:" to %ID |
Date: |
Tue, 27 Jul 2021 14:07:26 +0200 |
User-agent: |
slrn/1.0.3 (Linux) |
Hi Ihor,
* Ihor Radchenko <yantar92@gmail.com> wrote:
> Karl Voit <devnull@Karl-Voit.at> writes:
>
>> I do have a dynamic block table like this:
>> ...
>> | NEXT | [0/0] proj bar | bar | :bar:project: |
>>
>> Is there a way to get the ID column with working ID links such as:
>> ...
>> | NEXT | [0/0] proj bar | id:bar | :bar:project: |
>
> You may customise org-columns-modify-value-for-display-function:
>
> (defun yant/org-columns-custom-formatter (column-title value)
> "Format column values for columns with ID-LINK title as proper Org mode id:
> link."
> (pcase column-title
> ("ID-LINK"
> (format "[[id:%s][%s]]"
> value
> (org-with-point-at (org-id-find value 'marker)
> (org-get-heading t t t t))))
> (_ nil)))
> (setq org-columns-modify-value-for-display-function
> #'yant/org-columns-custom-formatter)
>
> Then, you can use the following dblock. Note that I renamed the column
> name to "ID-LINK"
>
> #+BEGIN: columnview :id global :match
> "+project-focus/!+STARTED|+NEXT|+WAITING" :format "%TODO(State) %ITEM(What)
> %ID(ID-LINK) %TAGS(Tags)"
> #+END:
Thanks, this sounds clever and I think I understand the code.
Although I would have preferred not to overwrite a function. I
always have a fear that this leads to nasty side-effects with future
updates.
Without deeper knowledge, I was astonished that C-h f
org-columns-modify-value-for-display-function did not lead to a
matching function and C-h v ... to a matching variable.
However, I set up following test file and it worked:
#+BEGIN: columnview :id global :match
"+project+focus/!+STARTED|+NEXT|+WAITING" :format "%TODO(State) %ITEM(What)
%ID(ID-LINK) %TAGS(Tags)"
| State | What | ID-LINK | Tags |
|-------+----------------+----------------+-----------------|
| NEXT | [/] focus proj | [[id:2021-07-27-focus-proj][[/] focus proj]] |
:focus:project: |
#+END:
* Test
** NEXT [/] focus proj
:focus:project:
:PROPERTIES:
:CREATED: [2021-07-27 Tue 13:59]
:COOKIE_DATA: todo recursive
:ID: 2021-07-27-focus-proj
:END:
** NEXT [/] non-focus proj
:project:
:PROPERTIES:
:CREATED: [2021-07-27 Tue 13:59]
:COOKIE_DATA: todo recursive
:ID: 2021-07-27-non-focus-proj
:END:
When I applied the new change to update a table in a file of 71k
lines of org, I had to cancel the process after over two hours
without a result. Before the change, updating this table took
roughly 20 minutes.
Therefore, this somehow makes a poor performance even worse.
--
get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode:
> get Memacs from https://github.com/novoid/Memacs <
Personal Information Management > http://Karl-Voit.at/tags/pim/
Emacs-related > http://Karl-Voit.at/tags/emacs/
Re: Dynamic block tables: adding prefix of "id:" to %ID, Ihor Radchenko, 2021/07/25
- Re: Dynamic block tables: adding prefix of "id:" to %ID,
Karl Voit <=