protesilaos / denote

Simple notes for Emacs with an efficient file-naming scheme
https://protesilaos.com/emacs/denote
GNU General Public License v3.0
512 stars 54 forks source link

Org export does not read .dir-locals.el (was: Make denote links be friends with org-publish) #369

Closed azegas closed 3 months ago

azegas commented 4 months ago

Hello,

I have a few denote files in .org format. I want to export those .org files to .html files so I could publish them to my blog on github pages. I use the Emacs built in org-publish package to convert .org files to .html.

A regular denote practice is to make links between your denote files. I currently do so with (denote-link C-c n i) command. It generates such link - [[denote:20231125T180911][vim]] to the file. BUT if I then try to export this file to .html with org-publish, it throws me this warning:

Unable to resolve link: "denote:20231125T180911"

If I create the same link with the built in command - (org-insert-link C-c c-l), the link is created like such - [[file:20210315T181800--vim-hardcore__vim.org][vim]] and then the link is understood by the org-export, I am able to do the export successfully.

So in my case the problem is how the link is being created by denote.


So far I have 3 thoughts about this:

  1. Get on with my life and start creating links between denote files with org-insert-link instead of denote-link (been doing this so far)
  2. Try to create my own custom-denote-link function(would finally get some elisp experience, nice) that mimics the default denote-link function but slightly modifies it so it would output an understandable link for org-publish and then link that new custom-denote-link function to the default C-c n i keybinding. Have this configuration in my Emacs config only, should not be considered to be added to denote source code.
  3. Think through it once again, perhaps its the problem of org-publish that it does not support denote links and I should write an issue to org-publish team instead?

Interested to hear what you think,

Thanks!

protesilaos commented 3 months ago

Hello @azegas!

I am not familiar with Org publish. Can you share a minimal setup to give this a try. The error you report makes it seem that it does not use the Org export mechanism.

In principle, we want denote: links to work the same as Org. We do things in accordance with the standard, but there are cases where Org has hardcoded behaviours that work against us, such as only file: links being able to preview the image they are pointing to.

azegas commented 3 months ago

My pleasure, @protesilaos, here it is, hope it helps - https://github.com/azegas/ox-publish-sample. Explanation how to use that repo is in README.org

protesilaos commented 3 months ago

Thank you @azegas! I will review this tomorrow.

protesilaos commented 3 months ago

I can confirm this is a bug. Though it only happens because for some reason the Org export mechanism does not resolve the path to the denote-directory when it is a silo. I am still investigating this.

protesilaos commented 3 months ago

I confirm this is a bug in Org mode. I have submitted this bug report, which includes a simple recipe that reproduces the problem: https://lists.gnu.org/archive/html/emacs-orgmode/2024-06/msg00206.html

protesilaos commented 3 months ago

I have documented how to make Org export work in Denote silos. I also wrote a blog post about it: https://protesilaos.com/codelog/2024-06-18-emacs-denote-silos-org-export/. Closing now. Thanks!