Understanding Macros, but first Filters

General discussion related to "Everything".
Post Reply
ChrisGreaves
Posts: 684
Joined: Wed Jan 05, 2022 9:29 pm

Understanding Macros, but first Filters

Post by ChrisGreaves »

(1) In Everything, there are many types of macros
(2) But in particular a macro can be applied to/as a filter. Is this correct?
(3) A Filter is a predefined search string
Filters_01.png
Filters_01.png (34.05 KiB) Viewed 3851 times
(4) This is ***a*** definition of a filter.

(5) The filter will generate a search for my surname "Greaves" amongst the 365.022 objects in my system.
(6) The Filter's name/identifier is "Christopher"

(7) If I choose I can assign a macro name to this filter.
(8) I have chosen the macro name "chris" for this filter.

(9) If I choose I can assign a shortcut key combination to this filter
(10) I have chosen Ctrl+Alt+C as the shortcut key.

(11) Excepting that I have assigned the macro name "chris" to the filter "Christopher" and as well assigned the shortcut combination Ctrl+Alt+C to the filter "Christopher", the macro and the shortcut combination have no relationship.
(12) To find objects that hold my surname I can hold down the Ctrl and Alt keys and tap the letter C
(13) To find objects that hold my surname I can type "chris:" without the quotes in the search box

This is not a complete and rigorous definition of a filter, a macro, or a shortcut key combination, but please and thank you, is the above set of statements correct as it stands?
I am trying to generate a spine to support further aspects of filetsr/macros/shortcuts.

Thanks, Chris
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Understanding Macros, but first Filters

Post by void »

(2) But in particular a macro can be applied to/as a filter. Is this correct?
A Macro is a text shortcut for your filter.

A filter can define one macro.
If the macro is an empty string, no macro is defined.

Filter macros can be accessed from an Everything search with <macro-name>:

<macro-name>: is expanded to the search specified in your filter.

In your screenshot, your macro is: Chris
If you search for: chris:
Everything will expand this to: Greaves


is the above set of statements correct as it stands?
Yes, your definition is good.
ChrisGreaves
Posts: 684
Joined: Wed Jan 05, 2022 9:29 pm

Re: Understanding Macros, but first Filters

Post by ChrisGreaves »

void wrote: Thu Feb 02, 2023 8:56 am Yes, your definition is good.
Thank you David. Now my Hidden Agenda is revealed! :twisted:

While working through https://www.voidtools.com/support/everything/searching/ I came across this, but could not make them work as they are shown here:-
Untitled.png
Untitled.png (6.08 KiB) Viewed 3815 times
I think that these macros are now known as "Character Entities".
Is this correct?
I searched the forums for a post where the naming has changed but couldn't find a relevant announcement.

Of course I got confused, because my first introduction to the term "macro" was that of a labeled chunk of text that expanded inline in a pre-processor, but since Microsoft trampled all over that definition :x , it has come to mean what we used to call Subroutines.

I suspect that the page at https://www.voidtools.com/support/everything/searching/ needs a tiny edit, is all.
Thanks, Chris
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Understanding Macros, but first Filters

Post by void »

I came across this, but could not make them work as they are shown here
What happens? -do you get zero results?
Some of these characters are not valid in filenames and work best with other functions, such as content:quot:


I think that these macros are now known as "Character Entities".
Is this correct?
Yes, these are character entities.

For Everything 1.4, I would leave these defined as Macros as they are parsed that way.

Everything 1.4 has quirks with these character entities.
For example: quot:abcquot: doesn't work, you need to break the text with ""
For example: quot:abc""quot:



I'll define these correctly as character entities in the next Everything 1.5 alpha update.
For Everything 1.5, the syntax changes slightly to &<character-entity-name>:

I'll update the support wiki to match once Everything 1.5 is closer to release.
ChrisGreaves
Posts: 684
Joined: Wed Jan 05, 2022 9:29 pm

Re: Understanding Macros, but first Filters

Post by ChrisGreaves »

void wrote: Thu Feb 02, 2023 11:02 am
I came across this, but could not make them work as they are shown here
What happens? -do you get zero results?
I forgot to mention that I am using 1.5.0.1333a. I am sorry.

I got zero results using :quot: , I suspect for the reasons you give.
I got ideal results with #quot: (I think it is).
So I can now get Character Entities to work. I just have to work out (and give examples) of how to use them to solve a real problem!

Thanks again
Chris
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Understanding Macros, but first Filters

Post by void »

:quot: will not work, you'll need to use quot:
The quot: syntax has limitations.
You cannot easily combine with other text.

The recommended syntax for Everything 1.5 is: &quot:

#quot: is a preprocessor character entity.
While both are replaced with: " there is a difference:

The preprocessor character entity #quot: is expanded before the search is executed.
&quot: is expanded after the search terms are parsed.

With:
#quot:abc 123#quot:
the quotes are not treated literally and will escape the space.

With:
&quot:abc 123&quot:
the quote are treated literally.
ChrisGreaves
Posts: 684
Joined: Wed Jan 05, 2022 9:29 pm

Re: Understanding Macros, but first Filters

Post by ChrisGreaves »

void wrote: Thu Feb 02, 2023 11:28 am The recommended syntax for Everything 1.5 is: &quot:
#quot: is a preprocessor character entity.
Thanks Void. I get the feeling that quot: was an early development, superseded by two forms &quot: and #quot:
Is that correct?
Cheers, Chris
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Understanding Macros, but first Filters

Post by raccoon »

ChrisGreaves wrote: Tue Feb 07, 2023 8:52 pm I get the feeling that quot: was an early development, superseded by two forms &quot: and #quot: Is that correct?
&quot: is a unicode html character entity, like &gt: and &lt: and &amp: and &#169: or &#xa9:

#quot: is also a unicode html character entity, but is rendered in the pre-processor (pre parsing pass), which is a difficult topic to discuss and takes examples and experimentation. You can build normal time functions with pre-processor character entities and pre-processor functions, to make your functions more dynamic in nature. (I'm pretty sure pre-processor character entities are just pre-processor functions with a static return.)

quot:string is a real function that is evaluated in normal time by wrapping the passed string parameter in quotes. (edit)
quot: is the same as &quot: but deprecated (obsolete).

quote:string is a real function that is evaluated in normal time by wrapping the passed string parameter in quotes.
Last edited by raccoon on Wed Feb 08, 2023 5:01 pm, edited 1 time in total.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Understanding Macros, but first Filters

Post by void »

Thanks Void. I get the feeling that quot: was an early development, superseded by two forms &quot: and #quot:
Is that correct?
Yes, correct.

quot: is still supported.
However, it's quirky to use with text, so &quot: will be recommended in Everything 1.5 and later.


quot:string is a real function that is evaluated in normal time by wrapping the passed string parameter in quotes.
quot: is a character entity.
quote:<parameter> is the preprocessor function that quotes any spaces/special-characters in the specified parameter.
ChrisGreaves
Posts: 684
Joined: Wed Jan 05, 2022 9:29 pm

Re: Understanding Macros, but first Filters

Post by ChrisGreaves »

raccoon wrote: Wed Feb 08, 2023 12:42 am &quot: is a unicode html character entity, like &gt: and &lt: and &amp: and &#169: or &#xa9:
#quot: is also a unicode html character entity, but is rendered in the pre-processor (pre parsing pass), ...
quot:string is a real function that is evaluated in normal time by wrapping the passed string parameter in quotes.
Thank you Raccoon. Everything is becoming clearer day by day.
I am reserving pre-processing for a separate week.(grin)
Cheers, Chris
Post Reply