* BUG?: Link to inline-task not working
@ 2021-12-03 8:30 Michael Dauer
2021-12-03 10:51 ` Ihor Radchenko
0 siblings, 1 reply; 7+ messages in thread
From: Michael Dauer @ 2021-12-03 8:30 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 636 bytes --]
Is there a setting that excludes inline-tasks from internal links?
I actually want to link to inline-tasks. BUT:
emacs -Q
>>>
* h1
[[*t1][t1]]
* h2
*************** TODO t1
*************** END
(require 'org-inlinetask)
<<<
Before (require 'org-inlinetask) all is fine. But after executing (require
'org-inlinetask) the following happens:
1. With point on/in t1 (org-store-link) stores *h2.
2. The manually created link below h1 works in the buffer. But it is
exported as BROKEN LINK.
Org mode version 9.4.4 (release_9.4.4 @
c:/msys64/mingw64/share/emacs/27.2/lisp/org/)
Any ideas how to get fully working links to inline-tasks?
thx
[-- Attachment #2: Type: text/html, Size: 854 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: BUG?: Link to inline-task not working
2021-12-03 8:30 BUG?: Link to inline-task not working Michael Dauer
@ 2021-12-03 10:51 ` Ihor Radchenko
2021-12-03 14:20 ` Michael Dauer
0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2021-12-03 10:51 UTC (permalink / raw)
To: Michael Dauer; +Cc: emacs-orgmode
Michael Dauer <mick.dauer@gmail.com> writes:
> Before (require 'org-inlinetask) all is fine. But after executing (require
> 'org-inlinetask) the following happens:
> 1. With point on/in t1 (org-store-link) stores *h2.
> 2. The manually created link below h1 works in the buffer. But it is
> exported as BROKEN LINK.
Confirmed.
> Any ideas how to get fully working links to inline-tasks?
I have the following in my config to mitigate this problem:
(defun org-inlinetask-store-link (oldfun &rest args)
"Store link to inlinetask at point."
(if (and (derived-mode-p 'org-mode)
(org-inlinetask-in-task-p))
(let ((org-inlinetask-min-level 1000))
(apply oldfun args))
(apply oldfun args)))
(advice-add 'org-store-link :around #'org-inlinetask-store-link)
Best,
Ihor
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: BUG?: Link to inline-task not working
2021-12-03 10:51 ` Ihor Radchenko
@ 2021-12-03 14:20 ` Michael Dauer
2021-12-04 3:19 ` Ihor Radchenko
0 siblings, 1 reply; 7+ messages in thread
From: Michael Dauer @ 2021-12-03 14:20 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]
Ihor, thank you for the quick workaround.
Unfortunately storing links is not much of an issue for me. The real issue
is how I can get the internal links working in the exported html.
I could not find the right places to deactivate and
re-activate inline-tasks during export.
I have a custom org-html-format-inlinetask-function. If I
deactivate inline-tasks outside this formatter is never called, otherwise
the links are not generated.
Where are the links/href are built? There should be the error that excludes
inline-tasks.
thx,
m
Am Fr., 3. Dez. 2021 um 11:50 Uhr schrieb Ihor Radchenko <yantar92@gmail.com
>:
> Michael Dauer <mick.dauer@gmail.com> writes:
>
> > Before (require 'org-inlinetask) all is fine. But after executing
> (require
> > 'org-inlinetask) the following happens:
> > 1. With point on/in t1 (org-store-link) stores *h2.
> > 2. The manually created link below h1 works in the buffer. But it is
> > exported as BROKEN LINK.
>
> Confirmed.
>
> > Any ideas how to get fully working links to inline-tasks?
>
> I have the following in my config to mitigate this problem:
>
> (defun org-inlinetask-store-link (oldfun &rest args)
> "Store link to inlinetask at point."
> (if (and (derived-mode-p 'org-mode)
> (org-inlinetask-in-task-p))
> (let ((org-inlinetask-min-level 1000))
> (apply oldfun args))
> (apply oldfun args)))
>
> (advice-add 'org-store-link :around #'org-inlinetask-store-link)
>
> Best,
> Ihor
>
[-- Attachment #2: Type: text/html, Size: 2094 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: BUG?: Link to inline-task not working
2021-12-03 14:20 ` Michael Dauer
@ 2021-12-04 3:19 ` Ihor Radchenko
2021-12-06 13:14 ` Michael Dauer
0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2021-12-04 3:19 UTC (permalink / raw)
To: Michael Dauer; +Cc: emacs-orgmode
Michael Dauer <mick.dauer@gmail.com> writes:
> Where are the links/href are built? There should be the error that excludes
> inline-tasks.
A quick search through the code yields: org-export-resolve-id-link
It explicitly check headlines, but not inlinetasks.
The fix should not be too hard. Feel free to send a patch ;)
Best,
Ihor
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: BUG?: Link to inline-task not working
2021-12-04 3:19 ` Ihor Radchenko
@ 2021-12-06 13:14 ` Michael Dauer
2021-12-06 13:47 ` Ihor Radchenko
0 siblings, 1 reply; 7+ messages in thread
From: Michael Dauer @ 2021-12-06 13:14 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 940 bytes --]
>
> > Where are the links/href are built? There should be the error that
> excludes
> > inline-tasks.
>
> A quick search through the code yields: org-export-resolve-id-link
> It explicitly check headlines, but not inlinetasks.
>
Shouldn't be org-export-resolve-fuzzy-link the relevant function, at least
for my use case?
But there it looks like it is searching through all elements including
inlinetasks, which is in org-element-all-elements:
(append pseudo-types '(target) org-element-all-elements)
Am Sa., 4. Dez. 2021 um 04:18 Uhr schrieb Ihor Radchenko <yantar92@gmail.com
>:
> Michael Dauer <mick.dauer@gmail.com> writes:
>
> > Where are the links/href are built? There should be the error that
> excludes
> > inline-tasks.
>
> A quick search through the code yields: org-export-resolve-id-link
> It explicitly check headlines, but not inlinetasks.
> The fix should not be too hard. Feel free to send a patch ;)
>
> Best,
> Ihor
>
[-- Attachment #2: Type: text/html, Size: 1593 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: BUG?: Link to inline-task not working
2021-12-06 13:14 ` Michael Dauer
@ 2021-12-06 13:47 ` Ihor Radchenko
2022-10-05 3:23 ` [org-export] Linking inlinetasks (was: BUG?: Link to inline-task not working) Ihor Radchenko
0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2021-12-06 13:47 UTC (permalink / raw)
To: Michael Dauer; +Cc: emacs-orgmode
Michael Dauer <mick.dauer@gmail.com> writes:
> Shouldn't be org-export-resolve-fuzzy-link the relevant function, at least
> for my use case?
>
> But there it looks like it is searching through all elements including
> inlinetasks, which is in org-element-all-elements:
> (append pseudo-types '(target) org-element-all-elements)
Maybe. Further it also calls org-export-search-cells, which does not
consider inlinetasks even if they are matched.
Best,
Ihor
^ permalink raw reply [flat|nested] 7+ messages in thread
* [org-export] Linking inlinetasks (was: BUG?: Link to inline-task not working)
2021-12-06 13:47 ` Ihor Radchenko
@ 2022-10-05 3:23 ` Ihor Radchenko
0 siblings, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2022-10-05 3:23 UTC (permalink / raw)
To: Michael Dauer; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1815 bytes --]
Ihor Radchenko <yantar92@gmail.com> writes:
> Michael Dauer <mick.dauer@gmail.com> writes:
>
>> Shouldn't be org-export-resolve-fuzzy-link the relevant function, at least
>> for my use case?
>>
>> But there it looks like it is searching through all elements including
>> inlinetasks, which is in org-element-all-elements:
>> (append pseudo-types '(target) org-element-all-elements)
>
> Maybe. Further it also calls org-export-search-cells, which does not
> consider inlinetasks even if they are matched.
I have investigated further.
In addition to inlinetasks not being taken into account by
`org-export-search-cells', `org-export-resolve-fuzzy-link', and
`org-export-resolve-id-link', there is no export backend support for
linking inlinetasks.
In order to have full support for inlinetasks during export, we need to
modify export backends to be able to link to the inlinetasks.
For example,
- ox-html.el does not associate ID anchor in
`org-html-format-inlinetask-default-function'
- ox-latex.el also does not provide any label in
`org-latex-format-inlinetask-default-function'
- ox-ascii.el does not assign a number to be referred to in
`org-ascii-format-inlinetask-default'
I did not check other backends.
Note that changing only ox.el without altering the individual backends
can break export in unexpected ways.
I am attaching a simple patch changing the generic link resolution
machinery. If one applies the patch, **export will be broken**.
In particular, exporting to ASCII (C-c C-e t U) will straight throw
an error.
The same may happen in third-party export backends even if we alter the
all built-in export backends appropriately.
Thus, supporting links to inlinetasks will be a breaking change and such
support should be shielded behind a user customization, not be enabled
by default.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox.el-Allow-links-to-inlinetasks.patch --]
[-- Type: text/x-patch, Size: 2173 bytes --]
From c6737633b12b8f9de1a240b2f32f52d54e1c14a1 Mon Sep 17 00:00:00 2001
Message-Id: <c6737633b12b8f9de1a240b2f32f52d54e1c14a1.1664939959.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Wed, 5 Oct 2022 11:17:55 +0800
Subject: [PATCH] lisp/ox.el: Allow links to inlinetasks
* lisp/ox.el (org-export-search-cells):
(org-export-resolve-fuzzy-link):
(org-export-resolve-id-link): Resolve links to inlinetasks.
**This is not a proper commit**
Applying it will not make inlinetask links work during export.
Backend-specific support will be required.
---
lisp/ox.el | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lisp/ox.el b/lisp/ox.el
index 51145acaa..6090d1ecd 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4313,7 +4313,7 @@ (defun org-export-search-cells (datum)
A search cell is the internal representation of a fuzzy link. It
ignores white spaces and statistics cookies, if applicable."
(pcase (org-element-type datum)
- (`headline
+ ((or `headline `inlinetask)
(let ((title (split-string
(replace-regexp-in-string
"\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]" " "
@@ -4408,7 +4408,8 @@ (defun org-export-resolve-fuzzy-link (link info &rest pseudo-types)
;; Matching both a name and a target is not valid, and
;; therefore undefined.
(or (cl-some (lambda (datum)
- (and (not (eq (org-element-type datum) 'headline))
+ (and (not (memq (org-element-type datum)
+ '(headline inlinetask)))
datum))
matches)
(car matches))
@@ -4428,7 +4429,7 @@ (defun org-export-resolve-id-link (link info)
(let ((table (make-hash-table :test #'equal)))
(org-element-map
(plist-get info :parse-tree)
- 'headline
+ '(headline inlinetask)
(lambda (headline)
(let ((id (org-element-property :ID headline))
(custom-id (org-element-property :CUSTOM_ID headline)))
--
2.35.1
[-- Attachment #3: Type: text/plain, Size: 207 bytes --]
--
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-10-05 3:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-03 8:30 BUG?: Link to inline-task not working Michael Dauer
2021-12-03 10:51 ` Ihor Radchenko
2021-12-03 14:20 ` Michael Dauer
2021-12-04 3:19 ` Ihor Radchenko
2021-12-06 13:14 ` Michael Dauer
2021-12-06 13:47 ` Ihor Radchenko
2022-10-05 3:23 ` [org-export] Linking inlinetasks (was: BUG?: Link to inline-task not working) Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.