SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: mzel on March 08, 2021, 12:38:06 am

Title: macro functions search vs find
Post by: mzel on March 08, 2021, 12:38:06 am
I am pretty sure this question must have been asked before, but I can not find the answer.
What is the difference between the search() and find() functions?
Title: Re: macro functions search vs find
Post by: Graeme on March 08, 2021, 07:13:42 am
If search looks like it does what you want you should call search rather than find  - it's a low level built in function that is called from find.  Lots of slick c code calls search but very little calls find.  The search command does very little apart from searching for a string in a buffer  - it looks like it can set up highlighting in the buffer (the # option) but it mostly doesn't affect the state of the editor.  The find command sets up default search options and fiddles with search options and selections, sets the mouse cursor to "busy" and handles multiple cursors plus it handles interactive command line search.

If you type
fp search
on the slick command line it will take you to builtins.e where you will find a prototype but no implementation.  The implementation is in the slick core (C++ code).  The file builtins.e is never compiled - it exists purely to help with tagging and show function call options etc.

If you type
fp find
you will see the implementation of the find function in search.e.

Also have a look at SlickCMacroBestPractices.pdf in the installation folder if you're new to macros.
Title: Re: macro functions search vs find
Post by: mzel on March 08, 2021, 01:16:15 pm
@Graeme - Thanks for a prompt answer!