home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / p / pcqpascalv1.2d.lha / Scripts / EMACS.errors < prev    next >
Encoding:
Text File  |  1991-09-02  |  2.5 KB  |  107 lines

  1.  
  2. ; This is part of the error handler for the PCQ make utility and
  3. ; Daniel Lawrence's MicroEMACS.  To use this system, add the
  4. ; following line to your PCQ.CFG file:
  5. ;
  6. ;    CompilerError EMACS-ShowError \s \d \e
  7. ;
  8. ; Then attach this file to the end of your EMACS.RC file (that's
  9. ; the configuration file for MicroEMACS).
  10.  
  11. ; When PCQ invokes MicroEMACS to display your source file, it will
  12. ; position the cursor to the appropriate place in the file and write
  13. ; an error message.  To see the next error message, press Shift-F9.
  14. ; When you have seen all the errors, you will get the message
  15. ; "No more errors".
  16.  
  17. store-procedure nexterror
  18.  
  19.     ; get current name in case we switch back
  20.  
  21.     set %buffer $cbufname
  22.  
  23.     ; switch to the buffer that holds our error commands
  24.  
  25.     select-buffer EMACS-Error
  26.     beginning-of-line
  27.  
  28.     ; if this line does not have the At string, we have done all the errors
  29.  
  30.     !if &equal 0 &sindex $line "~" At "
  31.         write-message "No more errors"
  32.     select-buffer %buffer
  33.         !return
  34.     !endif
  35.  
  36.     ; remember that the format of the error string will be:
  37.     ;       "sourcefilename" At #,# : Error Text
  38.  
  39.     ; get the source file name into %errorline
  40.  
  41.     set $curcol &sindex $line "~" At"
  42.     set %errorline &mid $line 2 &sub $curcol 2
  43.  
  44.     ; get the line number into %line
  45.  
  46.     set $curcol &add 4 &sindex $line " At "
  47.     set %line &sub &sindex $line "," $curcol
  48.     set %line &mid $line $curcol %line
  49.  
  50.     ; get the column number into %column
  51.  
  52.     set $curcol &add 1 &sindex $line ","
  53.     set %column &sub &sindex $line " : " $curcol
  54.     set %column &mid $line $curcol %column
  55.  
  56.     ; get the error message into %errortext
  57.  
  58.     set $curcol &add 2 &sindex $line " : "
  59.     set %errortext &add 1 &sub &length $line $curcol
  60.     set %errortext &mid $line $curcol %errortext
  61.  
  62.     ; set up for next call to nexterror
  63.  
  64.     next-line
  65.  
  66.     ; display error in source file
  67.  
  68.     find-file %errorline
  69.     goto-line %line
  70.  
  71.     ; move right.  This makes tabs easier to work with
  72.  
  73.     !while &greater %column 0
  74.         forward-character
  75.     set %column &sub %column 1
  76.     !endwhile
  77.  
  78.     ; write the error message
  79.  
  80.     write-message %errortext
  81. !endm
  82.  
  83.  
  84. ; we will only set up the nexterror stuff if there is an
  85. ; error file waiting to be processed.
  86.  
  87.  
  88. !if &exist T:EMACS-Error
  89.  
  90.     ; load up the error file
  91.  
  92.     find-file T:EMACS-Error
  93.     beginning-of-file
  94.  
  95.     ; bind nexterror to the Shift-F9 key
  96.  
  97.     11 store-macro
  98.     run nexterror
  99.     !endm
  100.     bind-to-key execute-macro-11 FNx
  101.  
  102.     ; display the first error
  103.  
  104.     run nexterror
  105. !endif
  106.  
  107.