Hello David,
 Yes, the new subfilter operator can check if a macro/variable is defined 
(exist) or not!
It works in TW5.1.20pr.

Example

\define VAR_NAME() This is a test macro


<$list filter="[[VAR_NAME]] +[is[variable]addsuffix[ is a variable]] 
~[[Undefined variable or macro 'VAR_NAME']]">
<<currentTiddler>>
</$list>

<$list filter="[[VAR_NAME2]] +[is[variable]addsuffix[ is a variable]] 
~[[Undefined variable or macro 'VAR_NAME2']]">
<<currentTiddler>>
</$list>


Results:


VAR_NAME is a variable



Undefined variable or macro 'VAR_NAME2'



So, it works. Note that, VAR_NAME2 is not existed!


--Mohammad


On Tuesday, February 26, 2019 at 10:19:06 PM UTC+3:30, David Nebauer wrote:
>
> I'm glad my question has led to something useful for others. 
> Unfortunately, my original question has not been answered. Is there any way 
> to use Jeremy's new subfilter to display an error message if a specified 
> macro is undefined? (Thanks, Mal, for your efforts.)
>
> Alternately, if it is still not possible, even with the new subfilter, I'd 
> appreciate having that confirmed.
>
> David.
>
> On Wed, 27 Feb 2019 at 00:31, Mohammad <mohammad...@gmail.com 
> <javascript:>> wrote:
>
>> Thanks for clarification!
>>
>> --Mohammad
>>
>> On Tuesday, February 26, 2019 at 3:38:07 PM UTC+3:30, Jeremy Ruston wrote:
>>>
>>> Hi Mohammad
>>>
>>> The reason that we don’t use the “[<macro>]” formulation here is because 
>>> we don’t want to retrieve the value of the macro, we want to get its name 
>>> as a string.
>>>
>>> Best wishes
>>>
>>> Jeremy
>>>
>>> On 26 Feb 2019, at 11:57, Mohammad <mohammad...@gmail.com> wrote:
>>>
>>> Hello again Jeremy,
>>>
>>> Look at below code
>>>
>>> \define macro(VAR_NAME)
>>> test
>>> \end
>>>
>>> <$list filter="[[macro]] +[is[variable]addsuffix[ is a variable]] 
>>> ~[[Undefined variable or macro 'VAR_NAME']]">
>>> <<currentTiddler>>
>>> </$list>
>>>
>>>
>>> Why the syntax needs variable like Tiddler title, I expect to have macro 
>>> or variable as below
>>>
>>>
>>> <$list filter="[<macro>] +[is[variable]addsuffix[ is a variable]] 
>>> ~[[Undefined variable or macro 'VAR_NAME']]">
>>> <<currentTiddler>>
>>> </$list>
>>>
>>> I mean, using angle bracket.
>>>
>>> --Mohammad
>>>
>>> On Tuesday, February 26, 2019 at 12:25:58 AM UTC+3:30, Jeremy Ruston 
>>> wrote:
>>>>
>>>> Hi David
>>>>
>>>> Try:
>>>>
>>>> [[VAR_NAME]] +[is[variable]addsuffix[ is a variable]] ~[[Undefined 
>>>> variable or macro 'VAR_NAME']]
>>>>
>>>> [[currentTiddler]] +[is[variable]addsuffix[ is a variable]] 
>>>> ~[[Undefined variable or macro ‘currentTiddler']]
>>>>
>>>> You can try out these examples in the “filter” tab of advanced search 
>>>> in the prerelease:
>>>>
>>>> https://tiddlywiki.com/prerelease/#%24%3A%2FAdvancedSearch 
>>>> <https://tiddlywiki.com/prerelease/#$:/AdvancedSearch>
>>>>
>>>> Best wishes
>>>>
>>>> Jeremy.
>>>>
>>>> On 25 Feb 2019, at 20:49, David Nebauer <davidn...@gmail.com> wrote:
>>>>
>>>> Thanks, Jeremy. For future reference, would you mind showing how that 
>>>> subfilter could be used to test for the existence of a particular variable 
>>>> or macro, say 'VAR_NAME', and display the text "Undefined variable or 
>>>> macro 
>>>> 'VAR_NAME'" if it is not found.
>>>>
>>>> -David
>>>>
>>>> On Monday, 25 February 2019 22:39:23 UTC+9:30, Jeremy Ruston wrote:
>>>>>
>>>>> Hi David
>>>>>
>>>>> I think you’re right: there is no way to test for the existence of a 
>>>>> variable whose value is blank. I’ve added an [is[variable]] subfilter 
>>>>> operator for v5.1.20 to address this:
>>>>>
>>>>>
>>>>> https://github.com/Jermolene/TiddlyWiki5/commit/36e76429b1a1d4638374d513430393db5693b932
>>>>>
>>>>> Best wishes
>>>>>
>>>>> Jeremy.
>>>>>
>>>>>
>>>>> On 25 Feb 2019, at 12:34, David Nebauer <davidn...@gmail.com> wrote:
>>>>>
>>>>> As I understand it, if you attempt to call an undefined macro the call 
>>>>> fails silently, with nothing displaying in the tiddler to alert users. 
>>>>> This 
>>>>> occurs regardless of the calling method, i.e., 
>>>>>
>>>>> <<not-a-real-macro>>
>>>>> or
>>>>> <$macrocall $name="not-a-real-macro"/>
>>>>>
>>>>> *Is there a technique for checking whether a macro is defined, and 
>>>>> displaying a message in the tiddler if the macro is not defined?*
>>>>>
>>>>> Ideally, the test would not just check for *output* from the macro, 
>>>>> since there might be valid circumstances where a macro produces no output.
>>>>>
>>>>> -David
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "TiddlyWiki" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to tiddlywiki+...@googlegroups. <http://googlegroups.com/>com 
>>>>> <http://googlegroups.com/>.
>>>>> To post to this group, send email to tiddl...@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/tiddlywiki.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/tiddlywiki/1ecc0c93-5932-41bb-9634-3eca9daf26c1%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/tiddlywiki/1ecc0c93-5932-41bb-9634-3eca9daf26c1%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>>
>>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "TiddlyWiki" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to tiddlywiki+...@googlegroups.com.
>>>> To post to this group, send email to tiddl...@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/tiddlywiki.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/tiddlywiki/49d883c4-f2f7-434b-aaf7-5b1f0d21a29b%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/tiddlywiki/49d883c4-f2f7-434b-aaf7-5b1f0d21a29b%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "TiddlyWiki" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to tiddlywiki+...@googlegroups.com.
>>> To post to this group, send email to tiddl...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/tiddlywiki.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/tiddlywiki/6c5462a8-99ad-4133-86f3-199b3ac66737%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/tiddlywiki/6c5462a8-99ad-4133-86f3-199b3ac66737%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "TiddlyWiki" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/tiddlywiki/4rEuAWc4EpM/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> tiddlywiki+...@googlegroups.com <javascript:>.
>> To post to this group, send email to tiddl...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/tiddlywiki.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tiddlywiki/4580fe7a-9855-428b-8246-2ea56bcc2fae%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tiddlywiki/4580fe7a-9855-428b-8246-2ea56bcc2fae%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/2f01bf83-3ede-4942-9f50-cdd81a9284d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to