Do you have any ideas on how to improve Everything 1.5 syntax?

Discussion related to "Everything" 1.5 Alpha.
Post Reply
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Do you have any ideas on how to improve Everything 1.5 syntax?

Post by Stamimail »

There are some old threads about Everything syntax:
viewtopic.php?f=4&t=6057
viewtopic.php?f=2&t=6176
viewtopic.php?f=5&t=6417
In 1.5 the syntax evolved further, and things like Preprocessor were added, making the syntax design more complex and with more considerations to be taken into account.
I think the syntax needs more discussion to make it more intuitive and simple.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Do you have any ideas on how to improve Everything 1.5 syntax?

Post by Stamimail »

void wrote: Please feel free to quote me on anything I've said in these private messages.
void wrote:The preprocessor syntax has changed again in 1253a.
The syntax is now:
#function:(arg1,arg2,...)

I tried the #function(): syntax, but didn't like how some functions take parameters after the colon and others before, for example: #quote:#stem(c:\program files\Everything\Everything.exe):

The tricky part with #function:(text) will be escaping the terminating ), which can be done by using double quotes:
example: #quote:#stem("c:\program files (x86)\Everything\Everything.exe"):
-Note the path is quoted, ")" in (x86) will be treated as literal.

You can also use < and > in place of ( and )
For example: #function:<arg1,arg2,...>
This will make the preprocessor feel and function similar to the normal Everything search syntax.
However, I prefer ( and ) as this will mostly be used from the command line and escaping < and > is a pain.
Try to make a special command that will Redefine the escape characters or keywords of the syntax.
There is one already. Although I would like a shorter variant.

#escaperegex:(c:\program files\Everything)
is replaced with:
c:\\program files\\Everything

-maybe #r:() as a short variant? -or this might be better to inject regex into a normal search, eg:
#r:(^)startoffilename
One area that needs more thought is an auto quote option for some preprocessor functions.
This is different to escaping regex.
I'll give an example:

regex:#escaperegex:("c:\program files\Everything")
is replaced with:
regex:c:\\program files\\Everything

-Note the space in c:\\program files\\Everything, this will break the regex search term.

Even though I quoted the original text, the replaced text is not quoted.
Using #quote: the spaces are quoted:

regex:#quote:#escaperegex:("c:\program files\Everything")
is replaced with:
regex:c:\\program" "files\\Everything

-What I want here is a shortcut to avoid having to type #quote:
void
Developer
Posts: 15675
Joined: Fri Oct 16, 2009 11:31 pm

Re: Do you have any ideas on how to improve Everything 1.5 syntax?

Post by void »

Thanks for creating this thread Stamimail,
I suggest to make the functions syntax with a (customizable) prefix (and also suffix) something like

:functionname:
or
/functionname/
or
/functionname: (maybe this is the preferred syntax for functions)
or
/functionname= (maybe this is the preferred syntax for the ini file settings)
etc
Everything 1.5 does support a : prefix with search functions.

For example:

:size:

The plan here is when you type in :s Everything will suggest search functions starting with s.
Currently we need to use this syntax to get it work:
ext:mp3;mp4;wav

IMHO, it can be improved for making it more intuitive.
These should also work:
1. ext:.mp3;.mp4;.wav
2. ext:mp3|mp4|wav (should be a difference between a | without a leading space and <space>|)
3. ext:<mp3|mp4|wav>
Support for 1. ext:.mp3;.mp4;.wav added in Everything 1.5.0.1254a.
Support for 2. ext:mp3|mp4|wav is not supported as users have the following search filters: ext:mp3|folder:
Support for 3. ext:<mp3|mp4|wav> already exists (via group expansion)

dm:<jan|feb|mar> will work already.
I will consider support for: dm:jan;feb;mar

Thanks for the suggestions.

As for the preprocessor, I'm leaning towards the following syntax:
#name:<text>

Nothing is set in stone yet.
The syntax may change to make it easier to use from the command line/registry.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Do you have any ideas on how to improve Everything 1.5 syntax?

Post by Stamimail »

