Loading ...
Sorry, an error occurred while loading the content.

RE: two :make's in a function

Expand Messages
  • Suresh Govindachar
    ... Can t it just be done? What happens if you add the lines: let foo = `make` echo foo and run cases when make succeeds and when make fails? Or doesn t
    Message 1 of 7 , Sep 28, 2007
    • 0 Attachment
      > problem is that if there is an error during the
      > make, it goes right on and executes the second make.
      > I would prefer to check if the first make failed and
      > exit out appropriately. is there anyway to do that?

      Can't it just be done? What happens if you
      add the lines:

      let foo = `make`
      echo foo

      and run cases when make succeeds and when make fails?
      Or doesn't vim-script allow backticks to be used that way?

      --Suresh


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Tom Flynn
      ... not sure, i m still a bit of a noob with vim scripting. the getqflist() looks promising. i ll give that a shot too. thanks for the suggestions! -tom ...
      Message 2 of 7 , Sep 28, 2007
      • 0 Attachment
        On 9/28/07, Suresh Govindachar <sgovindachar@...> wrote:
        >
        >
        > > problem is that if there is an error during the
        > > make, it goes right on and executes the second make.
        > > I would prefer to check if the first make failed and
        > > exit out appropriately. is there anyway to do that?
        >
        > Can't it just be done? What happens if you
        > add the lines:
        >
        > let foo = `make`
        > echo foo

        not sure, i'm still a bit of a noob with vim scripting. the
        getqflist() looks promising. i'll give that a shot too. thanks for
        the suggestions!
        -tom

        >
        > and run cases when make succeeds and when make fails?
        > Or doesn't vim-script allow backticks to be used that way?
        >
        > --Suresh
        >
        >
        > >
        >

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Gary Johnson
        ... No, it doesn t. Even if it did, that would be executing the OS command make , not the vim command :make . The output of the former would not be
        Message 3 of 7 , Sep 28, 2007
        • 0 Attachment
          On 2007-09-28, Suresh Govindachar <sgovindachar@...> wrote:
          >
          > > problem is that if there is an error during the
          > > make, it goes right on and executes the second make.
          > > I would prefer to check if the first make failed and
          > > exit out appropriately. is there anyway to do that?
          >
          > Can't it just be done? What happens if you
          > add the lines:
          >
          > let foo = `make`
          > echo foo
          >
          > and run cases when make succeeds and when make fails?
          > Or doesn't vim-script allow backticks to be used that way?

          No, it doesn't. Even if it did, that would be executing the OS
          command "make", not the vim command ":make". The output of the
          former would not be captured in a quickfix error list.

          I thought that using v:shell_error might help, but the exit status
          of the pipeline

          :!make 2>&1| tee /tmp/v52609/1

          executed when you type

          :make

          is apparently that of tee and not that of make.

          How about putting your :make command in a try/recover block? See

          :help try
          :helpgrep :try

          Regards,
          Gary

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • A.Politz
          ... Even if it did execute vims make, make is not an expression, it is a command and commands have no return value. if
          Message 4 of 7 , Sep 28, 2007
          • 0 Attachment
            Gary Johnson wrote:

            >On 2007-09-28, Suresh Govindachar <sgovindachar@...> wrote:
            >
            >
            >>
            >> > problem is that if there is an error during the
            >> > make, it goes right on and executes the second make.
            >> > I would prefer to check if the first make failed and
            >> > exit out appropriately. is there anyway to do that?
            >>
            >> Can't it just be done? What happens if you
            >> add the lines:
            >>
            >> let foo = `make`
            >> echo foo
            >>
            >> and run cases when make succeeds and when make fails?
            >> Or doesn't vim-script allow backticks to be used that way?
            >>
            >>
            >
            >No, it doesn't. Even if it did, that would be executing the OS
            >command "make", not the vim command ":make".
            >
            Even if it did execute vims make, make is not an expression,
            it is a command and commands have no return value.


            if !empty(filter(getqflist(),'v:val.valid'))
            "Error handling
            endif

            ... should work.

            -ap

            --
            Ich hab geträumt, der Krieg wär vorbei.


            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Tom Flynn
            ... and it does! Thank you!! -tom --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For more
            Message 5 of 7 , Sep 28, 2007
            • 0 Attachment
              On 9/28/07, A.Politz <politza@...> wrote:

              >
              > if !empty(filter(getqflist(),'v:val.valid'))
              > "Error handling
              > endif
              >
              > ... should work.

              and it does! Thank you!!
              -tom

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            Your message has been successfully submitted and would be delivered to recipients shortly.