{{{  comments
; These are macros to compile code and move to error while using origami.
;
; call-make
;  runs the command 'orimake', which should be your compiler-call.
;  This command must pipe its output to the file $ORIAREA. The
;  environment-variable ORIAREA must be set from your shell to a proper
;  value (for example $HOME/.oa.$HOSTNAME.`basename $TTY`)
;  The File $ORIAREA will be displayed in a extra window using the menu-xx
;  macros.
;
; call-make-error
;  tries to reach the error, marked in the menu. If oripager can get the
;  correct error-position, origami will push the file onto the file-stack
;  and move the cursor to the errorline. Maybe you have to set the environment-
;  variable ERRORFORMAT (sun-gcc for example) to the format of your compiler.
;  If you want to use this macro, you have to add the call
;   new-file-make-hook
;  to your newfile-macro.
}}}
@if-using not(MAKES)
  @use (MAKES)
  {{{  libs
  {{{F fun/error
  :::F fun/error
  }}}
  {{{F fun/opagemenu
  :::F fun/opagemenu
  }}}
  }}}
  {{{  vars
  ( defvar
     ( make-go-line ; which line should be displayed, after pushing the errorfile
     )
  )
  }}}
  {{{  call-make
  ( deffun call-make
     (
       {{{  call the make
       shell-command
         "orimake
       newline-and-indent
       newline-and-indent
       }}}
       menu-start
     )
  )
  }}}
  {{{  call-make-error
  ( deffun call-make-error
     ( if counter>0 menu-position
        (
          {{{  open kbd-pipe
          pipe-kbd-from-command "oripager "  "-b counter area-position
                                          "  "-l counter area-length
                                          "  "-o counter menu-position
                                          "  "-f$ERRORFORMAT
          newline-and-indent
          }}}
          {{{  try to enter error-file
          prompt-counter make-go-line "?
          if counter>0 make-go-line
           {{{  initialise the enter
           (
             {{{  save file
             if test-file-changed
              ( save-file
                if test-file-changed
                 ( set-counter make-go-line 0
                   message-exit
                    ( M_NO_SAVE_CANCEL "and "  "enter "  "canceled )
                 )
                fi
              )
             fi
             }}}
             beginning-of-fold
             end-of-line
             newline-and-indent
             set-file-unchanged
             enter-fold
             exit
           )
           }}}
          else
           {{{  error-exit
           ( failed )
           }}}
          fi
          }}}
        )
       fi
     )
  )
  }}}
  {{{  new-file-make-hook
  ( deffun new-file-make-hook
     ( if counter>0 make-go-line
        ( goto-line counter make-go-line newline-and-indent
          set-counter make-go-line 0
        )
       fi
     )
  )
  }}}
@fi
