nobiot / org-transclusion

Emacs package to enable transclusion with Org Mode
https://nobiot.github.io/org-transclusion/
GNU General Public License v3.0
919 stars 45 forks source link

Babel Export #134

Open kastidad opened 2 years ago

kastidad commented 2 years ago

Hi!

Just getting acquainted with org-transclusion after seeing some of the videos and I think it's awesome! with great potential.

In my case I'm just trying to organize all my studies and have no duplication or as little as possible.

So, I'm trying to export to ANKI through ORG-BABEL & ANKI-CONNECT & ANKI-EDITOR , which works fine in general, but requires too much copy/paste from source files, front-to-back and back-to-front (Anki), so it would be SO more flowing to just insert the occlusion and be done with it.

But I tried and it's not possible, anki-editor provides error messages at the properties area and in this case it provides this:

:PROPERTIES: :ANKI_NOTE_TYPE: BASIC :ANKI_DECK: TEST :ANKI_FAILURE_REASON: Text is read-only :END:

Is there a way to make org-transclusion work with read-only text?

Or maybe some setting to do somewhere to make it work?

Thanks and looking forward to use org-transclusion with anki.

nobiot commented 2 years ago

Thank you for your comments. I don't use Anki so it's unclear to me what real issue is.

What I would need to understand is...:

:ANKI_FAILURE_REASON: Text is read-only

kastidad commented 2 years ago

Hi!

Thanks for your response.

In short the answers to your questions are:

  1. From the org file/buffer which holds the basic text, I add a transcluded "link" to a source file indicating specific lines --it displays nicely inside Emacs.
  2. The commands to do that are part of the Melpa' package anki-editor https://melpa.org/#/anki-editor and are called anki-editor-push-tree and anki-editor-push-notes , which basically export to Anki directly in one fell swoop --using I think org-babel as export mechanism.
  3. It seems the section that hold the reference or transclusion to the source file is read-only or marked as the Org buffer as read-only, or so is reported to be. It's not something that anki-editor or Anki does.
  4. Don't know really, maybe if after exporting to a html file and the result includes everything exactly as it's seen in the Org buffer, that would be one way. Maybe trying to do so would get some log or error message.

When doing so I get a message in the minibuffer

org-babel-exp process clojure at position 203...

and stays stuck :(

-- Now if you want you can ignore this which is the longer answer that provides a bit more context.

With anki-editor, one can use Emacs to edit and export Anki-cards through org-babel (basically an html export).

The idea is that using this setup one can use the full power of emacs & anki-editor to create and modify the cards in Anki, which can include source code, quotes, etc...

But copying/pasting code from the source files, then to the back portion of the card, then copying to the the front portion of the card to edit it as a question it's very time consuming (and soul-sucking).

It would be much easier to just reference the source files with ID and line-delimiters --as I saw in your last video about org-transclusion.

But after all this edition one has to "send" the content of the card (through html-export & org-babel) directly to Anki. This is the part where it couldn't manage.

It seems the transcluded part is read-only and perfect for using directly within Emacs, but not possible to use it as an export --unless there is some config to be done, which is what I'm asking :)

Thanks!

kastidad commented 2 years ago

Visiting the github page I see that this package requires the package request which uses curl to send the content to Anki.

More info at https://github.com/louietan/anki-editor/

nobiot commented 2 years ago

The text content transcluded by Org-transclusion is read-only. But it should be also exportable. This is true when export functions expect the text to be writeable (not read-only) because Org-transclusion temporarily removes read-only for export.

One suggestion for you is to upgrade Org-transclusion to the current version. The support for export was enhanced in a recent version.

If this does not solve the problem, I'd like you to provide a step-by-step description of what you do (see the example below). If you are not familiar with this type of writing, you might think this is too much. It actually helps the developer and usually quicker for both you and the developer.

At the moment, I still don't understand how you get to the problem; and I don't know how I get to see your problem.

Example:

  1. Launch Emacs
  2. M-x find-file to create a new file ~/test.org and ~/test-transclusion.org
  3. Contents of the two files are as follows:
# test.org
* This is test
#+transclude: [[file: ./test-transclusion.org::*This headline is to be transcluded]]
#test-transclusion.org
* This headline is to be transcluded
  1. M-x org-transclusion-add
  2. Move the cursor to X and call M-x anki-something ....

Compare this with

  1. From the org file/buffer which holds the basic text, I add a transcluded "link" to a source file indicating specific lines.

With this step 1, I don't understand the following:

My hope is by giving me a exact step by step description, I would not have these questions.

nothingmuch commented 2 years ago

I ran into this issue as well, the problem was I didn't enable the minor mode before typing out the transclusion "by hand" and then using the org-transclusion-add command, which appeared to mostly work. It took me a few failed attempts with org export (live sync was also not working in the same manner as #140) before I realized I need to enable the mode first (with default binding SPC n t using recommended instructions for doom), and then exporting works (mostly) as expected, as does live sync.