Can you show some examples for
preprocessor in the multi-file renamer,
how it will look like (according to the current syntax), for what you think will be some of the most common tasks?
void
Developer
Posts: 15675
Joined: Fri Oct 16, 2009 11:31 pm

Re: Do you have any ideas on how to improve Everything 1.5 syntax?

Post by void »

Some examples that will work with Everything 1.5.0.1254a and later:



Old format: img%1.jpg
New format: img%1-#width:x#height:.jpg



Old format: Windows %1.wav
New format: Windows %1 (#number: of #count:).wav



Old format: %1.lnk
New format: #titlecase:<%1>.lnk
for what you think will be some of the most common tasks?
Hard to say, the most suggested commands have been:
#titlecase:<>
#number: and #count:
#width: and #height:
void
Developer
Posts: 15675
Joined: Fri Oct 16, 2009 11:31 pm

Re: Do you have any ideas on how to improve Everything 1.5 syntax?

Post by void »

Everything 1.5.0.1255a adds full preprocessor support to the multi-file-renamer.

You can now use #eval: and #text: to calculate new numbers.

For example, increment the number in filenames by one:



You can also now add almost all properties from the > button to the right of the New Format.

I'm still undecided if the preprocessor should support ( and ).
Escaping < and > from the command line is easy enough with double quotes or ^< and ^>
NotNull
Posts: 5334
Joined: Wed May 24, 2017 9:22 pm

Re: Do you have any ideas on how to improve Everything 1.5 syntax?

Post by NotNull »

There will always be issues if commands and data are not separated and all will be regarded as text. Look at CMD for example.

I think this is important and will come back to it, but my suggestion(s) for now would be:
  • Don't use <> as they need escaping in most cases, causing complications
  • Dont use () as they have special meaning in CMD and Powershell. Ergo: more escaping
  • Loose the : in #function: as it makes it less readable (or is it needed for checking if something is a function or regular text?)
First take on this: Use syntax
'"#function["text", "parameter2", number, #otherfunction["text"]]"'


The singlequote+doublequote ... doublequote+singlequote
'" "'
will be expanded as follows:

Code: Select all

PowerShell:

PS T:\> echo '"#function["text `more %windir%`"]"'
"#function["text `more %windir%`"]"
PS T:\>


CMD:

T:\>for /f "usebackq delims=" %x in (` echo '"#function["text `more %windir%`"]"'`) do @echo %x
'"#function["text `more C:\WINDOWS`"]"'
When the "commands" arrive in Everything, trim the singlequotes and the doublequotes.


This still has issues, for example when a filename contains
'text'
in the name, but this has to do for now.
void
Developer
Posts: 15675
Joined: Fri Oct 16, 2009 11:31 pm

Re: Do you have any ideas on how to improve Everything 1.5 syntax?

Post by void »

Thanks for the feedback NotNull,

Preprocessor text inside ' " ... " ' might work.
Double quotes can be tricky to escape from the command line and registry.

You would no longer need the # or : with your ' " ... " ' method:

Code: Select all

'"function["text", "parameter2", number, otherfunction["text"]]"'
Loose the : in #function: as it makes it less readable (or is it needed for checking if something is a function or regular text?)
One of my main priorities for the preprocessor is to be compatible with the Everything Search.
This means the preprocessor syntax cannot match a valid filename.

Your ' " ... " ' method would be fine as " cannot be in filenames.

For the current method, the colon will be necessary to avoid filename collisions.
#function: cannot appear in a filename.

There are still possible issues with other property/content searches.
For example, if I want to search for #function: inside a txt file I would need to escape the # or the :
content:#num:function:
content:#function#colon:
content:#"function":
content:#""function"":
etc..

It would be nice to keep the syntax consistent in the search box, multi-file-renamer, open commands, Windows caption formats, macros and from the command line.
However, I realize it might be necessary to use a different syntax from the command line.

It's important to note I'm not trying to replace powershell or other higher level calling language.

Current use cases:
/window_title_format=#if:<#isadmin:,^>$t $v
#replaceterms:#<:search:#>:,#<:<#term:|tag:#term:>#>:
#height:
Post Reply