item-list - Abbreviated search and list buffer contents.
item-list-find - Find the selected item in the item list
item-list-close - "Close the item list"
item-list-close (esc F7)
item-list performs a regular expression search of a buffer, presenting a list of the located text and associated types in a separate window which is presented to the left of the buffer window. item-list is a generic function that interacts with the buffer environment variables to present abbreviated buffer information to the user.
The regular expression search strings are predefined in the language templates. To add support for a new buffer type a list of search/replace strings must be created. The search strings must use regex (magic mode) and groups \(..\) to place the located object string into the replace string. Within the template buffer search strings (s) and replace (r) are defined with the following syntax:-
set-variable .hookname.item-list-sx "regexp"
set-variable .hookname.item-list-rx "replace"
On invocation of item-list the buffer is searched and the results are presented in the *item-list* window appearing at the left-hand side of the window. If there is no item list set up for the file type then an error message is displayed.
The user may interact with the *item-list* buffer using the mouse or <RETURN>, on selecting a line then the user is moved to the corresponding line in the original buffer.
item-list-find finds the current item list item and searches for the text in the original buffer. This is typically bound to a mouse or key stroke action.
item-list-close closes the item list buffer.
The following example works through the item-list definition for the ME macros e.g. given that the ME macro definition is:
Searching for "define-macro \([a-z-]+\)" and replacing with "Macro \1" will work most of the time. The space between define-macro and the name does not have to be a single space and the name does not have to contain just lower case letters, so these search strings should be a flexible as possible, try
This however is not as optimal as it could be and if you have large files this could become slow. Performance can be greatly increased if it can be anchored to the start of the line, e.g.
but to allow for initial white spaces and the optional numeric argument, you really need
"^\s *[0-9]*\s *define-macro\s +\(\w+\)"
To hilight the function name you need the name encased the name in a magic hilighting string,
where \e is an escape char, so the replace string should be
Now all thats needed is to set these variables as fhook command variables, for macro files, the file hook command is fhook-emf, therefore the following is required:
set-variable .fhook-emf.item-list-s1 "^\\s *[0-9]*\\s *define-macro\\s +\\(\\w+\\)" set-variable .fhook-emf.item-list-r1 "Macro \ecB\\1\ecA"
Note that you can have as many of these search and replace variables as you require, i.e. .item-list-s1, .item-list-s2, .item-list-s3, ... ; but the more you have the slower it will be, often a good regex can do the job of 2 or 3.
Copyright (c) 1998-2006 JASSPA
Last Modified: 2002/01/11
Generated On: 2006/10/07