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

Re: [PATCH] makeprg for gcc

Expand Messages
  • Gary Johnson
    ... The user is apparently supposed to execute the :compiler command for each buffer. I looked in $VIMRUNTIME/ftplugin and did not see any plugins that
    Message 1 of 5 , Jul 23, 2013
    • 0 Attachment
      On 2013-07-23, Dimitar DIMITROV wrote:
      > > > Hi,
      > > >
      > > > Found that many default compiler plugins lacked the makeprg setting.
      > > > I basically opened a perl file, then a c file and tried to compile it with
      > :mak
      > > > and it tried to use perl -c
      > > > this patch fixes it for gcc:
      > > >
      > > > *** gcc.vim 2013-07-23 12:32:14.000000000 +0100
      > > > --- /tmp/gcc.vim 2013-07-23 12:32:08.453563055 +0100
      > > > ***************
      > > > *** 11,16 ****
      > > > --- 11,17 ----
      > > > let s:cpo_save = &cpo
      > > > set cpo&vim
      > > >
      > > > + CompilerSet makeprg=gcc\ %\ $*
      > > > CompilerSet errorformat=
      > > > \%*[^\"]\"%f\"%*\\D%l:%c:\ %m,
      > > > \%*[^\"]\"%f\"%*\\D%l:\ %m,
      > >
      > > For C programs, 'makeprg' should not be gcc, it should be make. The
      > > makefile specifies the compiler and how it is to compile the
      > > program.
      >
      > Ok, I realize it now. I should have used a Makefile. Also the message states
      > it.
      > But in fact there is still an issue. If you fist open a perl file (as an
      > example)
      > and right after you open a c file, makeprg is not updated. Is this intentional
      > and the user is supposed to run :comp gcc?

      The user is apparently supposed to execute the :compiler command
      for each buffer. I looked in $VIMRUNTIME/ftplugin and did not
      see any plugins that automatically set the compiler.

      Compiler plugins are supposed to use CompilerSet which should
      normally set 'makeprg' and/or 'errorformat' to be local to the
      buffer. So when you open a Perl file, 'makeprg' should initially
      be "make". After executing ":compiler perl", 'makeprg' should be
      "perl -Wc %". But if you then open a C file, 'makeprg' should
      revert to "make". It does for me, running Vim 7.4a.9.

      Regards,
      Gary

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Bram Moolenaar
      ... I don t really like that solution, because one of many makeprg values could be right. For example, bcc.vim sets it to make . That makes sense for
      Message 2 of 5 , Jul 24, 2013
      • 0 Attachment
        Dimitar Dimitrov wrote:

        > Found that many default compiler plugins lacked the makeprg setting.
        > I basically opened a perl file, then a c file and tried to compile it
        > with :mak and it tried to use perl -c
        > this patch fixes it for gcc:
        >
        > *** gcc.vim    2013-07-23 12:32:14.000000000 +0100
        > --- /tmp/gcc.vim    2013-07-23 12:32:08.453563055 +0100
        > ***************
        > *** 11,16 ****
        > --- 11,17 ----
        >   let s:cpo_save = &cpo
        >   set cpo&vim
        >  
        > + CompilerSet makeprg=gcc\ %\ $*
        >   CompilerSet errorformat=
        >         \%*[^\"]\"%f\"%*\\D%l:%c:\ %m,
        >         \%*[^\"]\"%f\"%*\\D%l:\ %m,

        I don't really like that solution, because one of many makeprg values
        could be right. For example, bcc.vim sets it to "make". That makes
        sense for gcc.vim as well.

        Can we make ther perl compiler plugin restore makeprg?
        Like we have undo_ftplugin for filetype plugins.


        --
        hundred-and-one symptoms of being an internet addict:
        15. Your heart races faster and beats irregularly each time you see a new WWW
        site address in print or on TV, even though you've never had heart
        problems before.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.