* Expand macros in links
@ 2022-12-27 15:22 Michael Dauer
2022-12-27 15:30 ` Ihor Radchenko
0 siblings, 1 reply; 8+ messages in thread
From: Michael Dauer @ 2022-12-27 15:22 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 266 bytes --]
Hi,
I do not understand why links are excluded from macro expansion. I would
see it as very valuable to have macros for links too.
The change would be as simple as inserting
(eq type 'link)
into org-macro-replace-all.
May I recommend this patch.
Thanks,
Michael
[-- Attachment #2: Type: text/html, Size: 424 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Expand macros in links
2022-12-27 15:22 Expand macros in links Michael Dauer
@ 2022-12-27 15:30 ` Ihor Radchenko
2022-12-27 15:44 ` Michael Dauer
0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2022-12-27 15:30 UTC (permalink / raw)
To: Michael Dauer; +Cc: emacs-orgmode
Michael Dauer <mick.dauer@gmail.com> writes:
> I do not understand why links are excluded from macro expansion. I would
> see it as very valuable to have macros for links too.
Are they? Could you please provide an example?
--
Ihor Radchenko // yantar92,
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 [flat|nested] 8+ messages in thread
* Re: Expand macros in links
2022-12-27 15:30 ` Ihor Radchenko
@ 2022-12-27 15:44 ` Michael Dauer
2022-12-27 15:50 ` Ihor Radchenko
0 siblings, 1 reply; 8+ messages in thread
From: Michael Dauer @ 2022-12-27 15:44 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 921 bytes --]
I mean something like:
* Heading
[[http:abc{{{input-file}}}]
When exporting it to html then the link is not replaced.
I'm talking about expansion when exporting.
But I also implemented macro expansion for following links within emacs
quite a while ago. Different story but also very powerful especially for
action links and deep links into other applications.
Am Di., 27. Dez. 2022 um 16:30 Uhr schrieb Ihor Radchenko <
yantar92@posteo.net>:
> Michael Dauer <mick.dauer@gmail.com> writes:
>
> > I do not understand why links are excluded from macro expansion. I would
> > see it as very valuable to have macros for links too.
>
> Are they? Could you please provide an example?
>
> --
> Ihor Radchenko // yantar92,
> 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>
>
[-- Attachment #2: Type: text/html, Size: 1663 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Expand macros in links
2022-12-27 15:44 ` Michael Dauer
@ 2022-12-27 15:50 ` Ihor Radchenko
2022-12-27 16:12 ` Michael Dauer
0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2022-12-27 15:50 UTC (permalink / raw)
To: Michael Dauer; +Cc: emacs-orgmode
Michael Dauer <mick.dauer@gmail.com> writes:
> I mean something like:
> * Heading
> [[http:abc{{{input-file}}}]
>
> When exporting it to html then the link is not replaced.
This is to be expected, and I do think that Org is doing it right by not
replacing macros in links.
You cannot exactly control what is inside link path - if an actual
website link happens to contain {{{...}}} pattern, you will have no
options left how to prevent Org from replacing that pattern.
If you want to generate link paths programmatically, you can instead
define custom links types or link abbreviations. See
https://orgmode.org/manual/Link-Abbreviations.html and
https://orgmode.org/manual/Adding-Hyperlink-Types.html
You can control custom link export as well.
--
Ihor Radchenko // yantar92,
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 [flat|nested] 8+ messages in thread
* Re: Expand macros in links
2022-12-27 15:50 ` Ihor Radchenko
@ 2022-12-27 16:12 ` Michael Dauer
2022-12-27 16:20 ` Ihor Radchenko
0 siblings, 1 reply; 8+ messages in thread
From: Michael Dauer @ 2022-12-27 16:12 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --]
I'm aware of this theoretical conflict. But I see the risk as very low
compared to the value of not having to make a lot of customizations for
export and internal link handling. It should just work out of the box.
If you deem necessary there would still be the possibility to define a
global switch for this. This could then still have the 100% save default,
while still being easy to "configure".
If you want to go so far you could mitigate the risk of a conflict by
"escaping" the macro brackets. {{{{{{not-a-macro}}}}}} would be treated as
{{{not-a-marco}}} without expansion. Or any other escape sequence to bring
the conflict probability to 0.0000001.
Am Di., 27. Dez. 2022 um 16:51 Uhr schrieb Ihor Radchenko <
yantar92@posteo.net>:
> Michael Dauer <mick.dauer@gmail.com> writes:
>
> > I mean something like:
> > * Heading
> > [[http:abc{{{input-file}}}]
> >
> > When exporting it to html then the link is not replaced.
>
> This is to be expected, and I do think that Org is doing it right by not
> replacing macros in links.
>
> You cannot exactly control what is inside link path - if an actual
> website link happens to contain {{{...}}} pattern, you will have no
> options left how to prevent Org from replacing that pattern.
>
> If you want to generate link paths programmatically, you can instead
> define custom links types or link abbreviations. See
> https://orgmode.org/manual/Link-Abbreviations.html and
> https://orgmode.org/manual/Adding-Hyperlink-Types.html
>
> You can control custom link export as well.
>
> --
> Ihor Radchenko // yantar92,
> 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>
>
[-- Attachment #2: Type: text/html, Size: 2732 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Expand macros in links
2022-12-27 16:12 ` Michael Dauer
@ 2022-12-27 16:20 ` Ihor Radchenko
2022-12-27 16:23 ` Michael Dauer
0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2022-12-27 16:20 UTC (permalink / raw)
To: Michael Dauer; +Cc: emacs-orgmode
Michael Dauer <mick.dauer@gmail.com> writes:
> I'm aware of this theoretical conflict. But I see the risk as very low
> compared to the value of not having to make a lot of customizations for
> export and internal link handling. It should just work out of the box.
Even low risk does not justify impossible-to-use links when such problem
occurs.
> If you deem necessary there would still be the possibility to define a
> global switch for this. This could then still have the 100% save default,
> while still being easy to "configure".
> If you want to go so far you could mitigate the risk of a conflict by
> "escaping" the macro brackets. {{{{{{not-a-macro}}}}}} would be treated as
> {{{not-a-marco}}} without expansion. Or any other escape sequence to bring
> the conflict probability to 0.0000001.
This is all indeed possible. The main question if whether it is
justified to introduce all these complexities given the provided
alternatives.
Basically, we need more votes in favour to consider such feature.
--
Ihor Radchenko // yantar92,
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 [flat|nested] 8+ messages in thread
* Re: Expand macros in links
2022-12-27 16:20 ` Ihor Radchenko
@ 2022-12-27 16:23 ` Michael Dauer
2022-12-27 16:27 ` Ihor Radchenko
0 siblings, 1 reply; 8+ messages in thread
From: Michael Dauer @ 2022-12-27 16:23 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]
Agree. How do you run such feature polls?
Ihor Radchenko <yantar92@posteo.net> schrieb am Di., 27. Dez. 2022, 17:20:
> Michael Dauer <mick.dauer@gmail.com> writes:
>
> > I'm aware of this theoretical conflict. But I see the risk as very low
> > compared to the value of not having to make a lot of customizations for
> > export and internal link handling. It should just work out of the box.
>
> Even low risk does not justify impossible-to-use links when such problem
> occurs.
>
> > If you deem necessary there would still be the possibility to define a
> > global switch for this. This could then still have the 100% save default,
> > while still being easy to "configure".
>
> > If you want to go so far you could mitigate the risk of a conflict by
> > "escaping" the macro brackets. {{{{{{not-a-macro}}}}}} would be treated
> as
> > {{{not-a-marco}}} without expansion. Or any other escape sequence to
> bring
> > the conflict probability to 0.0000001.
>
> This is all indeed possible. The main question if whether it is
> justified to introduce all these complexities given the provided
> alternatives.
>
> Basically, we need more votes in favour to consider such feature.
>
> --
> Ihor Radchenko // yantar92,
> 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>
>
[-- Attachment #2: Type: text/html, Size: 2197 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Expand macros in links
2022-12-27 16:23 ` Michael Dauer
@ 2022-12-27 16:27 ` Ihor Radchenko
0 siblings, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2022-12-27 16:27 UTC (permalink / raw)
To: Michael Dauer; +Cc: emacs-orgmode
Michael Dauer <mick.dauer@gmail.com> writes:
> Agree. How do you run such feature polls?
Change subject to something like
[FR] [POLL] Allow expanding macros in link path like [[https://site-{{{macro}}}.com]]
Then see how many people reply.
--
Ihor Radchenko // yantar92,
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 [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-12-27 16:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-27 15:22 Expand macros in links Michael Dauer
2022-12-27 15:30 ` Ihor Radchenko
2022-12-27 15:44 ` Michael Dauer
2022-12-27 15:50 ` Ihor Radchenko
2022-12-27 16:12 ` Michael Dauer
2022-12-27 16:20 ` Ihor Radchenko
2022-12-27 16:23 ` Michael Dauer
2022-12-27 16:27 ` 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.