Childlike in Its Simplicity

, , , Sunday, December 21, 2008

Over many years, I've used different versions of the "jump_srch" macro as a productivity enhancer.

The example of jump_srch code below is rudimentary and only involves quick searching between two MDI windows. I plan to add more complete versions in the near future. This macro can be made much more versatile and powerful, incorporating such tasks as automatic insertion, deletion, checking and indexing of text between windows. For now, you're getting it in its bare bones flavor. Please don't laugh too loud when you see the actual macro. We all have to start somewhere!

The base use of the macro is to employ find and next_window commands between two visible Slickedit MDI windows. The two windows can contain the same buffer (aka "file") or two different buffers. I haven't used this macro in more than two windows at a time, although I
suppose you could cycle the cursor through however many windows you want. FYI: I always have "one file per window" turned OFF. I don't know if the macro would be adversely affected by having it turned ON.

How it works: with your cursor on a text string in Window A, you press the key binding for jump_srch and the cursor jumps to Window B and locates the next matching search string, if any, in Window B. You can, if you like, continue searching for the same string in Window B or you can return to Window A and go on your merry way.

I use the binding "Ctrl-G" to find the next instance of a search term within a single file. To move my cursor back to Window A from Window B, I use a simple key binding for next_window. In my case, next_window is bound to "Ctrl-Tab." In other words, you use jump_srch to seek the string in the other window, and then you use next_window to return to the first window. This is handy when you need to locate or cross-check certain words or phrases which appear in both files or both windows.

Here's an example of tasks for which this macro can be useful. Please forgive the use of jargon from the book publishing industry, which is where I've used this macro most often.

/*---------------------------------------------------------------*/

How to Automate Cross-checking of References and Citations
in Publication Drafts

There are two basic goals in cross-checking literary references;
these are:

1) to verify that every reference appearing in the main section of the
document (body text, tables, figures, etc.) has a corresponding
citation in the section designated to hold a comprehensive listing
of citations (this is usually titled References, and appears as a
component of the back matter)

2) to verify that every citation in the References section has a
corresponding reference in the main section of the document

These two sections are typically maintained in two separate text files.
This facilitates creation of a system for automating
the process of checking crossreferences . . .
/*---------------------------------------------------------------*/

jump_srch, barebones version:
// put the current word into a variable, jump to the next open window, and find the text in that window
// todo etc.
// make it work with any selected current word or phrase or line

// whether the cursor is in or at the start of a word; selected or not
// allow for omore than 2 windows, etc
// pass cmdline parameters to search command

_command void jump_search(...) name_info(',')
{
_str keywd=cur_word(stuff);
message(something);
next_window();
search(something);
}

0 comments:

Post a Comment

GlossyBlue Blogger by Black Quanta. Theme & Icons by N.Design Studio
Entries RSS Comments RSS