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

Open
flibbles opened this issue May 5, 2024 · 4 comments
Open

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

flibbles opened this issue May 5, 2024 · 4 comments

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
Contributor

@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
Contributor

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
Owner

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

No branches or pull requests

3 participants