emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Dynamic block tables: adding prefix of "id:" to %ID


From: Ihor Radchenko
Subject: Re: Dynamic block tables: adding prefix of "id:" to %ID
Date: Tue, 27 Jul 2021 20:36:41 +0800

Karl Voit <devnull@Karl-Voit.at> writes:
> 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.

That's not overwriting. org-columns-modify-value-for-display-function is
not a function, but a custom variable defaulting to nil. You have all
rights to set it to whatever you wish.

> 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.

Hmm. You are right. This should be a bug. It happens because
org-colview.el is only loaded after you actually run column view or
corresponding dblock. Before that, Emacs is not aware about this
variable (unless you require org-colview manually in your config).

> 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.

That's probably because the function I provided tries to compute the
description part of the link by querying the headline for each result.
You may get much better performance using the following version:

(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]]" value))
    (_ nil)))

Best,
Ihor



reply via email to

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