Author Topic: Changing the file mode when using the same extension for different types of file  (Read 4147 times)

StephenW

  • Senior Community Member
  • Posts: 189
  • Hero Points: 21
I am sure I am not the only one who has to work with files that have the same extension but are actually of different types.  In my case, I have three different .inc file types in day-to-day use: PL/M header files, Intel assembler header files, and the in-house script language PAL header files.  SlickEdit was defaulting all of these files to Intel assembler, so initially I just changed that to be PL/M, as most of the .inc files I was dealing with were PL/M headers.  But as I worked on more projects, I kept on running across Intel assembler and PAL .inc files too, and not having them correctly colour coded and tagged was becoming a problem.  So eventually, I got around to writing a macro to deal with the problem by working out the correct mode from the file names and directory contexts.  It has matured nicely, and I thought there might be people out there who have the same problem and might like to use it as a template for their own needs.  It is unlikely to be usable directly, as it uses the way my company structures its projects to work out the correct mode.  But the ideas it uses are likely to be applicable, with a little tuning.  Anyway, here it is for anyone who wants to look at it.

If anyone has any suggestions for more or better ways of doing this, please let me know.