[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Hyperbole-users] kill-ring-org-link-to-lisp
From: |
Jean Louis |
Subject: |
[Hyperbole-users] kill-ring-org-link-to-lisp |
Date: |
Tue, 27 Aug 2019 18:56:55 +0200 |
I use: Editor: GNU Emacs 27.0.50 (build 3, x86_64-pc-linux-gnu, X
toolkit, Xaw3d scroll bars)
Hyperbole: 7.0.3
Sys Type: x86_64-pc-linux-gnu
OS Type: gnu/linux
Window Sys: x
Let me share the new function, that becomes very handy to quickly
provide the backlink for Hyperbola or other hyperlinking purposes.
I am using Org in such way that ID property is generated automatically
on each file saving, like this:
** Diagram of the Organizing Board
:PROPERTIES:
:ID: 174c7647-22ad-4096-9f66-fe24b6878bda
:CREATED: [2018-10-06 Sat 09:56]
:END:
So each heading has its unique ID (mostly unique, if I don't copy and
not verify what I did...).
Then this function is fecthing the link to the Org heading as Emacs
Lisp function.
(defun kill-ring-org-link-to-lisp ()
"Places the Org link by using heading and ID property into the kill-ring"
(interactive)
(when (eq major-mode 'org-mode)
(let* ((heading (org-get-heading))
(id (org-id-get))
(lisp (format "(org-open-link-from-string \"[[id:%s][%s]]\")" id
heading)))
(kill-new lisp))))
It would give following result:
(org-open-link-from-string "[[id:174c7647-22ad-4096-9f66-fe24b6878bda][Diagram
of the Organizing Board]]")
Now this function can be used within the Hyperbole `eval-lisp'
explicit button to quickly jump to the Org heading.
Jean
- [Hyperbole-users] kill-ring-org-link-to-lisp,
Jean Louis <=