XEROX FBHINTS 2 4 1 FBHINTS 1 4 By: Hugh Messenger (Hippo.SBDERX@Xerox.COM) Requires: FILEBROWSER INTRODUCTION This module provides a mechanism for filling in new pattern descriptions in FileBrowsers from a pop-up menu. It allows dynamic additions/deletions to/from this menu. It was written because I got fed up with not having the XDE hack "Add HintMenus" in Lisp. Anyone who makes extensive use of FileBrowser for browsing lots of different remote hosts will probably find it useful. USAGE When this module is loaded it will destructively replace the function FB.NEWPATTERNCOMMAND. It will then look for a list (of strings) called FBHINTSLIST, which it will use to build its menu of file patterns. This list will be destructively sorted when the menu is created. If it doesn't find FBHINTSLIST it will create one with the single entry "{DSK}". From now on, whenever you select "New Pattern" from FileBrowsers "Recompute" menu option, a menu of all the patterns specified in FBHINTSLIST will pop up. What happens then depends on which button you select with: Left Button: This will stuff the pattern you selected into FileBrowsers default pattern, ie. if you selected {FOO:}LYRIC>LISPUSERS>*.*;* from the menu with the left button, FileBrowser will then prompt you as normal but using the pattern you selected as the default. I use this option when I want to enumerate something from a directory like LispUsers or Library, but I don't want to enumerate the whole directory. I can then backspace over the *.*;* and fill in the specific file I want. Middle Button: This will enumerate the pattern you selected straight away, without a New Pattern prompt as would happen with a Left Button. Use this when the pattern you selected is exactly what you want enumerated. Right Button: This will delete the item selected from the menu (and from FBHINTSLIST), then pop up the menu again. You can carry on deleting items till you run out or get fed up [NB. it will not let you delete the last pattern, as trying to create a manu with no items results in a divide by zero]. To get out, select an item with left or middle, or click outside the menu ... Clicking Outside the Menu: This will make FileBrowser resort to its original behaviour ... sort of. It will put up the new pattern prompt, using an unchanged default pattern. The only difference is that when you enter the new pattern, if this new pattern is not already in FBHINTSLIST, you will be prompted (with a mouse confirm) if you want this pattern added to the menu (and hence to FBHINTSLIST). The new [attern will be destructively sorted into FBHINTSLIST. GENERAL NOTES There is one aspect of this tool which I am not totally satisfied with, but can't really do much about without changing more of the behaviour of filebrowser. Note that the menu that pops up always has the patterns in DIRECTORY.FILL.PATTERN format. ie. even if your entry in FBHINTSLIST looks like "{MARSTONS:}LYRIC>", the entry in the menu will be "{MARSTONS:}LYRIC>*.*;*". This is slightly irritating if you want to do a middle button and directly enumerate the directory with FILING.ENUMERATION.DEPTH set to 1 - it won't find anything, or at least not on my server it won't, as everything in LYRIC> is a directory, and doesn't answer to the pattern *.*;*. You have to use the left button, then backspace over the *.*;* when FB prompts you for the new pattern. The addition of the *'s does serve one useful purpose, however. It does tend to remind you to backspace before completing a new pattern having used a left button to select the directory, ie. when adding a specific file name to something like [...]<...>LIBRARY>. If you didn't backspace you would of course end up deleting the default pattern ... My FBHINTSLIST is set up in my INIT file, and loooks like this: (SETQ FBHINTSLIST '("{BARTLETT:EUROPARC}*.*;*" "{CANCER:AISSOUTH:XEROX}*.*;*" "{DSK}*.*;*" "{FLOPPY}*.*;*" "{FULLERS:}*.*;*" "{FULLERS:}*.*;*" "{MARSTONS:}*.*;*" "{MARSTONS:}LYRIC>*.*;*" "{MARSTONS:}LYRIC>LIBRARY>*.*;*" "{MARSTONS:}LYRIC>LISPUSERS>*.*;*" "{MAXWELL:EUROPARC}*.*;*" "{NEWTON:EUROPARC}*.*;*" "{PALLAS:AISNORTH:XEROX}LYRIC>*.*;*" "{PALLAS:AISNORTH:XEROX}LYRIC>*.*;*" "{PISCES:AISSOUTH:XEROX}*.*;*" "{TAURUS:AISSOUTH:XEROX}*.*;*") Note that you don't need the *.*;* stuff in your FBHINTSLIST, this will be added automatically when the menu is created. INTERNALS The only variable of any interest is: *USEFBHINTS* [Variable] which determines on a global basis whether to use the FBHINTS menu or not. Initially set to T. If set to NIL Filebowsers will resort to their usual behaviour when New Pattern is selected. I considered implementing this on a per-Filebrowser basis, but couldn't think of a suitable way of doing it without adding to the already crowded FB Commands menu. Any suggestions welcome. The functions and variables used internally are: (FBHINTS.NEWPATTERNCOMMAND BROWSER) [Function] This replaces FB.NEWPATTERCOMMAND by a (MOVD 'FBHINTS.NEWPATTERNCOMMAND 'FB.NEWPATTERNCOMMAND) in the COMS. (FBHINTS.FBHINTSMENUWHENSELECTEDFN ITEM MENU BUTTON) [Function] This is the WHENSELECTEDFN associated with FBHINTSMENU. It always returns a list of (BUTTON ITEM), and handles the deletion of items from the menu. (FBHINTS.STRING-MEMBER X LST) [Function] Member function using STRING-EQUAL. Returns X if found else NIL. ÿÿïf FBHINTS uses no CL so can be recompiled for Koto.ÿ ÿÿïf Any ÿ comments, suggestions, bugs etc more than welcome ... this is my first attempt at Interlisp. (LIST ((PAGE NIL (PAPERSIZE LETTER STARTINGPAGE# 87) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO NIL) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE NIL . LETTER) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO NIL) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE NIL . LETTER) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO NIL) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL)))))(È(È (È(ŠŠ8(ŠŠ8DÈÈ PAGEHEADING RUNNINGHEADMODERN  HELVETICA MODERN MODERN MODERN MODERNLOGO HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN - |H äÊ n¸n@y &  }1 m$ • Bm`Glzº