Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] filter prefixes don't properly set currentTiddler, I think #8178

Closed
flibbles opened this issue May 5, 2024 · 4 comments · Fixed by #8233
Closed

[BUG] filter prefixes don't properly set currentTiddler, I think #8178

flibbles opened this issue May 5, 2024 · 4 comments · Fixed by #8233

Comments

@flibbles
Copy link
Contributor

flibbles commented May 5, 2024

Describe the bug

Filter prefixes are turning out to be something I use often, not so much because they're elegant, but because they're able to set variables in the middle of a filter expressions, which can be crucial for some operations.

But I'm noticing strange behavior. While a filter run may set currentTiddler within its own run, it doesn't set it within functions called within that run, or anything within that run really.

Is that expected behavior that currentTiddler is only set superficially?

Expected behavior

old-current

new-current

When I would have thought it'd produce:

new-current

new-current

To Reproduce

\define currentTiddler() old-current

\function .inner() [<currentTiddler>]
\function .outer() new-current :map[function[.inner]]

\function .alone() new-current :map[<currentTiddler>]


<<.outer>>
<<.alone>>
@saqimtiaz
Copy link
Member

@flibbles can you confirm if this problem still occurs in the current pre-release?

See #7906

@flibbles
Copy link
Contributor Author

flibbles commented May 6, 2024

It appears to still be there. I take it then that this is indeed a problem to others?

@saqimtiaz
Copy link
Member

This is most definitely a bug.

Note that with #7906 applied the following works while it doesn't in the current stable release:

\define currentTiddler() old-current

\function .inner() [<currentTiddler>]

<$text text={{{ new-current :map[function[.inner]] }}}/>

The issue seems to crop up when a function invokes another function, unfortunately I don't have the opportunity to debug this at present.

This will fail:


\define currentTiddler() old-current

\function .inner() [<currentTiddler>]
\function .outer() new-current :map[function[.inner]]

<$text text={{{ [.outer[]] }}}/>

@Jermolene
Copy link
Member

Thanks @flibbles much appreciated – this seems to be an area that has been fertile in surfacing bugs...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants