emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Karl Voit <devnull@Karl-Voit.at>
To: emacs-orgmode@gnu.org
Subject: Re: Dynamic block tables: adding prefix of "id:" to %ID
Date: Wed, 28 Jul 2021 21:42:34 +0200	[thread overview]
Message-ID: <2021-07-28T21-39-15@devnull.Karl-Voit.at> (raw)
In-Reply-To: 87wnpc0w86.fsf@localhost

* Ihor Radchenko <yantar92@gmail.com> wrote:
> 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.

Oh, this is reassuring. Thank you!

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

I can confirm that this version does not have any negative impact
compared to the version without your code.

If anybody is interested why this is taking roughly 20min to update
one table:

| - command-execute                                              553233  93%
|  - call-interactively                                          553233  93%
|   - funcall-interactively                                      553233  93%
|    - org-ctrl-c-ctrl-c                                         553233  93%
|     - org-update-dblock                                        553228  93%
|      - org-dblock-write:columnview                             553228  93%
|       - org-columns--capture-view                              553212  93%
|        - org-columns                                           540042  91%
|         - org-columns--display-here                            536947  90%
|          - face-remap-add-relative                             527000  88%
|           - face-remap-order                                   526004  88%
|            - sort                                              521312  88%
|               face-attrs-more-relative-p                       458136  77%
|          + org-columns--new-overlay                              2008   0%
|            face-attribute                                         205   0%
|          + org-columns--overlay-text                               44   0%
|            org-get-level-face                                       4   0%
|         + org-map-entries                                        1506   0%
|         + org-columns-compute-all                                1441   0%
|         + org-columns--set-widths                                   8   0%
|        + org-map-entries                                        12126   2%
|        + org-columns-quit                                          16   0%
|       + org-table-align                                            12   0%
|       + org-columns--clean-item                                     4   0%
|     + org-element-context                                           5   0%
| + ...                                                           38956   6%
| + timer-event-handler                                             166   0%
| + redisplay_internal (C function)                                  28   0%


> Best,
> Ihor

Thank Ihor, you have improved yet another part of my Emacs life!

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



      reply	other threads:[~2021-07-28 19:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23  8:46 Dynamic block tables: adding prefix of "id:" to %ID Karl Voit
2021-07-23 10:01 ` Kristian Grönberg
2021-07-23 12:56   ` Karl Voit
2021-07-23 13:24     ` Kristian Grönberg
2021-07-25  6:24       ` Karl Voit
2021-07-25  6:39         ` Kristian Grönberg
2021-07-25 15:01         ` Jens Neuhalfen
2021-07-25  8:51 ` Ihor Radchenko
2021-07-27 12:07   ` Karl Voit
2021-07-27 12:36     ` Ihor Radchenko
2021-07-28 19:42       ` Karl Voit [this message]

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=2021-07-28T21-39-15@devnull.Karl-Voit.at \
    --to=devnull@karl-voit.at \
    --cc=emacs-orgmode@gnu.org \
    --cc=news2042@Karl-Voit.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).