ahyatt / ekg

The emacs knowledge graph, app for notes and structured data.
GNU General Public License v3.0
230 stars 19 forks source link

Saving a note updates its text in notes buffers but does not reapply org-mode links processing #186

Closed leadpipe closed 2 weeks ago

leadpipe commented 1 month ago

https://github.com/ahyatt/ekg/blob/839c6ce9a40bd7b7a12b791dc74f172ac1f378e6/ekg.el#L1624

I have a number of ways I modify notes to linkify things. My most recent one is adding advice to ekg-display-note-tagged to linkify tags that look like shortlinks, meaning turn them into org-mode style links that look like [[http://b/12345][b/12345]]. This works great for redisplayed notes, but comes through literally for the notes that are updated in place via ewoc-invalidate.

This shows a couple of bugs I've used as tags, just after I've saved the note, as they appear in a notes buffer: image

This shows the same bugs in the same notes buffer after I've hit g to redisplay the buffer, and org-mode links have been reapplied: image

Not sure what the best way to address this would be; it appears from a very cursory look that the org-mode linkification requires the text to be in a buffer.

ahyatt commented 1 month ago

Thanks for this issue - these bug links are all too familiar to me, in fact, I think I've done something similar with those same bug links, using org link abbreviations, which might be a slightly better experience for you.

Let me think about the best way to solve this - I agree that it should be the case that invalidating the ewoc should redisplay correctly. My guess is that ekg-insert-inlines-and-process needs to be changed so that it will invoke the mode and wait for fontification before returning the final text.

ahyatt commented 1 month ago

So I think what you want to advise is ekg-display-note. It should be called on ewoc-invalidate, so advising it should do the right thing. ekg-display-note-text will be called when new notes are added, and that is what is going to render the text according to the mode, so that's also a reasonable thing to advise as well. Please try this and see if it works better for you.

leadpipe commented 2 weeks ago

Closing the loop on this:

ahyatt commented 2 weeks ago

Thank you for the follow up!