emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Karl Voit <news2042@Karl-Voit.at>
Cc: emacs-orgmode@gnu.org
Subject: Re: Dynamic block tables: adding prefix of "id:" to %ID
Date: Sun, 25 Jul 2021 16:51:58 +0800	[thread overview]
Message-ID: <87v94yojwx.fsf@localhost> (raw)
In-Reply-To: <2021-07-23T10-42-47@devnull.Karl-Voit.at>

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:

Best,
Ihor


  parent reply	other threads:[~2021-07-25  8:52 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 [this message]
2021-07-27 12:07   ` Karl Voit
2021-07-27 12:36     ` Ihor Radchenko
2021-07-28 19:42       ` Karl Voit

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=87v94yojwx.fsf@localhost \
    --to=yantar92@gmail.com \
    --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).