Macro only loading when viewed

Hey folks,

I’ve incorporated, into my Noteself usage, the ximg macro located here-> External Image Path Macro

It works great and works when I view a tiddler using the markup.

I have since modified the approach (created new tiddlers) to create essentially an External Link Path Macro (xpdf). My modified macro xpdf is intended to allow external links to open pdfs. The macro seems to work, but only when I perform the following:

  1. advance search for the macro
  2. select the xpdf macro
  3. when the tiddler appears (I don’t have to open the edit window) the tiddlers that are using the macro work.

Here’s what I’ve got in the tiddler:

A tiddler named “$:/macros/xpdf” and tagged “$:/tags/Macro” with the following content

\define pdfAtPath(t, y, d, p)
[ext[$t$|$p$$y$ JBW/$d$]]
\end

\define xpdf(title, year, doc, path:"$:/macros/xpdf/path")
<$macrocall $name="pdfAtPath" p={{$path$}} t="$title$" y="$year$" d="$doc$"/>
\end

Another tiddler named “$:/macros/xpdf/path” and tagged “$:/tags/Macro” with the following content

./JBW Notes Chrono/

In the tiddler calling the macro, the following notation is used:

<<xpdf History 2003 "2003-01-01_01_J_Green Book 099.pdf">>

Some other data (if needed).

  • Mac OS 10.15.5
  • Latest Noteself install 5.1.21
  • I have a local CouchDB (3.1.0) instance running
  • I have a remote CouchDB (2.3.1) instance running
  • This DB is replicating to and from each CouchDB instance

The Questions…

  • Does anyone see any reason why the xpdf macro would need the extra step?
  • Would the ximg and xpdf conflict with each other? (They both appear to work once the xpdf macro is viewed)
  • Are there certain variables that I need to change because they are unique (I wouldn’t think this to be true)
  • Anyone have any ideas on how to fix it? :grin:

Thanks in advance,

Hello @J-Dubbs , welcome to the community.
The behaviour you are seeing is because the asynchronous nature of NoteSelf and the way tiddlywiki loads tiddlers when an async tiddler store is used. Tiddlers are not loaded entirely, just the basic fields, which means everything except the text. Because most macros live in the tex field, this means that they are not loaded until you open the tiddler that contains them or tiddler that references their text field.
I should add the macros to the list of tiddlers that are loadjust ed on init, but meanwhile you can activate the option that loads all the tiddlers on boot. Just go to the control panel, tiddlypouch path and activate the option to load all tiddlers as fat tiddlers, save and reload. That should fix your problem. Take a look at the attached screenshot.


Please let me know if it works.
Regards

Hey! Thanks for the quick response.

I think I understand what you are saying, but I don’t get the same result depending on which macro I’m using. It might be my particular setup, but it’s not fancy (cause I’m a rookie).

This is the order that I’ve tested so far:

  1. Delete all cache items in Brave (Web browser)

  2. Open the *.html noteself file.

  3. Login to the CouchDB server

  4. Select tiddler using the ximg macro <<ximg *.png >>

  5. Select the tiddler using the new xpdf macro, which does not load the link.

  6. Select a different tiddler with a macro (not mentioned thus far), which also does not work.

For some reason, it seems that the ximg using the [img[title | image]] seems to load regardless. But the other macros seem to follow your expectation.

I cannot seem to get the “fat tiddlers” to stay selected, but I’ll keep working on that. I might have to save the file.

I will say that I’ve added the macro tiddlers to the Getting Started default tiddlers (last), and that does load all of them. So if people are ok with those $:/ appearing then that will load them (like you said).

Again, thanks for the clarification and assistance,

Yes, sorry for the confusion, you need to click the save config at the bottom of the config page

If I recall correctly, when a macro is referenced, tiddlywiki should load the associated tiddler, so you should see the same behaviour for all macros, not only for the ximg one.

Yeah, that’s another way of doing it. Tiddlers on that list (only tiddlers for now) will be loaded at startup.

You’re welcome

Doh! I should have known to save the config. I just didn’t scroll down enough. Thanks for the reminder.

The macro’s do load when using the Getting Started trickery, but I also wanted to say (for completeness) that enabling the “fat tiddlers” also seems to work. (So thanks for that as well).

I consider this question(s) answered and I appreciate the assistance.

Glad you get it working!
Also I’m happy that we have two alternatives to fix this problem now.

Regards