Using the task list for bookmarks in embeds

Although I spend a lot of my Clarion programming time writing classes and unit tests for those classes, I also spend a certain amount of time in regular Clarion procedures, navigating back and forth between embeds (in the embeditor, naturally). 

The more embeds I'm using, the more jumping around I tend to do. If the embeds are close together it's no big problem. If they're all over the procedure it's more of a hassle to quickly get to where I need to be. 

The Clarion IDE does have a nifty bookmarking capability - just press Ctrl-F2 on any line and a bookmark appears in the bookmarks list. (Ctrl-F2 again to remove the bookmark, or click on the ilttle button icon that appears to the left of the line number.) Double click on the bookmark to go to that line in the source; if the file isn't open the IDE will open it for you and take you to that line. Bookmarks are persistent for source files, so they'll be there the next time you load that project.

But what about APPs? It turns out that bookmarks work within the embeditor:

But as soon as you close the embeditor any bookmarks you've created in that procedure disappear from the bookmarks view. 

A bookmarking workaround for apps

There is however an easy way to create persistent bookmarks for embed points. Go to Tools | Options | Task List and add a token called BOOKMARK (or any other text you like):

Anywhere you want a bookmark in your code, put the text

!BOOKMARK

followed by whatever text you want to appear in the bookmark. You might add something descriptive such as a routine name:

!BOOKMARK BRW1::EIPManager.SaveOnChangeAction

With the embeditor open, view the task list and look for lines that begin with BOOKMARK. Double-click on any item to jump to that location in the code. 

The downside

This is a neat trick, but it does have couple of issues.

For one, the bookmarks only show up when you're in the embeditor. 

For another, once the code is generated you may find that you have duplicated line entries:

This is because the IDE is showing you both the embeds in the embeditor and in the generated source. To avoid confusion click on the File header to sort the list in file order - that way you'll at least have all of the embeditor bookmarks in the same location. 

There's another issue, which is that unlike the bookmarks list, which a tree view, this is a straight list of tasks and you can't hide tasks from other files by collapsing a tree node. 

And finally this list contains all tasks - if you have !TODO entries in your code they'll show up along with your bookmkarks. 

That said, this is still a useful trick and can be a real timesaver if you're spending a lot of time in a procedure and you need to regularly move between distant embed points.Â